Update Source to have a username and password in spec

pull/10616/head
Chris Goller 2016-09-23 14:42:54 -07:00
parent 8fb95fac23
commit 5762359f24
5 changed files with 24 additions and 5 deletions

View File

@ -35,10 +35,16 @@ func sampleSource() *models.Source {
}, },
Name: &name, Name: &name,
Type: &influxType, 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 { func (m *Handler) Sources(ctx context.Context, params op.GetSourcesParams) middleware.Responder {
res := &models.Sources{ res := &models.Sources{
Sources: []*models.Source{ Sources: []*models.Source{

View File

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

View File

@ -35,11 +35,19 @@ type Source struct {
*/ */
Name *string `json:"name"` Name *string `json:"name"`
/* Password in cleartext!
*/
Password string `json:"password,omitempty"`
/* Format of the data source /* Format of the data source
Required: true Required: true
*/ */
Type *string `json:"type"` Type *string `json:"type"`
/* Username for authentication to data source
*/
Username string `json:"username,omitempty"`
} }
// Validate validates this source // 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 { api.PostDashboardsHandler = operations.PostDashboardsHandlerFunc(func(ctx context.Context, params operations.PostDashboardsParams) middleware.Responder {
return middleware.NotImplemented("operation .PostDashboards has not yet been implemented") return middleware.NotImplemented("operation .PostDashboards has not yet been implemented")
}) })
api.PostSourcesHandler = operations.PostSourcesHandlerFunc(func(ctx context.Context, params operations.PostSourcesParams) middleware.Responder { api.PostSourcesHandler = operations.PostSourcesHandlerFunc(mockHandler.NewSource)
return middleware.NotImplemented("operation .PostSources has not yet been implemented")
})
if len(influxFlags.Server) > 0 { if len(influxFlags.Server) > 0 {
c, err := influx.NewClient(influxFlags.Server) c, err := influx.NewClient(influxFlags.Server)

View File

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