Merge pull request #255 from influxdata/chore/add-mappings

Add mappings to route manifest
pull/10616/head
Chris Goller 2016-10-18 19:04:15 -05:00 committed by GitHub
commit c6985f6aa3
31 changed files with 204 additions and 354 deletions

View File

@ -31,9 +31,10 @@ func NewHandler() Handler {
func (m *Handler) AllRoutes(ctx context.Context, params op.GetParams) middleware.Responder {
routes := &models.Routes{
Sources: "/chronograf/v1/sources",
Layouts: "/chronograf/v1/layouts",
Users: "/chronograf/v1/users",
Sources: "/chronograf/v1/sources",
Layouts: "/chronograf/v1/layouts",
Users: "/chronograf/v1/users",
Mappings: "/chronograf/v1/mappings",
}
return op.NewGetOK().WithPayload(routes)
}
@ -350,11 +351,13 @@ func (m *Handler) DeleteExploration(ctx context.Context, params op.DeleteSources
}
func (m *Handler) GetMappings(ctx context.Context, params op.GetMappingsParams) middleware.Responder {
cpu := "cpu"
system := "System"
mp := &models.Mappings{
Mappings: []*models.Mapping{
&models.Mapping{
Measurement: "cpu",
Name: "System",
Measurement: &cpu,
Name: &system,
},
},
}

View File

@ -9,10 +9,8 @@ import (
"github.com/go-openapi/errors"
)
/*AllPermissions All Possible permission strings
swagger:model AllPermissions
*/
// AllPermissions All Possible permission strings
// swagger:model AllPermissions
type AllPermissions []Permission
// Validate validates this all permissions

View File

@ -11,38 +11,27 @@ import (
"github.com/go-openapi/validate"
)
/*Cell cell
swagger:model Cell
*/
// Cell cell
// swagger:model Cell
type Cell struct {
/* Height of Cell in the Layout
Required: true
*/
// Height of Cell in the Layout
// Required: true
H *int32 `json:"h"`
/* Time-series data queries for Cell.
*/
// Time-series data queries for Cell.
Queries []*Proxy `json:"queries,omitempty"`
/* Width of Cell in the Layout
Required: true
*/
// Width of Cell in the Layout
// Required: true
W *int32 `json:"w"`
/* X-coordinate of Cell in the Layout
Required: true
*/
// X-coordinate of Cell in the Layout
// Required: true
X *int32 `json:"x"`
/* Y-coordinate of Cell in the Layout
Required: true
*/
// Y-coordinate of Cell in the Layout
// Required: true
Y *int32 `json:"y"`
}

View File

@ -9,18 +9,14 @@ import (
"github.com/go-openapi/errors"
)
/*Error error
swagger:model Error
*/
// Error error
// swagger:model Error
type Error struct {
/* code
*/
// code
Code int32 `json:"code,omitempty"`
/* message
*/
// message
Message string `json:"message,omitempty"`
}

View File

@ -10,30 +10,23 @@ import (
"github.com/go-openapi/errors"
)
/*Exploration exploration
swagger:model Exploration
*/
// Exploration exploration
// swagger:model Exploration
type Exploration struct {
/* created at
*/
// created at
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
/* Serialization of the exploration query configuration.
*/
// Serialization of the exploration query configuration.
Data interface{} `json:"data,omitempty"`
/* link
*/
// link
Link *Link `json:"link,omitempty"`
/* Exploration name given by user.
*/
// Exploration name given by user.
Name string `json:"name,omitempty"`
/* Latest time the exploration was updated.
*/
// Latest time the exploration was updated.
UpdatedAt strfmt.DateTime `json:"updated_at,omitempty"`
}

View File

@ -11,16 +11,12 @@ import (
"github.com/go-openapi/validate"
)
/*Explorations explorations
swagger:model Explorations
*/
// Explorations explorations
// swagger:model Explorations
type Explorations struct {
/* explorations
Required: true
*/
// explorations
// Required: true
Explorations []*Exploration `json:"explorations"`
}

View File

@ -11,40 +11,29 @@ import (
"github.com/go-openapi/validate"
)
/*Kapacitor kapacitor
swagger:model Kapacitor
*/
// Kapacitor kapacitor
// swagger:model Kapacitor
type Kapacitor struct {
/* Unique identifier representing a kapacitor instance.
Read Only: true
*/
// Unique identifier representing a kapacitor instance.
// Read Only: true
ID string `json:"id,omitempty"`
/* links
*/
// links
Links *KapacitorLinks `json:"links,omitempty"`
/* User facing name of kapacitor instance.
Required: true
*/
// User facing name of kapacitor instance.
// Required: true
Name *string `json:"name"`
/* Password in cleartext!
*/
// Password in cleartext!
Password string `json:"password,omitempty"`
/* URL for the kapacitor backend (e.g. http://localhost:9092)
Required: true
*/
// URL for the kapacitor backend (e.g. http://localhost:9092)
// Required: true
URL *string `json:"url"`
/* Username for authentication to kapacitor
*/
// Username for authentication to kapacitor
Username string `json:"username,omitempty"`
}
@ -107,18 +96,14 @@ func (m *Kapacitor) validateURL(formats strfmt.Registry) error {
return nil
}
/*KapacitorLinks kapacitor links
swagger:model KapacitorLinks
*/
// KapacitorLinks kapacitor links
// swagger:model KapacitorLinks
type KapacitorLinks struct {
/* URL location of proxy endpoint for this source
*/
// URL location of proxy endpoint for this source
Proxy string `json:"proxy,omitempty"`
/* Self link mapping to this resource
*/
// Self link mapping to this resource
Self string `json:"self,omitempty"`
}

View File

@ -3,8 +3,6 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
/*KapacitorProxy Entirely used as the body for the request to the kapacitor backend.
swagger:model KapacitorProxy
*/
// KapacitorProxy Entirely used as the body for the request to the kapacitor backend.
// swagger:model KapacitorProxy
type KapacitorProxy interface{}

View File

@ -3,8 +3,6 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
/*KapacitorProxyResponse Entire response from the kapacitor backend.
swagger:model KapacitorProxyResponse
*/
// KapacitorProxyResponse Entire response from the kapacitor backend.
// swagger:model KapacitorProxyResponse
type KapacitorProxyResponse interface{}

View File

@ -11,16 +11,12 @@ import (
"github.com/go-openapi/validate"
)
/*Kapacitors kapacitors
swagger:model Kapacitors
*/
// Kapacitors kapacitors
// swagger:model Kapacitors
type Kapacitors struct {
/* kapacitors
Required: true
*/
// kapacitors
// Required: true
Kapacitors []*Kapacitor `json:"kapacitors"`
}

View File

@ -11,36 +11,26 @@ import (
"github.com/go-openapi/validate"
)
/*Layout layout
swagger:model Layout
*/
// Layout layout
// swagger:model Layout
type Layout struct {
/* App is the user facing name of this Layout
Required: true
*/
// App is the user facing name of this Layout
// Required: true
App *string `json:"app"`
/* Cells are the individual visualization elements.
Required: true
*/
// Cells are the individual visualization elements.
// Required: true
Cells []*Cell `json:"cells"`
/* ID is an opaque string that uniquely identifies this layout.
*/
// ID is an opaque string that uniquely identifies this layout.
ID string `json:"id,omitempty"`
/* link
*/
// link
Link *Link `json:"link,omitempty"`
/* Measurement is the descriptive name of the time series data.
Required: true
*/
// Measurement is the descriptive name of the time series data.
// Required: true
Measurement *string `json:"measurement"`
}

View File

@ -11,16 +11,12 @@ import (
"github.com/go-openapi/validate"
)
/*Layouts layouts
swagger:model Layouts
*/
// Layouts layouts
// swagger:model Layouts
type Layouts struct {
/* layouts
Required: true
*/
// layouts
// Required: true
Layouts []*Layout `json:"layouts"`
}

View File

@ -10,22 +10,16 @@ import (
"github.com/go-openapi/validate"
)
/*Link URI of resource.
swagger:model Link
*/
// Link URI of resource.
// swagger:model Link
type Link struct {
/* href
Required: true
*/
// href
// Required: true
Href *string `json:"href"`
/* rel
Required: true
*/
// rel
// Required: true
Rel *string `json:"rel"`
}

View File

@ -10,14 +10,11 @@ import (
"github.com/go-openapi/errors"
)
/*Links links
swagger:model Links
*/
// Links links
// swagger:model Links
type Links struct {
/* links
*/
// links
Links []*Link `json:"links,omitempty"`
}

View File

@ -10,23 +10,17 @@ import (
"github.com/go-openapi/validate"
)
/*Mapping mapping
swagger:model Mapping
*/
// Mapping mapping
// swagger:model Mapping
type Mapping struct {
/* The measurement where data for this mapping is found
// The measurement where data for this mapping is found
// Required: true
Measurement *string `json:"measurement"`
Required: true
*/
Measurement string `json:"measurement"`
/* The application name which will be assigned to the corresponding measurement
Required: true
*/
Name string `json:"name"`
// The application name which will be assigned to the corresponding measurement
// Required: true
Name *string `json:"name"`
}
// Validate validates this mapping

View File

@ -11,16 +11,12 @@ import (
"github.com/go-openapi/validate"
)
/*Mappings mappings
swagger:model Mappings
*/
// Mappings mappings
// swagger:model Mappings
type Mappings struct {
/* mappings
Required: true
*/
// mappings
// Required: true
Mappings []*Mapping `json:"mappings"`
}

View File

@ -12,10 +12,8 @@ import (
"github.com/go-openapi/validate"
)
/*Permission Specific access
swagger:model Permission
*/
// Permission Specific access
// swagger:model Permission
type Permission string
const (

View File

@ -10,18 +10,14 @@ import (
"github.com/go-openapi/errors"
)
/*Permissions permissions
swagger:model Permissions
*/
// Permissions permissions
// swagger:model Permissions
type Permissions struct {
/* permissions are scoped to a specific database
*/
// permissions are scoped to a specific database
Database string `json:"database,omitempty"`
/* permissions
*/
// permissions
Permissions []Permission `json:"permissions,omitempty"`
}

View File

@ -13,28 +13,21 @@ import (
"github.com/go-openapi/validate"
)
/*Proxy proxy
swagger:model Proxy
*/
// Proxy proxy
// swagger:model Proxy
type Proxy struct {
/* db
*/
// db
Db string `json:"db,omitempty"`
/* format
*/
// format
Format *string `json:"format,omitempty"`
/* query
Required: true
*/
// query
// Required: true
Query *string `json:"query"`
/* rp
*/
// rp
Rp string `json:"rp,omitempty"`
}
@ -61,7 +54,7 @@ func (m *Proxy) Validate(formats strfmt.Registry) error {
var proxyTypeFormatPropEnum []interface{}
const (
ProxyFormatRaw string = "raw"
proxyFormatRaw string = "raw"
)
// prop value enum

View File

@ -9,14 +9,11 @@ import (
"github.com/go-openapi/errors"
)
/*ProxyResponse proxy response
swagger:model ProxyResponse
*/
// ProxyResponse proxy response
// swagger:model ProxyResponse
type ProxyResponse struct {
/* results from influx
*/
// results from influx
Results interface{} `json:"results,omitempty"`
}

View File

@ -11,31 +11,23 @@ import (
"github.com/go-openapi/validate"
)
/*Role role
swagger:model Role
*/
// Role role
// swagger:model Role
type Role struct {
/* link
*/
// link
Link *Link `json:"link,omitempty"`
/* name
Required: true
Max Length: 64
*/
// name
// Required: true
// Max Length: 64
Name *string `json:"name"`
/* permissions
Required: true
*/
// permissions
// Required: true
Permissions *Permissions `json:"permissions"`
/* users
*/
// users
Users *Users `json:"users,omitempty"`
}

View File

@ -10,14 +10,11 @@ import (
"github.com/go-openapi/errors"
)
/*Roles roles
swagger:model Roles
*/
// Roles roles
// swagger:model Roles
type Roles struct {
/* roles
*/
// roles
Roles []*Role `json:"roles,omitempty"`
}

View File

@ -9,22 +9,20 @@ import (
"github.com/go-openapi/errors"
)
/*Routes routes
swagger:model Routes
*/
// Routes routes
// swagger:model Routes
type Routes struct {
/* Location of the layouts endpoint
*/
// Location of the layouts endpoint
Layouts string `json:"layouts,omitempty"`
/* Location of the sources endpoint
*/
// Location of the application mappings endpoint
Mappings string `json:"mappings,omitempty"`
// Location of the sources endpoint
Sources string `json:"sources,omitempty"`
/* Location of the users endpoint
*/
// Location of the users endpoint
Users string `json:"users,omitempty"`
}

View File

@ -13,22 +13,17 @@ import (
"github.com/go-openapi/validate"
)
/*Service service
swagger:model Service
*/
// Service service
// swagger:model Service
type Service struct {
/* The key part of the key-value pair that makes up a tag. Used to identify a service type.
*/
// The key part of the key-value pair that makes up a tag. Used to identify a service type.
TagKey string `json:"tagKey,omitempty"`
/* The value part of the key-value pair that makes up a tag.
*/
// The value part of the key-value pair that makes up a tag.
TagValue string `json:"tagValue,omitempty"`
/* Type of service
*/
// Type of service
Type string `json:"type,omitempty"`
}
@ -50,9 +45,9 @@ func (m *Service) Validate(formats strfmt.Registry) error {
var serviceTypeTypePropEnum []interface{}
const (
ServiceTypeContainers string = "containers"
ServiceTypeKubernetes string = "kubernetes"
ServiceTypeHost string = "host"
serviceTypeContainers string = "containers"
serviceTypeKubernetes string = "kubernetes"
serviceTypeHost string = "host"
)
// prop value enum

View File

@ -10,14 +10,11 @@ import (
"github.com/go-openapi/errors"
)
/*Services services
swagger:model Services
*/
// Services services
// swagger:model Services
type Services struct {
/* services
*/
// services
Services []*Service `json:"services,omitempty"`
}

View File

@ -13,48 +13,35 @@ import (
"github.com/go-openapi/validate"
)
/*Source source
swagger:model Source
*/
// Source source
// swagger:model Source
type Source struct {
/* Indicates whether this source is the default source
*/
// Indicates whether this source is the default source
Default bool `json:"default,omitempty"`
/* Unique identifier representing a specific data source.
Read Only: true
*/
// Unique identifier representing a specific data source.
// Read Only: true
ID string `json:"id,omitempty"`
/* links
*/
// links
Links *SourceLinks `json:"links,omitempty"`
/* User facing name of data source
Required: true
*/
// User facing name of data source
// Required: true
Name *string `json:"name"`
/* Password in cleartext!
*/
// Password in cleartext!
Password string `json:"password,omitempty"`
/* Format of the data source
*/
// Format of the data source
Type string `json:"type,omitempty"`
/* URL for the time series data source backend (e.g. http://localhost:8086)
Required: true
*/
// URL for the time series data source backend (e.g. http://localhost:8086)
// Required: true
URL *string `json:"url"`
/* Username for authentication to data source
*/
// Username for authentication to data source
Username string `json:"username,omitempty"`
}
@ -116,8 +103,8 @@ func (m *Source) validateName(formats strfmt.Registry) error {
var sourceTypeTypePropEnum []interface{}
const (
SourceTypeInflux string = "influx"
SourceTypeInfluxEnterprise string = "influx-enterprise"
sourceTypeInflux string = "influx"
sourceTypeInfluxEnterprise string = "influx-enterprise"
)
// prop value enum
@ -160,38 +147,29 @@ func (m *Source) validateURL(formats strfmt.Registry) error {
return nil
}
/*SourceLinks source links
swagger:model SourceLinks
*/
// SourceLinks source links
// swagger:model SourceLinks
type SourceLinks struct {
/* URL location of the kapacitors endpoint for this source
*/
// URL location of the kapacitors endpoint for this source
Kapacitors string `json:"kapacitors,omitempty"`
/* URL location of the monitored services endpoint for this source
*/
// URL location of the monitored services endpoint for this source
Monitored string `json:"monitored,omitempty"`
/* URL location of the permissions endpoint for this source
*/
// URL location of the permissions endpoint for this source
Permissions string `json:"permissions,omitempty"`
/* URL location of proxy endpoint for this source
*/
// URL location of proxy endpoint for this source
Proxy string `json:"proxy,omitempty"`
/* URL location of the roles endpoint for this source
*/
// URL location of the roles endpoint for this source
Roles string `json:"roles,omitempty"`
/* Self link mapping to this resource
*/
// Self link mapping to this resource
Self string `json:"self,omitempty"`
/* URL location of users endpoint for this source
*/
// URL location of users endpoint for this source
Users string `json:"users,omitempty"`
}

View File

@ -11,16 +11,12 @@ import (
"github.com/go-openapi/validate"
)
/*Sources sources
swagger:model Sources
*/
// Sources sources
// swagger:model Sources
type Sources struct {
/* sources
Required: true
*/
// sources
// Required: true
Sources []*Source `json:"sources"`
}

View File

@ -11,31 +11,23 @@ import (
"github.com/go-openapi/validate"
)
/*User user
swagger:model User
*/
// User user
// swagger:model User
type User struct {
/* link
*/
// link
Link *Link `json:"link,omitempty"`
/* permissions
Required: true
*/
// permissions
// Required: true
Permissions *Permissions `json:"permissions"`
/* roles
*/
// roles
Roles *Roles `json:"roles,omitempty"`
/* username
Required: true
Max Length: 64
*/
// username
// Required: true
// Max Length: 64
Username *string `json:"username"`
}

View File

@ -10,14 +10,11 @@ import (
"github.com/go-openapi/errors"
)
/*Users users
swagger:model Users
*/
// Users users
// swagger:model Users
type Users struct {
/* users
*/
// users
Users []*User `json:"users,omitempty"`
}

View File

@ -628,6 +628,7 @@ func (o *MrFusionAPI) Serve(builder middleware.Builder) http.Handler {
return o.context.APIHandler(builder)
}
// Init allows you to just initialize the handler cache, you can then recompose the middelware as you see fit
func (o *MrFusionAPI) Init() {
if len(o.handlers) == 0 {
o.initHandlerCache()

View File

@ -15,7 +15,7 @@ paths:
'/':
get:
summary: Lists all the endpoints
description: List of the endpoints.
description: List of the endpoints.
responses:
200:
description: Returns the links to the top level endpoints.
@ -374,7 +374,7 @@ paths:
type: string
description: ID of user to associate this exploration with.
required: true
- name: exploration
- name: exploration
in: body
description: Exploration session to save
schema:
@ -410,7 +410,7 @@ paths:
type: string
description: ID of user to associate this exploration with.
required: true
- name: exploration_id
- name: exploration_id
in: path
type: string
description: ID of the specific exploration.
@ -444,12 +444,12 @@ paths:
type: string
description: ID of user
required: true
- name: exploration_id
- name: exploration_id
in: path
type: string
description: ID of the specific exploration.
required: true
- name: exploration
- name: exploration
in: body
description: Update the exploration information to this.
required: true
@ -480,7 +480,7 @@ paths:
type: string
description: ID of user to associate this exploration with.
required: true
- name: exploration_id
- name: exploration_id
in: path
type: string
description: ID of the specific exploration.
@ -921,7 +921,7 @@ paths:
Layouts are a collection of `Cells` that visualize time-series data.
responses:
200:
description: An array of layouts
description: An array of layouts
schema:
$ref: '#/definitions/Layouts'
default:
@ -931,7 +931,7 @@ paths:
post:
summary: Create new layout
parameters:
- name: layout
- name: layout
in: body
description: Defines the layout and queries of the cells within the layout.
schema:
@ -956,7 +956,7 @@ paths:
- name: id
in: path
type: string
description: ID of the layout
description: ID of the layout
required: true
summary: Specific pre-configured layout containing cells and queries.
description: |
@ -1024,12 +1024,12 @@ definitions:
Kapacitors:
type: object
required:
- kapacitors
- kapacitors
properties:
kapacitors:
type: array
items:
$ref: '#/definitions/Kapacitor'
$ref: '#/definitions/Kapacitor'
Kapacitor:
type: object
required:
@ -1053,7 +1053,7 @@ definitions:
type: string
format: url
description: URL for the kapacitor backend (e.g. http://localhost:9092)
links:
links:
type: object
properties:
self:
@ -1078,7 +1078,7 @@ definitions:
sources:
type: array
items:
$ref: '#/definitions/Source'
$ref: '#/definitions/Source'
Source:
type: object
required:
@ -1111,7 +1111,7 @@ definitions:
default:
type: boolean
description: Indicates whether this source is the default source
links:
links:
type: object
properties:
self:
@ -1247,7 +1247,7 @@ definitions:
$ref: "#/definitions/Permission"
Permission:
type: string
description: Specific access
description: Specific access
enum:
- ViewAdmin
- ViewChronograf
@ -1329,11 +1329,11 @@ definitions:
- h
properties:
x:
description: X-coordinate of Cell in the Layout
description: X-coordinate of Cell in the Layout
type: integer
format: int32
'y':
description: Y-coordinate of Cell in the Layout
description: Y-coordinate of Cell in the Layout
type: integer
format: int32
w:
@ -1364,6 +1364,10 @@ definitions:
description: Location of the sources endpoint
type: string
format: url
mappings:
description: Location of the application mappings endpoint
type: string
format: url
Services:
type: object
properties: