Merge pull request #114 from influxdata/feature/namepassword

Update Source to have a username and password in spec
pull/10616/head
Chris Goller 2016-09-23 14:44:55 -07:00 committed by GitHub
commit 7fe02063d3
5 changed files with 24 additions and 5 deletions

View File

@ -33,12 +33,18 @@ func sampleSource() *models.Source {
Self: "/chronograf/v1/sources/1",
Proxy: "/chronograf/v1/sources/1/proxy",
},
Name: &name,
Type: &influxType,
Name: &name,
Type: &influxType,
Username: "HOWDY!",
Password: "changeme",
}
}
func (m *Handler) NewSource(ctx context.Context, params op.PostSourcesParams) middleware.Responder {
return op.NewPostSourcesCreated()
}
func (m *Handler) Sources(ctx context.Context, params op.GetSourcesParams) middleware.Responder {
res := &models.Sources{
Sources: []*models.Source{

View File

@ -15,6 +15,7 @@ import (
swagger:model Exploration
*/
type Exploration struct {
/* created at
*/
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`

View File

@ -35,11 +35,19 @@ type Source struct {
*/
Name *string `json:"name"`
/* Password in cleartext!
*/
Password string `json:"password,omitempty"`
/* Format of the data source
Required: true
*/
Type *string `json:"type"`
/* Username for authentication to data source
*/
Username string `json:"username,omitempty"`
}
// Validate validates this source

View File

@ -139,9 +139,7 @@ func configureAPI(api *operations.MrFusionAPI) http.Handler {
api.PostDashboardsHandler = operations.PostDashboardsHandlerFunc(func(ctx context.Context, params operations.PostDashboardsParams) middleware.Responder {
return middleware.NotImplemented("operation .PostDashboards has not yet been implemented")
})
api.PostSourcesHandler = operations.PostSourcesHandlerFunc(func(ctx context.Context, params operations.PostSourcesParams) middleware.Responder {
return middleware.NotImplemented("operation .PostSources has not yet been implemented")
})
api.PostSourcesHandler = operations.PostSourcesHandlerFunc(mockHandler.NewSource)
if len(influxFlags.Server) > 0 {
c, err := influx.NewClient(influxFlags.Server)

View File

@ -754,6 +754,12 @@ definitions:
enum:
- influx
- influx-enterprise
username:
type: string
description: Username for authentication to data source
password:
type: string
description: Password in cleartext!
links:
type: object
properties: