Auto-generate backend with stubbed ops

This was generated using go-swagger's `swagger` command. The specific
command used was:

`swagger generate server -f swagger.yaml  --with-context`

Fixes #6
pull/10616/head
Tim Raymond 2016-09-12 15:12:30 -04:00
parent c0a3abe620
commit 75fa4d6a55
108 changed files with 9722 additions and 0 deletions

View File

@ -0,0 +1,54 @@
package main
import (
"log"
"os"
loads "github.com/go-openapi/loads"
flags "github.com/jessevdk/go-flags"
"github.com/influxdata/mrfusion/restapi"
"github.com/influxdata/mrfusion/restapi/operations"
)
// This file was generated by the swagger tool.
// Make sure not to overwrite this file after you generated it because all your edits would be lost!
func main() {
swaggerSpec, err := loads.Analyzed(restapi.SwaggerJSON, "")
if err != nil {
log.Fatalln(err)
}
api := operations.NewMrFusionAPI(swaggerSpec)
server := restapi.NewServer(api)
defer server.Shutdown()
parser := flags.NewParser(server, flags.Default)
parser.ShortDescription = `Mr Fusion`
parser.LongDescription = `Fuel for Chronograf`
server.ConfigureFlags()
for _, optsGroup := range api.CommandLineOptionsGroups {
_, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options)
if err != nil {
log.Fatalln(err)
}
}
if _, err := parser.Parse(); err != nil {
code := 1
if fe, ok := err.(*flags.Error); ok {
if fe.Type == flags.ErrHelp {
code = 0
}
}
os.Exit(code)
}
server.ConfigureAPI()
if err := server.Serve(); err != nil {
log.Fatalln(err)
}
}

26
models/all_permissions.go Normal file
View File

@ -0,0 +1,26 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
)
/*AllPermissions All Possible permission strings
swagger:model AllPermissions
*/
type AllPermissions []Permission
// Validate validates this all permissions
func (m AllPermissions) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

62
models/cell.go Normal file
View File

@ -0,0 +1,62 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Cell cell
swagger:model Cell
*/
type Cell struct {
/* Height of Cell in the Dashboard
*/
H int32 `json:"h,omitempty"`
/* Time-series data queries for Cell.
*/
Queries []string `json:"queries,omitempty"`
/* Width of Cell in the Dashboard
*/
W int32 `json:"w,omitempty"`
/* X-coordinate of Cell in the Dashboard
*/
X int32 `json:"x,omitempty"`
/* Y-coordinate of Cell in the Dashboard
*/
Y int32 `json:"y,omitempty"`
}
// Validate validates this cell
func (m *Cell) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateQueries(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Cell) validateQueries(formats strfmt.Registry) error {
if swag.IsZero(m.Queries) { // not required
return nil
}
return nil
}

89
models/dashboard.go Normal file
View File

@ -0,0 +1,89 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
/*Dashboard dashboard
swagger:model Dashboard
*/
type Dashboard struct {
/* Cells are the individual visualization elements.
Required: true
*/
Cells []*Cell `json:"cells"`
/* link
*/
Link *Link `json:"link,omitempty"`
}
// Validate validates this dashboard
func (m *Dashboard) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCells(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateLink(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Dashboard) validateCells(formats strfmt.Registry) error {
if err := validate.Required("cells", "body", m.Cells); err != nil {
return err
}
for i := 0; i < len(m.Cells); i++ {
if swag.IsZero(m.Cells[i]) { // not required
continue
}
if m.Cells[i] != nil {
if err := m.Cells[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}
func (m *Dashboard) validateLink(formats strfmt.Registry) error {
if swag.IsZero(m.Link) { // not required
return nil
}
if m.Link != nil {
if err := m.Link.Validate(formats); err != nil {
return err
}
}
return nil
}

61
models/dashboards.go Normal file
View File

@ -0,0 +1,61 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Dashboards dashboards
swagger:model Dashboards
*/
type Dashboards struct {
/* dashboards
*/
Dashboards []*Dashboard `json:"dashboards,omitempty"`
}
// Validate validates this dashboards
func (m *Dashboards) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDashboards(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Dashboards) validateDashboards(formats strfmt.Registry) error {
if swag.IsZero(m.Dashboards) { // not required
return nil
}
for i := 0; i < len(m.Dashboards); i++ {
if swag.IsZero(m.Dashboards[i]) { // not required
continue
}
if m.Dashboards[i] != nil {
if err := m.Dashboards[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}

35
models/error.go Normal file
View File

@ -0,0 +1,35 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
)
/*Error error
swagger:model Error
*/
type Error struct {
/* code
*/
Code int32 `json:"code,omitempty"`
/* message
*/
Message string `json:"message,omitempty"`
}
// Validate validates this error
func (m *Error) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

69
models/exploration.go Normal file
View File

@ -0,0 +1,69 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Exploration exploration
swagger:model Exploration
*/
type Exploration struct {
/* created at
*/
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
/* Serialization of the exploration query configuration.
*/
Data interface{} `json:"data,omitempty"`
/* link
*/
Link *Link `json:"link,omitempty"`
/* Exploration name given by user.
*/
Name string `json:"name,omitempty"`
/* Latest time the exploration was updated.
*/
UpdatedAt strfmt.DateTime `json:"updated_at,omitempty"`
}
// Validate validates this exploration
func (m *Exploration) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLink(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Exploration) validateLink(formats strfmt.Registry) error {
if swag.IsZero(m.Link) { // not required
return nil
}
if m.Link != nil {
if err := m.Link.Validate(formats); err != nil {
return err
}
}
return nil
}

61
models/explorations.go Normal file
View File

@ -0,0 +1,61 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Explorations explorations
swagger:model Explorations
*/
type Explorations struct {
/* explorations
*/
Explorations []*Exploration `json:"explorations,omitempty"`
}
// Validate validates this explorations
func (m *Explorations) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateExplorations(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Explorations) validateExplorations(formats strfmt.Registry) error {
if swag.IsZero(m.Explorations) { // not required
return nil
}
for i := 0; i < len(m.Explorations); i++ {
if swag.IsZero(m.Explorations[i]) { // not required
continue
}
if m.Explorations[i] != nil {
if err := m.Explorations[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}

68
models/link.go Normal file
View File

@ -0,0 +1,68 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
/*Link URI of resource.
swagger:model Link
*/
type Link struct {
/* href
Required: true
*/
Href *string `json:"href"`
/* rel
Required: true
*/
Rel *string `json:"rel"`
}
// Validate validates this link
func (m *Link) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateHref(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateRel(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Link) validateHref(formats strfmt.Registry) error {
if err := validate.Required("href", "body", m.Href); err != nil {
return err
}
return nil
}
func (m *Link) validateRel(formats strfmt.Registry) error {
if err := validate.Required("rel", "body", m.Rel); err != nil {
return err
}
return nil
}

61
models/links.go Normal file
View File

@ -0,0 +1,61 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Links links
swagger:model Links
*/
type Links struct {
/* links
*/
Links []*Link `json:"links,omitempty"`
}
// Validate validates this links
func (m *Links) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLinks(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Links) validateLinks(formats strfmt.Registry) error {
if swag.IsZero(m.Links) { // not required
return nil
}
for i := 0; i < len(m.Links); i++ {
if swag.IsZero(m.Links[i]) { // not required
continue
}
if m.Links[i] != nil {
if err := m.Links[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}

53
models/permission.go Normal file
View File

@ -0,0 +1,53 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
/*Permission Specific access
swagger:model Permission
*/
type Permission string
// for schema
var permissionEnum []interface{}
func (m Permission) validatePermissionEnum(path, location string, value Permission) error {
if permissionEnum == nil {
var res []Permission
if err := json.Unmarshal([]byte(`["ViewAdmin","ViewChronograf","CreateDatabase","CreateUserAndRole","AddRemoveNode","DropDatabase","DropData","ReadData","WriteData","Rebalance","ManageShard"]`), &res); err != nil {
return err
}
for _, v := range res {
permissionEnum = append(permissionEnum, v)
}
}
if err := validate.Enum(path, location, value, permissionEnum); err != nil {
return err
}
return nil
}
// Validate validates this permission
func (m Permission) Validate(formats strfmt.Registry) error {
var res []error
// value enum
if err := m.validatePermissionEnum("", "body", m); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

50
models/permissions.go Normal file
View File

@ -0,0 +1,50 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Permissions permissions
swagger:model Permissions
*/
type Permissions struct {
/* permissions are scoped to a specific database
*/
Database string `json:"database,omitempty"`
/* permissions
*/
Permissions []Permission `json:"permissions,omitempty"`
}
// Validate validates this permissions
func (m *Permissions) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validatePermissions(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Permissions) validatePermissions(formats strfmt.Registry) error {
if swag.IsZero(m.Permissions) { // not required
return nil
}
return nil
}

93
models/proxy.go Normal file
View File

@ -0,0 +1,93 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
/*Proxy proxy
swagger:model Proxy
*/
type Proxy struct {
/* format
*/
Format *string `json:"format,omitempty"`
/* query
Required: true
*/
Query *string `json:"query"`
}
// Validate validates this proxy
func (m *Proxy) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateFormat(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateQuery(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
var proxyTypeFormatPropEnum []interface{}
// prop value enum
func (m *Proxy) validateFormatEnum(path, location string, value string) error {
if proxyTypeFormatPropEnum == nil {
var res []string
if err := json.Unmarshal([]byte(`["raw"]`), &res); err != nil {
return err
}
for _, v := range res {
proxyTypeFormatPropEnum = append(proxyTypeFormatPropEnum, v)
}
}
if err := validate.Enum(path, location, value, proxyTypeFormatPropEnum); err != nil {
return err
}
return nil
}
func (m *Proxy) validateFormat(formats strfmt.Registry) error {
if swag.IsZero(m.Format) { // not required
return nil
}
// value enum
if err := m.validateFormatEnum("format", "body", *m.Format); err != nil {
return err
}
return nil
}
func (m *Proxy) validateQuery(formats strfmt.Registry) error {
if err := validate.Required("query", "body", m.Query); err != nil {
return err
}
return nil
}

31
models/proxy_response.go Normal file
View File

@ -0,0 +1,31 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
)
/*ProxyResponse proxy response
swagger:model ProxyResponse
*/
type ProxyResponse struct {
/* results from influx
*/
Results interface{} `json:"results,omitempty"`
}
// Validate validates this proxy response
func (m *ProxyResponse) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

131
models/role.go Normal file
View File

@ -0,0 +1,131 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
/*Role role
swagger:model Role
*/
type Role struct {
/* link
*/
Link *Link `json:"link,omitempty"`
/* name
Required: true
Max Length: 64
*/
Name *string `json:"name"`
/* permissions
Required: true
*/
Permissions *Permissions `json:"permissions"`
/* users
*/
Users *Users `json:"users,omitempty"`
}
// Validate validates this role
func (m *Role) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLink(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validatePermissions(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateUsers(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Role) validateLink(formats strfmt.Registry) error {
if swag.IsZero(m.Link) { // not required
return nil
}
if m.Link != nil {
if err := m.Link.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *Role) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
if err := validate.MaxLength("name", "body", string(*m.Name), 64); err != nil {
return err
}
return nil
}
func (m *Role) validatePermissions(formats strfmt.Registry) error {
if err := validate.Required("permissions", "body", m.Permissions); err != nil {
return err
}
if m.Permissions != nil {
if err := m.Permissions.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *Role) validateUsers(formats strfmt.Registry) error {
if swag.IsZero(m.Users) { // not required
return nil
}
if m.Users != nil {
if err := m.Users.Validate(formats); err != nil {
return err
}
}
return nil
}

61
models/roles.go Normal file
View File

@ -0,0 +1,61 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Roles roles
swagger:model Roles
*/
type Roles struct {
/* roles
*/
Roles []*Role `json:"roles,omitempty"`
}
// Validate validates this roles
func (m *Roles) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateRoles(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Roles) validateRoles(formats strfmt.Registry) error {
if swag.IsZero(m.Roles) { // not required
return nil
}
for i := 0; i < len(m.Roles); i++ {
if swag.IsZero(m.Roles[i]) { // not required
continue
}
if m.Roles[i] != nil {
if err := m.Roles[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}

126
models/source.go Normal file
View File

@ -0,0 +1,126 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
/*Source source
swagger:model Source
*/
type Source struct {
/* Unique identifier representing a specific data source.
Read Only: true
*/
ID string `json:"id,omitempty"`
/* link
*/
Link *Link `json:"link,omitempty"`
/* User facing name of data source
Required: true
*/
Name *string `json:"name"`
/* Format of the data source
Required: true
*/
Type *string `json:"type"`
}
// Validate validates this source
func (m *Source) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLink(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateType(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Source) validateLink(formats strfmt.Registry) error {
if swag.IsZero(m.Link) { // not required
return nil
}
if m.Link != nil {
if err := m.Link.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *Source) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
var sourceTypeTypePropEnum []interface{}
// prop value enum
func (m *Source) validateTypeEnum(path, location string, value string) error {
if sourceTypeTypePropEnum == nil {
var res []string
if err := json.Unmarshal([]byte(`["influx","influx-enterprise"]`), &res); err != nil {
return err
}
for _, v := range res {
sourceTypeTypePropEnum = append(sourceTypeTypePropEnum, v)
}
}
if err := validate.Enum(path, location, value, sourceTypeTypePropEnum); err != nil {
return err
}
return nil
}
func (m *Source) validateType(formats strfmt.Registry) error {
if err := validate.Required("type", "body", m.Type); err != nil {
return err
}
// value enum
if err := m.validateTypeEnum("type", "body", *m.Type); err != nil {
return err
}
return nil
}

61
models/sources.go Normal file
View File

@ -0,0 +1,61 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Sources sources
swagger:model Sources
*/
type Sources struct {
/* sources
*/
Sources []*Source `json:"sources,omitempty"`
}
// Validate validates this sources
func (m *Sources) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateSources(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Sources) validateSources(formats strfmt.Registry) error {
if swag.IsZero(m.Sources) { // not required
return nil
}
for i := 0; i < len(m.Sources); i++ {
if swag.IsZero(m.Sources[i]) { // not required
continue
}
if m.Sources[i] != nil {
if err := m.Sources[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}

131
models/user.go Normal file
View File

@ -0,0 +1,131 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
/*User user
swagger:model User
*/
type User struct {
/* link
*/
Link *Link `json:"link,omitempty"`
/* permissions
Required: true
*/
Permissions *Permissions `json:"permissions"`
/* roles
*/
Roles *Roles `json:"roles,omitempty"`
/* username
Required: true
Max Length: 64
*/
Username *string `json:"username"`
}
// Validate validates this user
func (m *User) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLink(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validatePermissions(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateRoles(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateUsername(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *User) validateLink(formats strfmt.Registry) error {
if swag.IsZero(m.Link) { // not required
return nil
}
if m.Link != nil {
if err := m.Link.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *User) validatePermissions(formats strfmt.Registry) error {
if err := validate.Required("permissions", "body", m.Permissions); err != nil {
return err
}
if m.Permissions != nil {
if err := m.Permissions.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *User) validateRoles(formats strfmt.Registry) error {
if swag.IsZero(m.Roles) { // not required
return nil
}
if m.Roles != nil {
if err := m.Roles.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *User) validateUsername(formats strfmt.Registry) error {
if err := validate.Required("username", "body", m.Username); err != nil {
return err
}
if err := validate.MaxLength("username", "body", string(*m.Username), 64); err != nil {
return err
}
return nil
}

61
models/users.go Normal file
View File

@ -0,0 +1,61 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
/*Users users
swagger:model Users
*/
type Users struct {
/* users
*/
Users []*User `json:"users,omitempty"`
}
// Validate validates this users
func (m *Users) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateUsers(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Users) validateUsers(formats strfmt.Registry) error {
if swag.IsZero(m.Users) { // not required
return nil
}
for i := 0; i < len(m.Users); i++ {
if swag.IsZero(m.Users[i]) { // not required
continue
}
if m.Users[i] != nil {
if err := m.Users[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}

View File

@ -0,0 +1,142 @@
package restapi
import (
"crypto/tls"
"net/http"
errors "github.com/go-openapi/errors"
runtime "github.com/go-openapi/runtime"
middleware "github.com/go-openapi/runtime/middleware"
"golang.org/x/net/context"
"github.com/influxdata/mrfusion/restapi/operations"
)
// This file is safe to edit. Once it exists it will not be overwritten
//go:generate swagger generate server --target .. --name --spec ../swagger.yaml --with-context
func configureFlags(api *operations.MrFusionAPI) {
// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }
}
func configureAPI(api *operations.MrFusionAPI) http.Handler {
// configure the api here
api.ServeError = errors.ServeError
// Set your custom logger if needed. Default one is log.Printf
// Expected interface func(string, ...interface{})
//
// Example:
// s.api.Logger = log.Printf
api.JSONConsumer = runtime.JSONConsumer()
api.JSONProducer = runtime.JSONProducer()
api.DeleteDashboardsIDHandler = operations.DeleteDashboardsIDHandlerFunc(func(ctx context.Context, params operations.DeleteDashboardsIDParams) middleware.Responder {
return middleware.NotImplemented("operation .DeleteDashboardsID has not yet been implemented")
})
api.DeleteSourcesIDHandler = operations.DeleteSourcesIDHandlerFunc(func(ctx context.Context, params operations.DeleteSourcesIDParams) middleware.Responder {
return middleware.NotImplemented("operation .DeleteSourcesID has not yet been implemented")
})
api.DeleteSourcesIDRolesRoleIDHandler = operations.DeleteSourcesIDRolesRoleIDHandlerFunc(func(ctx context.Context, params operations.DeleteSourcesIDRolesRoleIDParams) middleware.Responder {
return middleware.NotImplemented("operation .DeleteSourcesIDRolesRoleID has not yet been implemented")
})
api.DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler = operations.DeleteSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc(func(ctx context.Context, params operations.DeleteSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder {
return middleware.NotImplemented("operation .DeleteSourcesIDUserUserIDExplorationsExplorationID has not yet been implemented")
})
api.DeleteSourcesIDUsersUserIDHandler = operations.DeleteSourcesIDUsersUserIDHandlerFunc(func(ctx context.Context, params operations.DeleteSourcesIDUsersUserIDParams) middleware.Responder {
return middleware.NotImplemented("operation .DeleteSourcesIDUsersUserID has not yet been implemented")
})
api.GetHandler = operations.GetHandlerFunc(func(ctx context.Context, params operations.GetParams) middleware.Responder {
return middleware.NotImplemented("operation .Get has not yet been implemented")
})
api.GetDashboardsHandler = operations.GetDashboardsHandlerFunc(func(ctx context.Context, params operations.GetDashboardsParams) middleware.Responder {
return middleware.NotImplemented("operation .GetDashboards has not yet been implemented")
})
api.GetDashboardsIDHandler = operations.GetDashboardsIDHandlerFunc(func(ctx context.Context, params operations.GetDashboardsIDParams) middleware.Responder {
return middleware.NotImplemented("operation .GetDashboardsID has not yet been implemented")
})
api.GetSourcesHandler = operations.GetSourcesHandlerFunc(func(ctx context.Context, params operations.GetSourcesParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSources has not yet been implemented")
})
api.GetSourcesIDHandler = operations.GetSourcesIDHandlerFunc(func(ctx context.Context, params operations.GetSourcesIDParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSourcesID has not yet been implemented")
})
api.GetSourcesIDPermissionsHandler = operations.GetSourcesIDPermissionsHandlerFunc(func(ctx context.Context, params operations.GetSourcesIDPermissionsParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSourcesIDPermissions has not yet been implemented")
})
api.GetSourcesIDRolesHandler = operations.GetSourcesIDRolesHandlerFunc(func(ctx context.Context, params operations.GetSourcesIDRolesParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSourcesIDRoles has not yet been implemented")
})
api.GetSourcesIDRolesRoleIDHandler = operations.GetSourcesIDRolesRoleIDHandlerFunc(func(ctx context.Context, params operations.GetSourcesIDRolesRoleIDParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSourcesIDRolesRoleID has not yet been implemented")
})
api.GetSourcesIDUserUserIDExplorationsExplorationIDHandler = operations.GetSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc(func(ctx context.Context, params operations.GetSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSourcesIDUserUserIDExplorationsExplorationID has not yet been implemented")
})
api.GetSourcesIDUsersHandler = operations.GetSourcesIDUsersHandlerFunc(func(ctx context.Context, params operations.GetSourcesIDUsersParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSourcesIDUsers has not yet been implemented")
})
api.GetSourcesIDUsersUserIDHandler = operations.GetSourcesIDUsersUserIDHandlerFunc(func(ctx context.Context, params operations.GetSourcesIDUsersUserIDParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSourcesIDUsersUserID has not yet been implemented")
})
api.GetSourcesIDUsersUserIDExplorationsHandler = operations.GetSourcesIDUsersUserIDExplorationsHandlerFunc(func(ctx context.Context, params operations.GetSourcesIDUsersUserIDExplorationsParams) middleware.Responder {
return middleware.NotImplemented("operation .GetSourcesIDUsersUserIDExplorations has not yet been implemented")
})
api.PatchSourcesIDHandler = operations.PatchSourcesIDHandlerFunc(func(ctx context.Context, params operations.PatchSourcesIDParams) middleware.Responder {
return middleware.NotImplemented("operation .PatchSourcesID has not yet been implemented")
})
api.PatchSourcesIDRolesRoleIDHandler = operations.PatchSourcesIDRolesRoleIDHandlerFunc(func(ctx context.Context, params operations.PatchSourcesIDRolesRoleIDParams) middleware.Responder {
return middleware.NotImplemented("operation .PatchSourcesIDRolesRoleID has not yet been implemented")
})
api.PatchSourcesIDUserUserIDExplorationsExplorationIDHandler = operations.PatchSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc(func(ctx context.Context, params operations.PatchSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder {
return middleware.NotImplemented("operation .PatchSourcesIDUserUserIDExplorationsExplorationID has not yet been implemented")
})
api.PatchSourcesIDUsersUserIDHandler = operations.PatchSourcesIDUsersUserIDHandlerFunc(func(ctx context.Context, params operations.PatchSourcesIDUsersUserIDParams) middleware.Responder {
return middleware.NotImplemented("operation .PatchSourcesIDUsersUserID has not yet been implemented")
})
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.PostSourcesIDProxyHandler = operations.PostSourcesIDProxyHandlerFunc(func(ctx context.Context, params operations.PostSourcesIDProxyParams) middleware.Responder {
return middleware.NotImplemented("operation .PostSourcesIDProxy has not yet been implemented")
})
api.PostSourcesIDRolesHandler = operations.PostSourcesIDRolesHandlerFunc(func(ctx context.Context, params operations.PostSourcesIDRolesParams) middleware.Responder {
return middleware.NotImplemented("operation .PostSourcesIDRoles has not yet been implemented")
})
api.PostSourcesIDUsersHandler = operations.PostSourcesIDUsersHandlerFunc(func(ctx context.Context, params operations.PostSourcesIDUsersParams) middleware.Responder {
return middleware.NotImplemented("operation .PostSourcesIDUsers has not yet been implemented")
})
api.PostSourcesIDUsersUserIDExplorationsHandler = operations.PostSourcesIDUsersUserIDExplorationsHandlerFunc(func(ctx context.Context, params operations.PostSourcesIDUsersUserIDExplorationsParams) middleware.Responder {
return middleware.NotImplemented("operation .PostSourcesIDUsersUserIDExplorations has not yet been implemented")
})
api.PutDashboardsIDHandler = operations.PutDashboardsIDHandlerFunc(func(ctx context.Context, params operations.PutDashboardsIDParams) middleware.Responder {
return middleware.NotImplemented("operation .PutDashboardsID has not yet been implemented")
})
api.ServerShutdown = func() {}
return setupGlobalMiddleware(api.Serve(setupMiddlewares))
}
// The TLS configuration before HTTPS server starts.
func configureTLS(tlsConfig *tls.Config) {
// Make all necessary changes to the TLS configuration here.
}
// The middleware configuration is for the handler executors. These do not apply to the swagger.json document.
// The middleware executes after routing but before authentication, binding and validation
func setupMiddlewares(handler http.Handler) http.Handler {
return handler
}
// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
// So this is a good place to plug in a panic handling middleware, logging and metrics
func setupGlobalMiddleware(handler http.Handler) http.Handler {
return handler
}

22
restapi/doc.go Normal file
View File

@ -0,0 +1,22 @@
/*Package restapi Mr Fusion
Fuel for Chronograf
Schemes:
http
Host: Chronograf.influxdata.com
BasePath: /chronograf/v1
Version: 1.1.0
Consumes:
- application/json
Produces:
- application/json
swagger:meta
*/
package restapi

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// DeleteDashboardsIDHandlerFunc turns a function with the right signature into a delete dashboards ID handler
type DeleteDashboardsIDHandlerFunc func(context.Context, DeleteDashboardsIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteDashboardsIDHandlerFunc) Handle(ctx context.Context, params DeleteDashboardsIDParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteDashboardsIDHandler interface for that can handle valid delete dashboards ID params
type DeleteDashboardsIDHandler interface {
Handle(context.Context, DeleteDashboardsIDParams) middleware.Responder
}
// NewDeleteDashboardsID creates a new http.Handler for the delete dashboards ID operation
func NewDeleteDashboardsID(ctx *middleware.Context, handler DeleteDashboardsIDHandler) *DeleteDashboardsID {
return &DeleteDashboardsID{Context: ctx, Handler: handler}
}
/*DeleteDashboardsID swagger:route DELETE /dashboards/{id} deleteDashboardsId
This specific dashboard will be removed from the data store
*/
type DeleteDashboardsID struct {
Context *middleware.Context
Handler DeleteDashboardsIDHandler
}
func (o *DeleteDashboardsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteDashboardsIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,64 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteDashboardsIDParams creates a new DeleteDashboardsIDParams object
// with the default values initialized.
func NewDeleteDashboardsIDParams() DeleteDashboardsIDParams {
var ()
return DeleteDashboardsIDParams{}
}
// DeleteDashboardsIDParams contains all the bound params for the delete dashboards ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteDashboardsID
type DeleteDashboardsIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the dashboard
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *DeleteDashboardsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *DeleteDashboardsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*DeleteDashboardsIDNoContent An array of dashboards
swagger:response deleteDashboardsIdNoContent
*/
type DeleteDashboardsIDNoContent struct {
}
// NewDeleteDashboardsIDNoContent creates DeleteDashboardsIDNoContent with default headers values
func NewDeleteDashboardsIDNoContent() *DeleteDashboardsIDNoContent {
return &DeleteDashboardsIDNoContent{}
}
// WriteResponse to the client
func (o *DeleteDashboardsIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteDashboardsIDNotFound Unknown dashboard id
swagger:response deleteDashboardsIdNotFound
*/
type DeleteDashboardsIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteDashboardsIDNotFound creates DeleteDashboardsIDNotFound with default headers values
func NewDeleteDashboardsIDNotFound() *DeleteDashboardsIDNotFound {
return &DeleteDashboardsIDNotFound{}
}
// WithPayload adds the payload to the delete dashboards Id not found response
func (o *DeleteDashboardsIDNotFound) WithPayload(payload *models.Error) *DeleteDashboardsIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete dashboards Id not found response
func (o *DeleteDashboardsIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteDashboardsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*DeleteDashboardsIDDefault Unexpected internal service error
swagger:response deleteDashboardsIdDefault
*/
type DeleteDashboardsIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteDashboardsIDDefault creates DeleteDashboardsIDDefault with default headers values
func NewDeleteDashboardsIDDefault(code int) *DeleteDashboardsIDDefault {
if code <= 0 {
code = 500
}
return &DeleteDashboardsIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete dashboards ID default response
func (o *DeleteDashboardsIDDefault) WithStatusCode(code int) *DeleteDashboardsIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete dashboards ID default response
func (o *DeleteDashboardsIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete dashboards ID default response
func (o *DeleteDashboardsIDDefault) WithPayload(payload *models.Error) *DeleteDashboardsIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete dashboards ID default response
func (o *DeleteDashboardsIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteDashboardsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// DeleteSourcesIDHandlerFunc turns a function with the right signature into a delete sources ID handler
type DeleteSourcesIDHandlerFunc func(context.Context, DeleteSourcesIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteSourcesIDHandlerFunc) Handle(ctx context.Context, params DeleteSourcesIDParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteSourcesIDHandler interface for that can handle valid delete sources ID params
type DeleteSourcesIDHandler interface {
Handle(context.Context, DeleteSourcesIDParams) middleware.Responder
}
// NewDeleteSourcesID creates a new http.Handler for the delete sources ID operation
func NewDeleteSourcesID(ctx *middleware.Context, handler DeleteSourcesIDHandler) *DeleteSourcesID {
return &DeleteSourcesID{Context: ctx, Handler: handler}
}
/*DeleteSourcesID swagger:route DELETE /sources/{id} deleteSourcesId
This specific data source will be removed from the data store
*/
type DeleteSourcesID struct {
Context *middleware.Context
Handler DeleteSourcesIDHandler
}
func (o *DeleteSourcesID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteSourcesIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,64 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteSourcesIDParams creates a new DeleteSourcesIDParams object
// with the default values initialized.
func NewDeleteSourcesIDParams() DeleteSourcesIDParams {
var ()
return DeleteSourcesIDParams{}
}
// DeleteSourcesIDParams contains all the bound params for the delete sources ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteSourcesID
type DeleteSourcesIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the source
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *DeleteSourcesIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *DeleteSourcesIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*DeleteSourcesIDNoContent data source has been removed
swagger:response deleteSourcesIdNoContent
*/
type DeleteSourcesIDNoContent struct {
}
// NewDeleteSourcesIDNoContent creates DeleteSourcesIDNoContent with default headers values
func NewDeleteSourcesIDNoContent() *DeleteSourcesIDNoContent {
return &DeleteSourcesIDNoContent{}
}
// WriteResponse to the client
func (o *DeleteSourcesIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteSourcesIDNotFound Unknown data source id
swagger:response deleteSourcesIdNotFound
*/
type DeleteSourcesIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDNotFound creates DeleteSourcesIDNotFound with default headers values
func NewDeleteSourcesIDNotFound() *DeleteSourcesIDNotFound {
return &DeleteSourcesIDNotFound{}
}
// WithPayload adds the payload to the delete sources Id not found response
func (o *DeleteSourcesIDNotFound) WithPayload(payload *models.Error) *DeleteSourcesIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources Id not found response
func (o *DeleteSourcesIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*DeleteSourcesIDDefault Unexpected internal service error
swagger:response deleteSourcesIdDefault
*/
type DeleteSourcesIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDDefault creates DeleteSourcesIDDefault with default headers values
func NewDeleteSourcesIDDefault(code int) *DeleteSourcesIDDefault {
if code <= 0 {
code = 500
}
return &DeleteSourcesIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete sources ID default response
func (o *DeleteSourcesIDDefault) WithStatusCode(code int) *DeleteSourcesIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete sources ID default response
func (o *DeleteSourcesIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete sources ID default response
func (o *DeleteSourcesIDDefault) WithPayload(payload *models.Error) *DeleteSourcesIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources ID default response
func (o *DeleteSourcesIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// DeleteSourcesIDRolesRoleIDHandlerFunc turns a function with the right signature into a delete sources ID roles role ID handler
type DeleteSourcesIDRolesRoleIDHandlerFunc func(context.Context, DeleteSourcesIDRolesRoleIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteSourcesIDRolesRoleIDHandlerFunc) Handle(ctx context.Context, params DeleteSourcesIDRolesRoleIDParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteSourcesIDRolesRoleIDHandler interface for that can handle valid delete sources ID roles role ID params
type DeleteSourcesIDRolesRoleIDHandler interface {
Handle(context.Context, DeleteSourcesIDRolesRoleIDParams) middleware.Responder
}
// NewDeleteSourcesIDRolesRoleID creates a new http.Handler for the delete sources ID roles role ID operation
func NewDeleteSourcesIDRolesRoleID(ctx *middleware.Context, handler DeleteSourcesIDRolesRoleIDHandler) *DeleteSourcesIDRolesRoleID {
return &DeleteSourcesIDRolesRoleID{Context: ctx, Handler: handler}
}
/*DeleteSourcesIDRolesRoleID swagger:route DELETE /sources/{id}/roles/{role_id} deleteSourcesIdRolesRoleId
This specific role will be removed from the data store
*/
type DeleteSourcesIDRolesRoleID struct {
Context *middleware.Context
Handler DeleteSourcesIDRolesRoleIDHandler
}
func (o *DeleteSourcesIDRolesRoleID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteSourcesIDRolesRoleIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,85 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteSourcesIDRolesRoleIDParams creates a new DeleteSourcesIDRolesRoleIDParams object
// with the default values initialized.
func NewDeleteSourcesIDRolesRoleIDParams() DeleteSourcesIDRolesRoleIDParams {
var ()
return DeleteSourcesIDRolesRoleIDParams{}
}
// DeleteSourcesIDRolesRoleIDParams contains all the bound params for the delete sources ID roles role ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteSourcesIDRolesRoleID
type DeleteSourcesIDRolesRoleIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of the specific role
Required: true
In: path
*/
RoleID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *DeleteSourcesIDRolesRoleIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rRoleID, rhkRoleID, _ := route.Params.GetOK("role_id")
if err := o.bindRoleID(rRoleID, rhkRoleID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *DeleteSourcesIDRolesRoleIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *DeleteSourcesIDRolesRoleIDParams) bindRoleID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.RoleID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*DeleteSourcesIDRolesRoleIDNoContent Role has been removed
swagger:response deleteSourcesIdRolesRoleIdNoContent
*/
type DeleteSourcesIDRolesRoleIDNoContent struct {
}
// NewDeleteSourcesIDRolesRoleIDNoContent creates DeleteSourcesIDRolesRoleIDNoContent with default headers values
func NewDeleteSourcesIDRolesRoleIDNoContent() *DeleteSourcesIDRolesRoleIDNoContent {
return &DeleteSourcesIDRolesRoleIDNoContent{}
}
// WriteResponse to the client
func (o *DeleteSourcesIDRolesRoleIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteSourcesIDRolesRoleIDNotFound Unknown role id
swagger:response deleteSourcesIdRolesRoleIdNotFound
*/
type DeleteSourcesIDRolesRoleIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDRolesRoleIDNotFound creates DeleteSourcesIDRolesRoleIDNotFound with default headers values
func NewDeleteSourcesIDRolesRoleIDNotFound() *DeleteSourcesIDRolesRoleIDNotFound {
return &DeleteSourcesIDRolesRoleIDNotFound{}
}
// WithPayload adds the payload to the delete sources Id roles role Id not found response
func (o *DeleteSourcesIDRolesRoleIDNotFound) WithPayload(payload *models.Error) *DeleteSourcesIDRolesRoleIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources Id roles role Id not found response
func (o *DeleteSourcesIDRolesRoleIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDRolesRoleIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*DeleteSourcesIDRolesRoleIDDefault Unexpected internal service error
swagger:response deleteSourcesIdRolesRoleIdDefault
*/
type DeleteSourcesIDRolesRoleIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDRolesRoleIDDefault creates DeleteSourcesIDRolesRoleIDDefault with default headers values
func NewDeleteSourcesIDRolesRoleIDDefault(code int) *DeleteSourcesIDRolesRoleIDDefault {
if code <= 0 {
code = 500
}
return &DeleteSourcesIDRolesRoleIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete sources ID roles role ID default response
func (o *DeleteSourcesIDRolesRoleIDDefault) WithStatusCode(code int) *DeleteSourcesIDRolesRoleIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete sources ID roles role ID default response
func (o *DeleteSourcesIDRolesRoleIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete sources ID roles role ID default response
func (o *DeleteSourcesIDRolesRoleIDDefault) WithPayload(payload *models.Error) *DeleteSourcesIDRolesRoleIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources ID roles role ID default response
func (o *DeleteSourcesIDRolesRoleIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDRolesRoleIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// DeleteSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc turns a function with the right signature into a delete sources ID user user ID explorations exploration ID handler
type DeleteSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc func(context.Context, DeleteSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc) Handle(ctx context.Context, params DeleteSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler interface for that can handle valid delete sources ID user user ID explorations exploration ID params
type DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler interface {
Handle(context.Context, DeleteSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder
}
// NewDeleteSourcesIDUserUserIDExplorationsExplorationID creates a new http.Handler for the delete sources ID user user ID explorations exploration ID operation
func NewDeleteSourcesIDUserUserIDExplorationsExplorationID(ctx *middleware.Context, handler DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler) *DeleteSourcesIDUserUserIDExplorationsExplorationID {
return &DeleteSourcesIDUserUserIDExplorationsExplorationID{Context: ctx, Handler: handler}
}
/*DeleteSourcesIDUserUserIDExplorationsExplorationID swagger:route DELETE /sources/{id}/user/{user_id}/explorations/{exploration_id} deleteSourcesIdUserUserIdExplorationsExplorationId
This specific exporer session will be removed.
*/
type DeleteSourcesIDUserUserIDExplorationsExplorationID struct {
Context *middleware.Context
Handler DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler
}
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteSourcesIDUserUserIDExplorationsExplorationIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,106 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteSourcesIDUserUserIDExplorationsExplorationIDParams creates a new DeleteSourcesIDUserUserIDExplorationsExplorationIDParams object
// with the default values initialized.
func NewDeleteSourcesIDUserUserIDExplorationsExplorationIDParams() DeleteSourcesIDUserUserIDExplorationsExplorationIDParams {
var ()
return DeleteSourcesIDUserUserIDExplorationsExplorationIDParams{}
}
// DeleteSourcesIDUserUserIDExplorationsExplorationIDParams contains all the bound params for the delete sources ID user user ID explorations exploration ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteSourcesIDUserUserIDExplorationsExplorationID
type DeleteSourcesIDUserUserIDExplorationsExplorationIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the specific exploration.
Required: true
In: path
*/
ExplorationID string
/*ID of the data source
Required: true
In: path
*/
ID string
/*ID of user to associate this exploration with.
Required: true
In: path
*/
UserID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rExplorationID, rhkExplorationID, _ := route.Params.GetOK("exploration_id")
if err := o.bindExplorationID(rExplorationID, rhkExplorationID, route.Formats); err != nil {
res = append(res, err)
}
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rUserID, rhkUserID, _ := route.Params.GetOK("user_id")
if err := o.bindUserID(rUserID, rhkUserID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDParams) bindExplorationID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ExplorationID = raw
return nil
}
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDParams) bindUserID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.UserID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*DeleteSourcesIDUserUserIDExplorationsExplorationIDNoContent Exploration session has been removed
swagger:response deleteSourcesIdUserUserIdExplorationsExplorationIdNoContent
*/
type DeleteSourcesIDUserUserIDExplorationsExplorationIDNoContent struct {
}
// NewDeleteSourcesIDUserUserIDExplorationsExplorationIDNoContent creates DeleteSourcesIDUserUserIDExplorationsExplorationIDNoContent with default headers values
func NewDeleteSourcesIDUserUserIDExplorationsExplorationIDNoContent() *DeleteSourcesIDUserUserIDExplorationsExplorationIDNoContent {
return &DeleteSourcesIDUserUserIDExplorationsExplorationIDNoContent{}
}
// WriteResponse to the client
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound Data source id, user, or exploration does not exist.
swagger:response deleteSourcesIdUserUserIdExplorationsExplorationIdNotFound
*/
type DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound creates DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound with default headers values
func NewDeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound() *DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound {
return &DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound{}
}
// WithPayload adds the payload to the delete sources Id user user Id explorations exploration Id not found response
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound) WithPayload(payload *models.Error) *DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources Id user user Id explorations exploration Id not found response
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault Unexpected internal service error
swagger:response deleteSourcesIdUserUserIdExplorationsExplorationIdDefault
*/
type DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDUserUserIDExplorationsExplorationIDDefault creates DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault with default headers values
func NewDeleteSourcesIDUserUserIDExplorationsExplorationIDDefault(code int) *DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault {
if code <= 0 {
code = 500
}
return &DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete sources ID user user ID explorations exploration ID default response
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault) WithStatusCode(code int) *DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete sources ID user user ID explorations exploration ID default response
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete sources ID user user ID explorations exploration ID default response
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault) WithPayload(payload *models.Error) *DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources ID user user ID explorations exploration ID default response
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDUserUserIDExplorationsExplorationIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// DeleteSourcesIDUsersUserIDHandlerFunc turns a function with the right signature into a delete sources ID users user ID handler
type DeleteSourcesIDUsersUserIDHandlerFunc func(context.Context, DeleteSourcesIDUsersUserIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteSourcesIDUsersUserIDHandlerFunc) Handle(ctx context.Context, params DeleteSourcesIDUsersUserIDParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteSourcesIDUsersUserIDHandler interface for that can handle valid delete sources ID users user ID params
type DeleteSourcesIDUsersUserIDHandler interface {
Handle(context.Context, DeleteSourcesIDUsersUserIDParams) middleware.Responder
}
// NewDeleteSourcesIDUsersUserID creates a new http.Handler for the delete sources ID users user ID operation
func NewDeleteSourcesIDUsersUserID(ctx *middleware.Context, handler DeleteSourcesIDUsersUserIDHandler) *DeleteSourcesIDUsersUserID {
return &DeleteSourcesIDUsersUserID{Context: ctx, Handler: handler}
}
/*DeleteSourcesIDUsersUserID swagger:route DELETE /sources/{id}/users/{user_id} deleteSourcesIdUsersUserId
This specific user will be removed from the data store
*/
type DeleteSourcesIDUsersUserID struct {
Context *middleware.Context
Handler DeleteSourcesIDUsersUserIDHandler
}
func (o *DeleteSourcesIDUsersUserID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteSourcesIDUsersUserIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,85 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteSourcesIDUsersUserIDParams creates a new DeleteSourcesIDUsersUserIDParams object
// with the default values initialized.
func NewDeleteSourcesIDUsersUserIDParams() DeleteSourcesIDUsersUserIDParams {
var ()
return DeleteSourcesIDUsersUserIDParams{}
}
// DeleteSourcesIDUsersUserIDParams contains all the bound params for the delete sources ID users user ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteSourcesIDUsersUserID
type DeleteSourcesIDUsersUserIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of the specific user
Required: true
In: path
*/
UserID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *DeleteSourcesIDUsersUserIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rUserID, rhkUserID, _ := route.Params.GetOK("user_id")
if err := o.bindUserID(rUserID, rhkUserID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *DeleteSourcesIDUsersUserIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *DeleteSourcesIDUsersUserIDParams) bindUserID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.UserID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*DeleteSourcesIDUsersUserIDNoContent User has been removed
swagger:response deleteSourcesIdUsersUserIdNoContent
*/
type DeleteSourcesIDUsersUserIDNoContent struct {
}
// NewDeleteSourcesIDUsersUserIDNoContent creates DeleteSourcesIDUsersUserIDNoContent with default headers values
func NewDeleteSourcesIDUsersUserIDNoContent() *DeleteSourcesIDUsersUserIDNoContent {
return &DeleteSourcesIDUsersUserIDNoContent{}
}
// WriteResponse to the client
func (o *DeleteSourcesIDUsersUserIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteSourcesIDUsersUserIDNotFound Unknown user id
swagger:response deleteSourcesIdUsersUserIdNotFound
*/
type DeleteSourcesIDUsersUserIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDUsersUserIDNotFound creates DeleteSourcesIDUsersUserIDNotFound with default headers values
func NewDeleteSourcesIDUsersUserIDNotFound() *DeleteSourcesIDUsersUserIDNotFound {
return &DeleteSourcesIDUsersUserIDNotFound{}
}
// WithPayload adds the payload to the delete sources Id users user Id not found response
func (o *DeleteSourcesIDUsersUserIDNotFound) WithPayload(payload *models.Error) *DeleteSourcesIDUsersUserIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources Id users user Id not found response
func (o *DeleteSourcesIDUsersUserIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDUsersUserIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*DeleteSourcesIDUsersUserIDDefault Unexpected internal service error
swagger:response deleteSourcesIdUsersUserIdDefault
*/
type DeleteSourcesIDUsersUserIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDUsersUserIDDefault creates DeleteSourcesIDUsersUserIDDefault with default headers values
func NewDeleteSourcesIDUsersUserIDDefault(code int) *DeleteSourcesIDUsersUserIDDefault {
if code <= 0 {
code = 500
}
return &DeleteSourcesIDUsersUserIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete sources ID users user ID default response
func (o *DeleteSourcesIDUsersUserIDDefault) WithStatusCode(code int) *DeleteSourcesIDUsersUserIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete sources ID users user ID default response
func (o *DeleteSourcesIDUsersUserIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete sources ID users user ID default response
func (o *DeleteSourcesIDUsersUserIDDefault) WithPayload(payload *models.Error) *DeleteSourcesIDUsersUserIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources ID users user ID default response
func (o *DeleteSourcesIDUsersUserIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDUsersUserIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

57
restapi/operations/get.go Normal file
View File

@ -0,0 +1,57 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetHandlerFunc turns a function with the right signature into a get handler
type GetHandlerFunc func(context.Context, GetParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetHandlerFunc) Handle(ctx context.Context, params GetParams) middleware.Responder {
return fn(ctx, params)
}
// GetHandler interface for that can handle valid get params
type GetHandler interface {
Handle(context.Context, GetParams) middleware.Responder
}
// NewGet creates a new http.Handler for the get operation
func NewGet(ctx *middleware.Context, handler GetHandler) *Get {
return &Get{Context: ctx, Handler: handler}
}
/*Get swagger:route GET / get
Lists all the endpoints
List of the endpoints.
*/
type Get struct {
Context *middleware.Context
Handler GetHandler
}
func (o *Get) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,58 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetDashboardsHandlerFunc turns a function with the right signature into a get dashboards handler
type GetDashboardsHandlerFunc func(context.Context, GetDashboardsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetDashboardsHandlerFunc) Handle(ctx context.Context, params GetDashboardsParams) middleware.Responder {
return fn(ctx, params)
}
// GetDashboardsHandler interface for that can handle valid get dashboards params
type GetDashboardsHandler interface {
Handle(context.Context, GetDashboardsParams) middleware.Responder
}
// NewGetDashboards creates a new http.Handler for the get dashboards operation
func NewGetDashboards(ctx *middleware.Context, handler GetDashboardsHandler) *GetDashboards {
return &GetDashboards{Context: ctx, Handler: handler}
}
/*GetDashboards swagger:route GET /dashboards getDashboards
Pre-configured dashboards
Dashboards are a collection of `Cells` that visualize time-series data.
*/
type GetDashboards struct {
Context *middleware.Context
Handler GetDashboardsHandler
}
func (o *GetDashboards) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetDashboardsParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,58 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetDashboardsIDHandlerFunc turns a function with the right signature into a get dashboards ID handler
type GetDashboardsIDHandlerFunc func(context.Context, GetDashboardsIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetDashboardsIDHandlerFunc) Handle(ctx context.Context, params GetDashboardsIDParams) middleware.Responder {
return fn(ctx, params)
}
// GetDashboardsIDHandler interface for that can handle valid get dashboards ID params
type GetDashboardsIDHandler interface {
Handle(context.Context, GetDashboardsIDParams) middleware.Responder
}
// NewGetDashboardsID creates a new http.Handler for the get dashboards ID operation
func NewGetDashboardsID(ctx *middleware.Context, handler GetDashboardsIDHandler) *GetDashboardsID {
return &GetDashboardsID{Context: ctx, Handler: handler}
}
/*GetDashboardsID swagger:route GET /dashboards/{id} getDashboardsId
Specific pre-configured dashboard containing cells and queries.
dashboards will hold information about how to layout the page of graphs.
*/
type GetDashboardsID struct {
Context *middleware.Context
Handler GetDashboardsIDHandler
}
func (o *GetDashboardsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetDashboardsIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,64 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetDashboardsIDParams creates a new GetDashboardsIDParams object
// with the default values initialized.
func NewGetDashboardsIDParams() GetDashboardsIDParams {
var ()
return GetDashboardsIDParams{}
}
// GetDashboardsIDParams contains all the bound params for the get dashboards ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetDashboardsID
type GetDashboardsIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the dashboard
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetDashboardsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetDashboardsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,141 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetDashboardsIDOK Returns the specified dashboard containing `cells`.
swagger:response getDashboardsIdOK
*/
type GetDashboardsIDOK struct {
// In: body
Payload *models.Dashboard `json:"body,omitempty"`
}
// NewGetDashboardsIDOK creates GetDashboardsIDOK with default headers values
func NewGetDashboardsIDOK() *GetDashboardsIDOK {
return &GetDashboardsIDOK{}
}
// WithPayload adds the payload to the get dashboards Id o k response
func (o *GetDashboardsIDOK) WithPayload(payload *models.Dashboard) *GetDashboardsIDOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get dashboards Id o k response
func (o *GetDashboardsIDOK) SetPayload(payload *models.Dashboard) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetDashboardsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetDashboardsIDNotFound Unknown dashboard id
swagger:response getDashboardsIdNotFound
*/
type GetDashboardsIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetDashboardsIDNotFound creates GetDashboardsIDNotFound with default headers values
func NewGetDashboardsIDNotFound() *GetDashboardsIDNotFound {
return &GetDashboardsIDNotFound{}
}
// WithPayload adds the payload to the get dashboards Id not found response
func (o *GetDashboardsIDNotFound) WithPayload(payload *models.Error) *GetDashboardsIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get dashboards Id not found response
func (o *GetDashboardsIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetDashboardsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetDashboardsIDDefault Unexpected internal service error
swagger:response getDashboardsIdDefault
*/
type GetDashboardsIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetDashboardsIDDefault creates GetDashboardsIDDefault with default headers values
func NewGetDashboardsIDDefault(code int) *GetDashboardsIDDefault {
if code <= 0 {
code = 500
}
return &GetDashboardsIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get dashboards ID default response
func (o *GetDashboardsIDDefault) WithStatusCode(code int) *GetDashboardsIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get dashboards ID default response
func (o *GetDashboardsIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get dashboards ID default response
func (o *GetDashboardsIDDefault) WithPayload(payload *models.Error) *GetDashboardsIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get dashboards ID default response
func (o *GetDashboardsIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetDashboardsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,40 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
)
// NewGetDashboardsParams creates a new GetDashboardsParams object
// with the default values initialized.
func NewGetDashboardsParams() GetDashboardsParams {
var ()
return GetDashboardsParams{}
}
// GetDashboardsParams contains all the bound params for the get dashboards operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetDashboards
type GetDashboardsParams struct {
// HTTP Request Object
HTTPRequest *http.Request
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetDashboardsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,104 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetDashboardsOK An array of dashboards
swagger:response getDashboardsOK
*/
type GetDashboardsOK struct {
// In: body
Payload *models.Dashboards `json:"body,omitempty"`
}
// NewGetDashboardsOK creates GetDashboardsOK with default headers values
func NewGetDashboardsOK() *GetDashboardsOK {
return &GetDashboardsOK{}
}
// WithPayload adds the payload to the get dashboards o k response
func (o *GetDashboardsOK) WithPayload(payload *models.Dashboards) *GetDashboardsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get dashboards o k response
func (o *GetDashboardsOK) SetPayload(payload *models.Dashboards) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetDashboardsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetDashboardsDefault Unexpected internal service error
swagger:response getDashboardsDefault
*/
type GetDashboardsDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetDashboardsDefault creates GetDashboardsDefault with default headers values
func NewGetDashboardsDefault(code int) *GetDashboardsDefault {
if code <= 0 {
code = 500
}
return &GetDashboardsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get dashboards default response
func (o *GetDashboardsDefault) WithStatusCode(code int) *GetDashboardsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get dashboards default response
func (o *GetDashboardsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get dashboards default response
func (o *GetDashboardsDefault) WithPayload(payload *models.Error) *GetDashboardsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get dashboards default response
func (o *GetDashboardsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetDashboardsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,40 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
)
// NewGetParams creates a new GetParams object
// with the default values initialized.
func NewGetParams() GetParams {
var ()
return GetParams{}
}
// GetParams contains all the bound params for the get operation
// typically these are obtained from a http.Request
//
// swagger:parameters Get
type GetParams struct {
// HTTP Request Object
HTTPRequest *http.Request
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,104 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetOK Returns the links to the top level endpoints.
swagger:response getOK
*/
type GetOK struct {
// In: body
Payload *models.Links `json:"body,omitempty"`
}
// NewGetOK creates GetOK with default headers values
func NewGetOK() *GetOK {
return &GetOK{}
}
// WithPayload adds the payload to the get o k response
func (o *GetOK) WithPayload(payload *models.Links) *GetOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get o k response
func (o *GetOK) SetPayload(payload *models.Links) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetDefault Unexpected internal service error
swagger:response getDefault
*/
type GetDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetDefault creates GetDefault with default headers values
func NewGetDefault(code int) *GetDefault {
if code <= 0 {
code = 500
}
return &GetDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get default response
func (o *GetDefault) WithStatusCode(code int) *GetDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get default response
func (o *GetDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get default response
func (o *GetDefault) WithPayload(payload *models.Error) *GetDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get default response
func (o *GetDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,57 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesHandlerFunc turns a function with the right signature into a get sources handler
type GetSourcesHandlerFunc func(context.Context, GetSourcesParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesHandlerFunc) Handle(ctx context.Context, params GetSourcesParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesHandler interface for that can handle valid get sources params
type GetSourcesHandler interface {
Handle(context.Context, GetSourcesParams) middleware.Responder
}
// NewGetSources creates a new http.Handler for the get sources operation
func NewGetSources(ctx *middleware.Context, handler GetSourcesHandler) *GetSources {
return &GetSources{Context: ctx, Handler: handler}
}
/*GetSources swagger:route GET /sources getSources
Configured data sources
These data sources store time series data.
*/
type GetSources struct {
Context *middleware.Context
Handler GetSourcesHandler
}
func (o *GetSources) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,57 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesIDHandlerFunc turns a function with the right signature into a get sources ID handler
type GetSourcesIDHandlerFunc func(context.Context, GetSourcesIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDHandlerFunc) Handle(ctx context.Context, params GetSourcesIDParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDHandler interface for that can handle valid get sources ID params
type GetSourcesIDHandler interface {
Handle(context.Context, GetSourcesIDParams) middleware.Responder
}
// NewGetSourcesID creates a new http.Handler for the get sources ID operation
func NewGetSourcesID(ctx *middleware.Context, handler GetSourcesIDHandler) *GetSourcesID {
return &GetSourcesID{Context: ctx, Handler: handler}
}
/*GetSourcesID swagger:route GET /sources/{id} getSourcesId
Configured data sources
These data sources store time series data.
*/
type GetSourcesID struct {
Context *middleware.Context
Handler GetSourcesIDHandler
}
func (o *GetSourcesID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,64 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDParams creates a new GetSourcesIDParams object
// with the default values initialized.
func NewGetSourcesIDParams() GetSourcesIDParams {
var ()
return GetSourcesIDParams{}
}
// GetSourcesIDParams contains all the bound params for the get sources ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesID
type GetSourcesIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesIDPermissionsHandlerFunc turns a function with the right signature into a get sources ID permissions handler
type GetSourcesIDPermissionsHandlerFunc func(context.Context, GetSourcesIDPermissionsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDPermissionsHandlerFunc) Handle(ctx context.Context, params GetSourcesIDPermissionsParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDPermissionsHandler interface for that can handle valid get sources ID permissions params
type GetSourcesIDPermissionsHandler interface {
Handle(context.Context, GetSourcesIDPermissionsParams) middleware.Responder
}
// NewGetSourcesIDPermissions creates a new http.Handler for the get sources ID permissions operation
func NewGetSourcesIDPermissions(ctx *middleware.Context, handler GetSourcesIDPermissionsHandler) *GetSourcesIDPermissions {
return &GetSourcesIDPermissions{Context: ctx, Handler: handler}
}
/*GetSourcesIDPermissions swagger:route GET /sources/{id}/permissions getSourcesIdPermissions
Returns the list of possible permissions supported by the backend time series data source.
*/
type GetSourcesIDPermissions struct {
Context *middleware.Context
Handler GetSourcesIDPermissionsHandler
}
func (o *GetSourcesIDPermissions) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDPermissionsParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,64 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDPermissionsParams creates a new GetSourcesIDPermissionsParams object
// with the default values initialized.
func NewGetSourcesIDPermissionsParams() GetSourcesIDPermissionsParams {
var ()
return GetSourcesIDPermissionsParams{}
}
// GetSourcesIDPermissionsParams contains all the bound params for the get sources ID permissions operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDPermissions
type GetSourcesIDPermissionsParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesIDPermissionsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDPermissionsParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,103 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesIDPermissionsOK An array of permissions
swagger:response getSourcesIdPermissionsOK
*/
type GetSourcesIDPermissionsOK struct {
// In: body
Payload models.AllPermissions `json:"body,omitempty"`
}
// NewGetSourcesIDPermissionsOK creates GetSourcesIDPermissionsOK with default headers values
func NewGetSourcesIDPermissionsOK() *GetSourcesIDPermissionsOK {
return &GetSourcesIDPermissionsOK{}
}
// WithPayload adds the payload to the get sources Id permissions o k response
func (o *GetSourcesIDPermissionsOK) WithPayload(payload models.AllPermissions) *GetSourcesIDPermissionsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id permissions o k response
func (o *GetSourcesIDPermissionsOK) SetPayload(payload models.AllPermissions) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDPermissionsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
/*GetSourcesIDPermissionsDefault Unexpected internal service error
swagger:response getSourcesIdPermissionsDefault
*/
type GetSourcesIDPermissionsDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDPermissionsDefault creates GetSourcesIDPermissionsDefault with default headers values
func NewGetSourcesIDPermissionsDefault(code int) *GetSourcesIDPermissionsDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDPermissionsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID permissions default response
func (o *GetSourcesIDPermissionsDefault) WithStatusCode(code int) *GetSourcesIDPermissionsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID permissions default response
func (o *GetSourcesIDPermissionsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID permissions default response
func (o *GetSourcesIDPermissionsDefault) WithPayload(payload *models.Error) *GetSourcesIDPermissionsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID permissions default response
func (o *GetSourcesIDPermissionsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDPermissionsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,141 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesIDOK Data source used to supply time series to dashboards.
swagger:response getSourcesIdOK
*/
type GetSourcesIDOK struct {
// In: body
Payload *models.Source `json:"body,omitempty"`
}
// NewGetSourcesIDOK creates GetSourcesIDOK with default headers values
func NewGetSourcesIDOK() *GetSourcesIDOK {
return &GetSourcesIDOK{}
}
// WithPayload adds the payload to the get sources Id o k response
func (o *GetSourcesIDOK) WithPayload(payload *models.Source) *GetSourcesIDOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id o k response
func (o *GetSourcesIDOK) SetPayload(payload *models.Source) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDNotFound Unknown source id
swagger:response getSourcesIdNotFound
*/
type GetSourcesIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDNotFound creates GetSourcesIDNotFound with default headers values
func NewGetSourcesIDNotFound() *GetSourcesIDNotFound {
return &GetSourcesIDNotFound{}
}
// WithPayload adds the payload to the get sources Id not found response
func (o *GetSourcesIDNotFound) WithPayload(payload *models.Error) *GetSourcesIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id not found response
func (o *GetSourcesIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDDefault Unexpected internal service error
swagger:response getSourcesIdDefault
*/
type GetSourcesIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDDefault creates GetSourcesIDDefault with default headers values
func NewGetSourcesIDDefault(code int) *GetSourcesIDDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID default response
func (o *GetSourcesIDDefault) WithStatusCode(code int) *GetSourcesIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID default response
func (o *GetSourcesIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID default response
func (o *GetSourcesIDDefault) WithPayload(payload *models.Error) *GetSourcesIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID default response
func (o *GetSourcesIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesIDRolesHandlerFunc turns a function with the right signature into a get sources ID roles handler
type GetSourcesIDRolesHandlerFunc func(context.Context, GetSourcesIDRolesParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDRolesHandlerFunc) Handle(ctx context.Context, params GetSourcesIDRolesParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDRolesHandler interface for that can handle valid get sources ID roles params
type GetSourcesIDRolesHandler interface {
Handle(context.Context, GetSourcesIDRolesParams) middleware.Responder
}
// NewGetSourcesIDRoles creates a new http.Handler for the get sources ID roles operation
func NewGetSourcesIDRoles(ctx *middleware.Context, handler GetSourcesIDRolesHandler) *GetSourcesIDRoles {
return &GetSourcesIDRoles{Context: ctx, Handler: handler}
}
/*GetSourcesIDRoles swagger:route GET /sources/{id}/roles getSourcesIdRoles
List of all roles on this data source
*/
type GetSourcesIDRoles struct {
Context *middleware.Context
Handler GetSourcesIDRolesHandler
}
func (o *GetSourcesIDRoles) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDRolesParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,64 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDRolesParams creates a new GetSourcesIDRolesParams object
// with the default values initialized.
func NewGetSourcesIDRolesParams() GetSourcesIDRolesParams {
var ()
return GetSourcesIDRolesParams{}
}
// GetSourcesIDRolesParams contains all the bound params for the get sources ID roles operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDRoles
type GetSourcesIDRolesParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesIDRolesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDRolesParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,104 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesIDRolesOK An array of roles
swagger:response getSourcesIdRolesOK
*/
type GetSourcesIDRolesOK struct {
// In: body
Payload *models.Roles `json:"body,omitempty"`
}
// NewGetSourcesIDRolesOK creates GetSourcesIDRolesOK with default headers values
func NewGetSourcesIDRolesOK() *GetSourcesIDRolesOK {
return &GetSourcesIDRolesOK{}
}
// WithPayload adds the payload to the get sources Id roles o k response
func (o *GetSourcesIDRolesOK) WithPayload(payload *models.Roles) *GetSourcesIDRolesOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id roles o k response
func (o *GetSourcesIDRolesOK) SetPayload(payload *models.Roles) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDRolesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDRolesDefault Unexpected internal service error
swagger:response getSourcesIdRolesDefault
*/
type GetSourcesIDRolesDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDRolesDefault creates GetSourcesIDRolesDefault with default headers values
func NewGetSourcesIDRolesDefault(code int) *GetSourcesIDRolesDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDRolesDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID roles default response
func (o *GetSourcesIDRolesDefault) WithStatusCode(code int) *GetSourcesIDRolesDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID roles default response
func (o *GetSourcesIDRolesDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID roles default response
func (o *GetSourcesIDRolesDefault) WithPayload(payload *models.Error) *GetSourcesIDRolesDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID roles default response
func (o *GetSourcesIDRolesDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDRolesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,58 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesIDRolesRoleIDHandlerFunc turns a function with the right signature into a get sources ID roles role ID handler
type GetSourcesIDRolesRoleIDHandlerFunc func(context.Context, GetSourcesIDRolesRoleIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDRolesRoleIDHandlerFunc) Handle(ctx context.Context, params GetSourcesIDRolesRoleIDParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDRolesRoleIDHandler interface for that can handle valid get sources ID roles role ID params
type GetSourcesIDRolesRoleIDHandler interface {
Handle(context.Context, GetSourcesIDRolesRoleIDParams) middleware.Responder
}
// NewGetSourcesIDRolesRoleID creates a new http.Handler for the get sources ID roles role ID operation
func NewGetSourcesIDRolesRoleID(ctx *middleware.Context, handler GetSourcesIDRolesRoleIDHandler) *GetSourcesIDRolesRoleID {
return &GetSourcesIDRolesRoleID{Context: ctx, Handler: handler}
}
/*GetSourcesIDRolesRoleID swagger:route GET /sources/{id}/roles/{role_id} getSourcesIdRolesRoleId
Returns information about a specific role
Specific Role and its associated permissions.
*/
type GetSourcesIDRolesRoleID struct {
Context *middleware.Context
Handler GetSourcesIDRolesRoleIDHandler
}
func (o *GetSourcesIDRolesRoleID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDRolesRoleIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,85 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDRolesRoleIDParams creates a new GetSourcesIDRolesRoleIDParams object
// with the default values initialized.
func NewGetSourcesIDRolesRoleIDParams() GetSourcesIDRolesRoleIDParams {
var ()
return GetSourcesIDRolesRoleIDParams{}
}
// GetSourcesIDRolesRoleIDParams contains all the bound params for the get sources ID roles role ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDRolesRoleID
type GetSourcesIDRolesRoleIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
/*ID of the specific role
Required: true
In: path
*/
RoleID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesIDRolesRoleIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rRoleID, rhkRoleID, _ := route.Params.GetOK("role_id")
if err := o.bindRoleID(rRoleID, rhkRoleID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDRolesRoleIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *GetSourcesIDRolesRoleIDParams) bindRoleID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.RoleID = raw
return nil
}

View File

@ -0,0 +1,141 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesIDRolesRoleIDOK Information relating to the role
swagger:response getSourcesIdRolesRoleIdOK
*/
type GetSourcesIDRolesRoleIDOK struct {
// In: body
Payload *models.Role `json:"body,omitempty"`
}
// NewGetSourcesIDRolesRoleIDOK creates GetSourcesIDRolesRoleIDOK with default headers values
func NewGetSourcesIDRolesRoleIDOK() *GetSourcesIDRolesRoleIDOK {
return &GetSourcesIDRolesRoleIDOK{}
}
// WithPayload adds the payload to the get sources Id roles role Id o k response
func (o *GetSourcesIDRolesRoleIDOK) WithPayload(payload *models.Role) *GetSourcesIDRolesRoleIDOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id roles role Id o k response
func (o *GetSourcesIDRolesRoleIDOK) SetPayload(payload *models.Role) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDRolesRoleIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDRolesRoleIDNotFound Unknown source id
swagger:response getSourcesIdRolesRoleIdNotFound
*/
type GetSourcesIDRolesRoleIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDRolesRoleIDNotFound creates GetSourcesIDRolesRoleIDNotFound with default headers values
func NewGetSourcesIDRolesRoleIDNotFound() *GetSourcesIDRolesRoleIDNotFound {
return &GetSourcesIDRolesRoleIDNotFound{}
}
// WithPayload adds the payload to the get sources Id roles role Id not found response
func (o *GetSourcesIDRolesRoleIDNotFound) WithPayload(payload *models.Error) *GetSourcesIDRolesRoleIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id roles role Id not found response
func (o *GetSourcesIDRolesRoleIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDRolesRoleIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDRolesRoleIDDefault Unexpected internal service error
swagger:response getSourcesIdRolesRoleIdDefault
*/
type GetSourcesIDRolesRoleIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDRolesRoleIDDefault creates GetSourcesIDRolesRoleIDDefault with default headers values
func NewGetSourcesIDRolesRoleIDDefault(code int) *GetSourcesIDRolesRoleIDDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDRolesRoleIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID roles role ID default response
func (o *GetSourcesIDRolesRoleIDDefault) WithStatusCode(code int) *GetSourcesIDRolesRoleIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID roles role ID default response
func (o *GetSourcesIDRolesRoleIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID roles role ID default response
func (o *GetSourcesIDRolesRoleIDDefault) WithPayload(payload *models.Error) *GetSourcesIDRolesRoleIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID roles role ID default response
func (o *GetSourcesIDRolesRoleIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDRolesRoleIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,58 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc turns a function with the right signature into a get sources ID user user ID explorations exploration ID handler
type GetSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc func(context.Context, GetSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc) Handle(ctx context.Context, params GetSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDUserUserIDExplorationsExplorationIDHandler interface for that can handle valid get sources ID user user ID explorations exploration ID params
type GetSourcesIDUserUserIDExplorationsExplorationIDHandler interface {
Handle(context.Context, GetSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder
}
// NewGetSourcesIDUserUserIDExplorationsExplorationID creates a new http.Handler for the get sources ID user user ID explorations exploration ID operation
func NewGetSourcesIDUserUserIDExplorationsExplorationID(ctx *middleware.Context, handler GetSourcesIDUserUserIDExplorationsExplorationIDHandler) *GetSourcesIDUserUserIDExplorationsExplorationID {
return &GetSourcesIDUserUserIDExplorationsExplorationID{Context: ctx, Handler: handler}
}
/*GetSourcesIDUserUserIDExplorationsExplorationID swagger:route GET /sources/{id}/user/{user_id}/explorations/{exploration_id} getSourcesIdUserUserIdExplorationsExplorationId
Returns the specified data exploration session
A data exploration session specifies query information.
*/
type GetSourcesIDUserUserIDExplorationsExplorationID struct {
Context *middleware.Context
Handler GetSourcesIDUserUserIDExplorationsExplorationIDHandler
}
func (o *GetSourcesIDUserUserIDExplorationsExplorationID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDUserUserIDExplorationsExplorationIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,106 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDUserUserIDExplorationsExplorationIDParams creates a new GetSourcesIDUserUserIDExplorationsExplorationIDParams object
// with the default values initialized.
func NewGetSourcesIDUserUserIDExplorationsExplorationIDParams() GetSourcesIDUserUserIDExplorationsExplorationIDParams {
var ()
return GetSourcesIDUserUserIDExplorationsExplorationIDParams{}
}
// GetSourcesIDUserUserIDExplorationsExplorationIDParams contains all the bound params for the get sources ID user user ID explorations exploration ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDUserUserIDExplorationsExplorationID
type GetSourcesIDUserUserIDExplorationsExplorationIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the specific exploration.
Required: true
In: path
*/
ExplorationID string
/*ID of the data source
Required: true
In: path
*/
ID string
/*ID of user to associate this exploration with.
Required: true
In: path
*/
UserID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rExplorationID, rhkExplorationID, _ := route.Params.GetOK("exploration_id")
if err := o.bindExplorationID(rExplorationID, rhkExplorationID, route.Formats); err != nil {
res = append(res, err)
}
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rUserID, rhkUserID, _ := route.Params.GetOK("user_id")
if err := o.bindUserID(rUserID, rhkUserID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDParams) bindExplorationID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ExplorationID = raw
return nil
}
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDParams) bindUserID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.UserID = raw
return nil
}

View File

@ -0,0 +1,141 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesIDUserUserIDExplorationsExplorationIDOK Information relating to the exploration
swagger:response getSourcesIdUserUserIdExplorationsExplorationIdOK
*/
type GetSourcesIDUserUserIDExplorationsExplorationIDOK struct {
// In: body
Payload *models.Exploration `json:"body,omitempty"`
}
// NewGetSourcesIDUserUserIDExplorationsExplorationIDOK creates GetSourcesIDUserUserIDExplorationsExplorationIDOK with default headers values
func NewGetSourcesIDUserUserIDExplorationsExplorationIDOK() *GetSourcesIDUserUserIDExplorationsExplorationIDOK {
return &GetSourcesIDUserUserIDExplorationsExplorationIDOK{}
}
// WithPayload adds the payload to the get sources Id user user Id explorations exploration Id o k response
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDOK) WithPayload(payload *models.Exploration) *GetSourcesIDUserUserIDExplorationsExplorationIDOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id user user Id explorations exploration Id o k response
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDOK) SetPayload(payload *models.Exploration) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDUserUserIDExplorationsExplorationIDNotFound Data source id, user, or exploration does not exist.
swagger:response getSourcesIdUserUserIdExplorationsExplorationIdNotFound
*/
type GetSourcesIDUserUserIDExplorationsExplorationIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUserUserIDExplorationsExplorationIDNotFound creates GetSourcesIDUserUserIDExplorationsExplorationIDNotFound with default headers values
func NewGetSourcesIDUserUserIDExplorationsExplorationIDNotFound() *GetSourcesIDUserUserIDExplorationsExplorationIDNotFound {
return &GetSourcesIDUserUserIDExplorationsExplorationIDNotFound{}
}
// WithPayload adds the payload to the get sources Id user user Id explorations exploration Id not found response
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDNotFound) WithPayload(payload *models.Error) *GetSourcesIDUserUserIDExplorationsExplorationIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id user user Id explorations exploration Id not found response
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDUserUserIDExplorationsExplorationIDDefault Unexpected internal service error
swagger:response getSourcesIdUserUserIdExplorationsExplorationIdDefault
*/
type GetSourcesIDUserUserIDExplorationsExplorationIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUserUserIDExplorationsExplorationIDDefault creates GetSourcesIDUserUserIDExplorationsExplorationIDDefault with default headers values
func NewGetSourcesIDUserUserIDExplorationsExplorationIDDefault(code int) *GetSourcesIDUserUserIDExplorationsExplorationIDDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDUserUserIDExplorationsExplorationIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID user user ID explorations exploration ID default response
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDDefault) WithStatusCode(code int) *GetSourcesIDUserUserIDExplorationsExplorationIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID user user ID explorations exploration ID default response
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID user user ID explorations exploration ID default response
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDDefault) WithPayload(payload *models.Error) *GetSourcesIDUserUserIDExplorationsExplorationIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID user user ID explorations exploration ID default response
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUserUserIDExplorationsExplorationIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesIDUsersHandlerFunc turns a function with the right signature into a get sources ID users handler
type GetSourcesIDUsersHandlerFunc func(context.Context, GetSourcesIDUsersParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDUsersHandlerFunc) Handle(ctx context.Context, params GetSourcesIDUsersParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDUsersHandler interface for that can handle valid get sources ID users params
type GetSourcesIDUsersHandler interface {
Handle(context.Context, GetSourcesIDUsersParams) middleware.Responder
}
// NewGetSourcesIDUsers creates a new http.Handler for the get sources ID users operation
func NewGetSourcesIDUsers(ctx *middleware.Context, handler GetSourcesIDUsersHandler) *GetSourcesIDUsers {
return &GetSourcesIDUsers{Context: ctx, Handler: handler}
}
/*GetSourcesIDUsers swagger:route GET /sources/{id}/users getSourcesIdUsers
List of all users on this data source
*/
type GetSourcesIDUsers struct {
Context *middleware.Context
Handler GetSourcesIDUsersHandler
}
func (o *GetSourcesIDUsers) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDUsersParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,64 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDUsersParams creates a new GetSourcesIDUsersParams object
// with the default values initialized.
func NewGetSourcesIDUsersParams() GetSourcesIDUsersParams {
var ()
return GetSourcesIDUsersParams{}
}
// GetSourcesIDUsersParams contains all the bound params for the get sources ID users operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDUsers
type GetSourcesIDUsersParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesIDUsersParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDUsersParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,104 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesIDUsersOK An array of users
swagger:response getSourcesIdUsersOK
*/
type GetSourcesIDUsersOK struct {
// In: body
Payload *models.Users `json:"body,omitempty"`
}
// NewGetSourcesIDUsersOK creates GetSourcesIDUsersOK with default headers values
func NewGetSourcesIDUsersOK() *GetSourcesIDUsersOK {
return &GetSourcesIDUsersOK{}
}
// WithPayload adds the payload to the get sources Id users o k response
func (o *GetSourcesIDUsersOK) WithPayload(payload *models.Users) *GetSourcesIDUsersOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id users o k response
func (o *GetSourcesIDUsersOK) SetPayload(payload *models.Users) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDUsersDefault Unexpected internal service error
swagger:response getSourcesIdUsersDefault
*/
type GetSourcesIDUsersDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUsersDefault creates GetSourcesIDUsersDefault with default headers values
func NewGetSourcesIDUsersDefault(code int) *GetSourcesIDUsersDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDUsersDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID users default response
func (o *GetSourcesIDUsersDefault) WithStatusCode(code int) *GetSourcesIDUsersDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID users default response
func (o *GetSourcesIDUsersDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID users default response
func (o *GetSourcesIDUsersDefault) WithPayload(payload *models.Error) *GetSourcesIDUsersDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID users default response
func (o *GetSourcesIDUsersDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,58 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesIDUsersUserIDHandlerFunc turns a function with the right signature into a get sources ID users user ID handler
type GetSourcesIDUsersUserIDHandlerFunc func(context.Context, GetSourcesIDUsersUserIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDUsersUserIDHandlerFunc) Handle(ctx context.Context, params GetSourcesIDUsersUserIDParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDUsersUserIDHandler interface for that can handle valid get sources ID users user ID params
type GetSourcesIDUsersUserIDHandler interface {
Handle(context.Context, GetSourcesIDUsersUserIDParams) middleware.Responder
}
// NewGetSourcesIDUsersUserID creates a new http.Handler for the get sources ID users user ID operation
func NewGetSourcesIDUsersUserID(ctx *middleware.Context, handler GetSourcesIDUsersUserIDHandler) *GetSourcesIDUsersUserID {
return &GetSourcesIDUsersUserID{Context: ctx, Handler: handler}
}
/*GetSourcesIDUsersUserID swagger:route GET /sources/{id}/users/{user_id} getSourcesIdUsersUserId
Returns information about a specific user
Specific User and their permissions.
*/
type GetSourcesIDUsersUserID struct {
Context *middleware.Context
Handler GetSourcesIDUsersUserIDHandler
}
func (o *GetSourcesIDUsersUserID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDUsersUserIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// GetSourcesIDUsersUserIDExplorationsHandlerFunc turns a function with the right signature into a get sources ID users user ID explorations handler
type GetSourcesIDUsersUserIDExplorationsHandlerFunc func(context.Context, GetSourcesIDUsersUserIDExplorationsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDUsersUserIDExplorationsHandlerFunc) Handle(ctx context.Context, params GetSourcesIDUsersUserIDExplorationsParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDUsersUserIDExplorationsHandler interface for that can handle valid get sources ID users user ID explorations params
type GetSourcesIDUsersUserIDExplorationsHandler interface {
Handle(context.Context, GetSourcesIDUsersUserIDExplorationsParams) middleware.Responder
}
// NewGetSourcesIDUsersUserIDExplorations creates a new http.Handler for the get sources ID users user ID explorations operation
func NewGetSourcesIDUsersUserIDExplorations(ctx *middleware.Context, handler GetSourcesIDUsersUserIDExplorationsHandler) *GetSourcesIDUsersUserIDExplorations {
return &GetSourcesIDUsersUserIDExplorations{Context: ctx, Handler: handler}
}
/*GetSourcesIDUsersUserIDExplorations swagger:route GET /sources/{id}/users/{user_id}/explorations getSourcesIdUsersUserIdExplorations
GetSourcesIDUsersUserIDExplorations get sources ID users user ID explorations API
*/
type GetSourcesIDUsersUserIDExplorations struct {
Context *middleware.Context
Handler GetSourcesIDUsersUserIDExplorationsHandler
}
func (o *GetSourcesIDUsersUserIDExplorations) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDUsersUserIDExplorationsParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,85 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDUsersUserIDExplorationsParams creates a new GetSourcesIDUsersUserIDExplorationsParams object
// with the default values initialized.
func NewGetSourcesIDUsersUserIDExplorationsParams() GetSourcesIDUsersUserIDExplorationsParams {
var ()
return GetSourcesIDUsersUserIDExplorationsParams{}
}
// GetSourcesIDUsersUserIDExplorationsParams contains all the bound params for the get sources ID users user ID explorations operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDUsersUserIDExplorations
type GetSourcesIDUsersUserIDExplorationsParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
/*All Data Explorations returned only for this user.
Required: true
In: path
*/
UserID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesIDUsersUserIDExplorationsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rUserID, rhkUserID, _ := route.Params.GetOK("user_id")
if err := o.bindUserID(rUserID, rhkUserID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDUsersUserIDExplorationsParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *GetSourcesIDUsersUserIDExplorationsParams) bindUserID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.UserID = raw
return nil
}

View File

@ -0,0 +1,141 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesIDUsersUserIDExplorationsOK Data Explorations saved sessions for user are returned.
swagger:response getSourcesIdUsersUserIdExplorationsOK
*/
type GetSourcesIDUsersUserIDExplorationsOK struct {
// In: body
Payload *models.Explorations `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDExplorationsOK creates GetSourcesIDUsersUserIDExplorationsOK with default headers values
func NewGetSourcesIDUsersUserIDExplorationsOK() *GetSourcesIDUsersUserIDExplorationsOK {
return &GetSourcesIDUsersUserIDExplorationsOK{}
}
// WithPayload adds the payload to the get sources Id users user Id explorations o k response
func (o *GetSourcesIDUsersUserIDExplorationsOK) WithPayload(payload *models.Explorations) *GetSourcesIDUsersUserIDExplorationsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id users user Id explorations o k response
func (o *GetSourcesIDUsersUserIDExplorationsOK) SetPayload(payload *models.Explorations) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDExplorationsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDUsersUserIDExplorationsNotFound Data source id or user does not exist.
swagger:response getSourcesIdUsersUserIdExplorationsNotFound
*/
type GetSourcesIDUsersUserIDExplorationsNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDExplorationsNotFound creates GetSourcesIDUsersUserIDExplorationsNotFound with default headers values
func NewGetSourcesIDUsersUserIDExplorationsNotFound() *GetSourcesIDUsersUserIDExplorationsNotFound {
return &GetSourcesIDUsersUserIDExplorationsNotFound{}
}
// WithPayload adds the payload to the get sources Id users user Id explorations not found response
func (o *GetSourcesIDUsersUserIDExplorationsNotFound) WithPayload(payload *models.Error) *GetSourcesIDUsersUserIDExplorationsNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id users user Id explorations not found response
func (o *GetSourcesIDUsersUserIDExplorationsNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDExplorationsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDUsersUserIDExplorationsDefault Unexpected internal service error
swagger:response getSourcesIdUsersUserIdExplorationsDefault
*/
type GetSourcesIDUsersUserIDExplorationsDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDExplorationsDefault creates GetSourcesIDUsersUserIDExplorationsDefault with default headers values
func NewGetSourcesIDUsersUserIDExplorationsDefault(code int) *GetSourcesIDUsersUserIDExplorationsDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDUsersUserIDExplorationsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID users user ID explorations default response
func (o *GetSourcesIDUsersUserIDExplorationsDefault) WithStatusCode(code int) *GetSourcesIDUsersUserIDExplorationsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID users user ID explorations default response
func (o *GetSourcesIDUsersUserIDExplorationsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID users user ID explorations default response
func (o *GetSourcesIDUsersUserIDExplorationsDefault) WithPayload(payload *models.Error) *GetSourcesIDUsersUserIDExplorationsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID users user ID explorations default response
func (o *GetSourcesIDUsersUserIDExplorationsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDExplorationsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,85 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDUsersUserIDParams creates a new GetSourcesIDUsersUserIDParams object
// with the default values initialized.
func NewGetSourcesIDUsersUserIDParams() GetSourcesIDUsersUserIDParams {
var ()
return GetSourcesIDUsersUserIDParams{}
}
// GetSourcesIDUsersUserIDParams contains all the bound params for the get sources ID users user ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDUsersUserID
type GetSourcesIDUsersUserIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
/*ID of the specific user
Required: true
In: path
*/
UserID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesIDUsersUserIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rUserID, rhkUserID, _ := route.Params.GetOK("user_id")
if err := o.bindUserID(rUserID, rhkUserID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDUsersUserIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *GetSourcesIDUsersUserIDParams) bindUserID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.UserID = raw
return nil
}

View File

@ -0,0 +1,141 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesIDUsersUserIDOK Information relating to the user
swagger:response getSourcesIdUsersUserIdOK
*/
type GetSourcesIDUsersUserIDOK struct {
// In: body
Payload *models.User `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDOK creates GetSourcesIDUsersUserIDOK with default headers values
func NewGetSourcesIDUsersUserIDOK() *GetSourcesIDUsersUserIDOK {
return &GetSourcesIDUsersUserIDOK{}
}
// WithPayload adds the payload to the get sources Id users user Id o k response
func (o *GetSourcesIDUsersUserIDOK) WithPayload(payload *models.User) *GetSourcesIDUsersUserIDOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id users user Id o k response
func (o *GetSourcesIDUsersUserIDOK) SetPayload(payload *models.User) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDUsersUserIDNotFound Unknown source id
swagger:response getSourcesIdUsersUserIdNotFound
*/
type GetSourcesIDUsersUserIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDNotFound creates GetSourcesIDUsersUserIDNotFound with default headers values
func NewGetSourcesIDUsersUserIDNotFound() *GetSourcesIDUsersUserIDNotFound {
return &GetSourcesIDUsersUserIDNotFound{}
}
// WithPayload adds the payload to the get sources Id users user Id not found response
func (o *GetSourcesIDUsersUserIDNotFound) WithPayload(payload *models.Error) *GetSourcesIDUsersUserIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id users user Id not found response
func (o *GetSourcesIDUsersUserIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesIDUsersUserIDDefault Unexpected internal service error
swagger:response getSourcesIdUsersUserIdDefault
*/
type GetSourcesIDUsersUserIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDDefault creates GetSourcesIDUsersUserIDDefault with default headers values
func NewGetSourcesIDUsersUserIDDefault(code int) *GetSourcesIDUsersUserIDDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDUsersUserIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID users user ID default response
func (o *GetSourcesIDUsersUserIDDefault) WithStatusCode(code int) *GetSourcesIDUsersUserIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID users user ID default response
func (o *GetSourcesIDUsersUserIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID users user ID default response
func (o *GetSourcesIDUsersUserIDDefault) WithPayload(payload *models.Error) *GetSourcesIDUsersUserIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID users user ID default response
func (o *GetSourcesIDUsersUserIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,40 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
)
// NewGetSourcesParams creates a new GetSourcesParams object
// with the default values initialized.
func NewGetSourcesParams() GetSourcesParams {
var ()
return GetSourcesParams{}
}
// GetSourcesParams contains all the bound params for the get sources operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSources
type GetSourcesParams struct {
// HTTP Request Object
HTTPRequest *http.Request
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetSourcesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,104 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*GetSourcesOK An array of data sources
swagger:response getSourcesOK
*/
type GetSourcesOK struct {
// In: body
Payload *models.Sources `json:"body,omitempty"`
}
// NewGetSourcesOK creates GetSourcesOK with default headers values
func NewGetSourcesOK() *GetSourcesOK {
return &GetSourcesOK{}
}
// WithPayload adds the payload to the get sources o k response
func (o *GetSourcesOK) WithPayload(payload *models.Sources) *GetSourcesOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources o k response
func (o *GetSourcesOK) SetPayload(payload *models.Sources) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*GetSourcesDefault Unexpected internal service error
swagger:response getSourcesDefault
*/
type GetSourcesDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesDefault creates GetSourcesDefault with default headers values
func NewGetSourcesDefault(code int) *GetSourcesDefault {
if code <= 0 {
code = 500
}
return &GetSourcesDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources default response
func (o *GetSourcesDefault) WithStatusCode(code int) *GetSourcesDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources default response
func (o *GetSourcesDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources default response
func (o *GetSourcesDefault) WithPayload(payload *models.Error) *GetSourcesDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources default response
func (o *GetSourcesDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,499 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"net/http"
"strings"
loads "github.com/go-openapi/loads"
runtime "github.com/go-openapi/runtime"
middleware "github.com/go-openapi/runtime/middleware"
spec "github.com/go-openapi/spec"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewMrFusionAPI creates a new MrFusion instance
func NewMrFusionAPI(spec *loads.Document) *MrFusionAPI {
return &MrFusionAPI{
handlers: make(map[string]map[string]http.Handler),
formats: strfmt.Default,
defaultConsumes: "application/json",
defaultProduces: "application/json",
ServerShutdown: func() {},
spec: spec,
}
}
/*MrFusionAPI Fuel for Chronograf */
type MrFusionAPI struct {
spec *loads.Document
context *middleware.Context
handlers map[string]map[string]http.Handler
formats strfmt.Registry
defaultConsumes string
defaultProduces string
// JSONConsumer registers a consumer for a "application/json" mime type
JSONConsumer runtime.Consumer
// JSONProducer registers a producer for a "application/json" mime type
JSONProducer runtime.Producer
// DeleteDashboardsIDHandler sets the operation handler for the delete dashboards ID operation
DeleteDashboardsIDHandler DeleteDashboardsIDHandler
// DeleteSourcesIDHandler sets the operation handler for the delete sources ID operation
DeleteSourcesIDHandler DeleteSourcesIDHandler
// DeleteSourcesIDRolesRoleIDHandler sets the operation handler for the delete sources ID roles role ID operation
DeleteSourcesIDRolesRoleIDHandler DeleteSourcesIDRolesRoleIDHandler
// DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler sets the operation handler for the delete sources ID user user ID explorations exploration ID operation
DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler
// DeleteSourcesIDUsersUserIDHandler sets the operation handler for the delete sources ID users user ID operation
DeleteSourcesIDUsersUserIDHandler DeleteSourcesIDUsersUserIDHandler
// GetHandler sets the operation handler for the get operation
GetHandler GetHandler
// GetDashboardsHandler sets the operation handler for the get dashboards operation
GetDashboardsHandler GetDashboardsHandler
// GetDashboardsIDHandler sets the operation handler for the get dashboards ID operation
GetDashboardsIDHandler GetDashboardsIDHandler
// GetSourcesHandler sets the operation handler for the get sources operation
GetSourcesHandler GetSourcesHandler
// GetSourcesIDHandler sets the operation handler for the get sources ID operation
GetSourcesIDHandler GetSourcesIDHandler
// GetSourcesIDPermissionsHandler sets the operation handler for the get sources ID permissions operation
GetSourcesIDPermissionsHandler GetSourcesIDPermissionsHandler
// GetSourcesIDRolesHandler sets the operation handler for the get sources ID roles operation
GetSourcesIDRolesHandler GetSourcesIDRolesHandler
// GetSourcesIDRolesRoleIDHandler sets the operation handler for the get sources ID roles role ID operation
GetSourcesIDRolesRoleIDHandler GetSourcesIDRolesRoleIDHandler
// GetSourcesIDUserUserIDExplorationsExplorationIDHandler sets the operation handler for the get sources ID user user ID explorations exploration ID operation
GetSourcesIDUserUserIDExplorationsExplorationIDHandler GetSourcesIDUserUserIDExplorationsExplorationIDHandler
// GetSourcesIDUsersHandler sets the operation handler for the get sources ID users operation
GetSourcesIDUsersHandler GetSourcesIDUsersHandler
// GetSourcesIDUsersUserIDHandler sets the operation handler for the get sources ID users user ID operation
GetSourcesIDUsersUserIDHandler GetSourcesIDUsersUserIDHandler
// GetSourcesIDUsersUserIDExplorationsHandler sets the operation handler for the get sources ID users user ID explorations operation
GetSourcesIDUsersUserIDExplorationsHandler GetSourcesIDUsersUserIDExplorationsHandler
// PatchSourcesIDHandler sets the operation handler for the patch sources ID operation
PatchSourcesIDHandler PatchSourcesIDHandler
// PatchSourcesIDRolesRoleIDHandler sets the operation handler for the patch sources ID roles role ID operation
PatchSourcesIDRolesRoleIDHandler PatchSourcesIDRolesRoleIDHandler
// PatchSourcesIDUserUserIDExplorationsExplorationIDHandler sets the operation handler for the patch sources ID user user ID explorations exploration ID operation
PatchSourcesIDUserUserIDExplorationsExplorationIDHandler PatchSourcesIDUserUserIDExplorationsExplorationIDHandler
// PatchSourcesIDUsersUserIDHandler sets the operation handler for the patch sources ID users user ID operation
PatchSourcesIDUsersUserIDHandler PatchSourcesIDUsersUserIDHandler
// PostDashboardsHandler sets the operation handler for the post dashboards operation
PostDashboardsHandler PostDashboardsHandler
// PostSourcesHandler sets the operation handler for the post sources operation
PostSourcesHandler PostSourcesHandler
// PostSourcesIDProxyHandler sets the operation handler for the post sources ID proxy operation
PostSourcesIDProxyHandler PostSourcesIDProxyHandler
// PostSourcesIDRolesHandler sets the operation handler for the post sources ID roles operation
PostSourcesIDRolesHandler PostSourcesIDRolesHandler
// PostSourcesIDUsersHandler sets the operation handler for the post sources ID users operation
PostSourcesIDUsersHandler PostSourcesIDUsersHandler
// PostSourcesIDUsersUserIDExplorationsHandler sets the operation handler for the post sources ID users user ID explorations operation
PostSourcesIDUsersUserIDExplorationsHandler PostSourcesIDUsersUserIDExplorationsHandler
// PutDashboardsIDHandler sets the operation handler for the put dashboards ID operation
PutDashboardsIDHandler PutDashboardsIDHandler
// ServeError is called when an error is received, there is a default handler
// but you can set your own with this
ServeError func(http.ResponseWriter, *http.Request, error)
// ServerShutdown is called when the HTTP(S) server is shut down and done
// handling all active connections and does not accept connections any more
ServerShutdown func()
// Custom command line argument groups with their descriptions
CommandLineOptionsGroups []swag.CommandLineOptionsGroup
// User defined logger function.
Logger func(string, ...interface{})
}
// SetDefaultProduces sets the default produces media type
func (o *MrFusionAPI) SetDefaultProduces(mediaType string) {
o.defaultProduces = mediaType
}
// SetDefaultConsumes returns the default consumes media type
func (o *MrFusionAPI) SetDefaultConsumes(mediaType string) {
o.defaultConsumes = mediaType
}
// SetSpec sets a spec that will be served for the clients.
func (o *MrFusionAPI) SetSpec(spec *loads.Document) {
o.spec = spec
}
// DefaultProduces returns the default produces media type
func (o *MrFusionAPI) DefaultProduces() string {
return o.defaultProduces
}
// DefaultConsumes returns the default consumes media type
func (o *MrFusionAPI) DefaultConsumes() string {
return o.defaultConsumes
}
// Formats returns the registered string formats
func (o *MrFusionAPI) Formats() strfmt.Registry {
return o.formats
}
// RegisterFormat registers a custom format validator
func (o *MrFusionAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
o.formats.Add(name, format, validator)
}
// Validate validates the registrations in the MrFusionAPI
func (o *MrFusionAPI) Validate() error {
var unregistered []string
if o.JSONConsumer == nil {
unregistered = append(unregistered, "JSONConsumer")
}
if o.JSONProducer == nil {
unregistered = append(unregistered, "JSONProducer")
}
if o.DeleteDashboardsIDHandler == nil {
unregistered = append(unregistered, "DeleteDashboardsIDHandler")
}
if o.DeleteSourcesIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDHandler")
}
if o.DeleteSourcesIDRolesRoleIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDRolesRoleIDHandler")
}
if o.DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler")
}
if o.DeleteSourcesIDUsersUserIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDUsersUserIDHandler")
}
if o.GetHandler == nil {
unregistered = append(unregistered, "GetHandler")
}
if o.GetDashboardsHandler == nil {
unregistered = append(unregistered, "GetDashboardsHandler")
}
if o.GetDashboardsIDHandler == nil {
unregistered = append(unregistered, "GetDashboardsIDHandler")
}
if o.GetSourcesHandler == nil {
unregistered = append(unregistered, "GetSourcesHandler")
}
if o.GetSourcesIDHandler == nil {
unregistered = append(unregistered, "GetSourcesIDHandler")
}
if o.GetSourcesIDPermissionsHandler == nil {
unregistered = append(unregistered, "GetSourcesIDPermissionsHandler")
}
if o.GetSourcesIDRolesHandler == nil {
unregistered = append(unregistered, "GetSourcesIDRolesHandler")
}
if o.GetSourcesIDRolesRoleIDHandler == nil {
unregistered = append(unregistered, "GetSourcesIDRolesRoleIDHandler")
}
if o.GetSourcesIDUserUserIDExplorationsExplorationIDHandler == nil {
unregistered = append(unregistered, "GetSourcesIDUserUserIDExplorationsExplorationIDHandler")
}
if o.GetSourcesIDUsersHandler == nil {
unregistered = append(unregistered, "GetSourcesIDUsersHandler")
}
if o.GetSourcesIDUsersUserIDHandler == nil {
unregistered = append(unregistered, "GetSourcesIDUsersUserIDHandler")
}
if o.GetSourcesIDUsersUserIDExplorationsHandler == nil {
unregistered = append(unregistered, "GetSourcesIDUsersUserIDExplorationsHandler")
}
if o.PatchSourcesIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDHandler")
}
if o.PatchSourcesIDRolesRoleIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDRolesRoleIDHandler")
}
if o.PatchSourcesIDUserUserIDExplorationsExplorationIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDUserUserIDExplorationsExplorationIDHandler")
}
if o.PatchSourcesIDUsersUserIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDUsersUserIDHandler")
}
if o.PostDashboardsHandler == nil {
unregistered = append(unregistered, "PostDashboardsHandler")
}
if o.PostSourcesHandler == nil {
unregistered = append(unregistered, "PostSourcesHandler")
}
if o.PostSourcesIDProxyHandler == nil {
unregistered = append(unregistered, "PostSourcesIDProxyHandler")
}
if o.PostSourcesIDRolesHandler == nil {
unregistered = append(unregistered, "PostSourcesIDRolesHandler")
}
if o.PostSourcesIDUsersHandler == nil {
unregistered = append(unregistered, "PostSourcesIDUsersHandler")
}
if o.PostSourcesIDUsersUserIDExplorationsHandler == nil {
unregistered = append(unregistered, "PostSourcesIDUsersUserIDExplorationsHandler")
}
if o.PutDashboardsIDHandler == nil {
unregistered = append(unregistered, "PutDashboardsIDHandler")
}
if len(unregistered) > 0 {
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
}
return nil
}
// ServeErrorFor gets a error handler for a given operation id
func (o *MrFusionAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
return o.ServeError
}
// AuthenticatorsFor gets the authenticators for the specified security schemes
func (o *MrFusionAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
return nil
}
// ConsumersFor gets the consumers for the specified media types
func (o *MrFusionAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
result := make(map[string]runtime.Consumer)
for _, mt := range mediaTypes {
switch mt {
case "application/json":
result["application/json"] = o.JSONConsumer
}
}
return result
}
// ProducersFor gets the producers for the specified media types
func (o *MrFusionAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
result := make(map[string]runtime.Producer)
for _, mt := range mediaTypes {
switch mt {
case "application/json":
result["application/json"] = o.JSONProducer
}
}
return result
}
// HandlerFor gets a http.Handler for the provided operation method and path
func (o *MrFusionAPI) HandlerFor(method, path string) (http.Handler, bool) {
if o.handlers == nil {
return nil, false
}
um := strings.ToUpper(method)
if _, ok := o.handlers[um]; !ok {
return nil, false
}
h, ok := o.handlers[um][path]
return h, ok
}
func (o *MrFusionAPI) initHandlerCache() {
if o.context == nil {
o.context = middleware.NewRoutableContext(o.spec, o, nil)
}
if o.handlers == nil {
o.handlers = make(map[string]map[string]http.Handler)
}
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/dashboards/{id}"] = NewDeleteDashboardsID(o.context, o.DeleteDashboardsIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/sources/{id}"] = NewDeleteSourcesID(o.context, o.DeleteSourcesIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/sources/{id}/roles/{role_id}"] = NewDeleteSourcesIDRolesRoleID(o.context, o.DeleteSourcesIDRolesRoleIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/sources/{id}/user/{user_id}/explorations/{exploration_id}"] = NewDeleteSourcesIDUserUserIDExplorationsExplorationID(o.context, o.DeleteSourcesIDUserUserIDExplorationsExplorationIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/sources/{id}/users/{user_id}"] = NewDeleteSourcesIDUsersUserID(o.context, o.DeleteSourcesIDUsersUserIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/"] = NewGet(o.context, o.GetHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/dashboards"] = NewGetDashboards(o.context, o.GetDashboardsHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/dashboards/{id}"] = NewGetDashboardsID(o.context, o.GetDashboardsIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources"] = NewGetSources(o.context, o.GetSourcesHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}"] = NewGetSourcesID(o.context, o.GetSourcesIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/permissions"] = NewGetSourcesIDPermissions(o.context, o.GetSourcesIDPermissionsHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/roles"] = NewGetSourcesIDRoles(o.context, o.GetSourcesIDRolesHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/roles/{role_id}"] = NewGetSourcesIDRolesRoleID(o.context, o.GetSourcesIDRolesRoleIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/user/{user_id}/explorations/{exploration_id}"] = NewGetSourcesIDUserUserIDExplorationsExplorationID(o.context, o.GetSourcesIDUserUserIDExplorationsExplorationIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/users"] = NewGetSourcesIDUsers(o.context, o.GetSourcesIDUsersHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/users/{user_id}"] = NewGetSourcesIDUsersUserID(o.context, o.GetSourcesIDUsersUserIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/users/{user_id}/explorations"] = NewGetSourcesIDUsersUserIDExplorations(o.context, o.GetSourcesIDUsersUserIDExplorationsHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/sources/{id}"] = NewPatchSourcesID(o.context, o.PatchSourcesIDHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/sources/{id}/roles/{role_id}"] = NewPatchSourcesIDRolesRoleID(o.context, o.PatchSourcesIDRolesRoleIDHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/sources/{id}/user/{user_id}/explorations/{exploration_id}"] = NewPatchSourcesIDUserUserIDExplorationsExplorationID(o.context, o.PatchSourcesIDUserUserIDExplorationsExplorationIDHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/sources/{id}/users/{user_id}"] = NewPatchSourcesIDUsersUserID(o.context, o.PatchSourcesIDUsersUserIDHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/dashboards"] = NewPostDashboards(o.context, o.PostDashboardsHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/sources"] = NewPostSources(o.context, o.PostSourcesHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/sources/{id}/proxy"] = NewPostSourcesIDProxy(o.context, o.PostSourcesIDProxyHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/sources/{id}/roles"] = NewPostSourcesIDRoles(o.context, o.PostSourcesIDRolesHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/sources/{id}/users"] = NewPostSourcesIDUsers(o.context, o.PostSourcesIDUsersHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/sources/{id}/users/{user_id}/explorations"] = NewPostSourcesIDUsersUserIDExplorations(o.context, o.PostSourcesIDUsersUserIDExplorationsHandler)
if o.handlers["PUT"] == nil {
o.handlers[strings.ToUpper("PUT")] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/dashboards/{id}"] = NewPutDashboardsID(o.context, o.PutDashboardsIDHandler)
}
// Serve creates a http handler to serve the API over HTTP
// can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
func (o *MrFusionAPI) Serve(builder middleware.Builder) http.Handler {
if len(o.handlers) == 0 {
o.initHandlerCache()
}
return o.context.APIHandler(builder)
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PatchSourcesIDHandlerFunc turns a function with the right signature into a patch sources ID handler
type PatchSourcesIDHandlerFunc func(context.Context, PatchSourcesIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchSourcesIDHandlerFunc) Handle(ctx context.Context, params PatchSourcesIDParams) middleware.Responder {
return fn(ctx, params)
}
// PatchSourcesIDHandler interface for that can handle valid patch sources ID params
type PatchSourcesIDHandler interface {
Handle(context.Context, PatchSourcesIDParams) middleware.Responder
}
// NewPatchSourcesID creates a new http.Handler for the patch sources ID operation
func NewPatchSourcesID(ctx *middleware.Context, handler PatchSourcesIDHandler) *PatchSourcesID {
return &PatchSourcesID{Context: ctx, Handler: handler}
}
/*PatchSourcesID swagger:route PATCH /sources/{id} patchSourcesId
Update data source configuration
*/
type PatchSourcesID struct {
Context *middleware.Context
Handler PatchSourcesIDHandler
}
func (o *PatchSourcesID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchSourcesIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,97 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
"github.com/influxdata/mrfusion/models"
)
// NewPatchSourcesIDParams creates a new PatchSourcesIDParams object
// with the default values initialized.
func NewPatchSourcesIDParams() PatchSourcesIDParams {
var ()
return PatchSourcesIDParams{}
}
// PatchSourcesIDParams contains all the bound params for the patch sources ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters PatchSourcesID
type PatchSourcesIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*data source configuration
Required: true
In: body
*/
Config *models.Source
/*ID of a data source
Required: true
In: path
*/
ID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *PatchSourcesIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.Source
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("config", "body"))
} else {
res = append(res, errors.NewParseError("config", "body", "", err))
}
} else {
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Config = &body
}
}
} else {
res = append(res, errors.Required("config", "body"))
}
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PatchSourcesIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*PatchSourcesIDNoContent Data source's configuration was changed
swagger:response patchSourcesIdNoContent
*/
type PatchSourcesIDNoContent struct {
}
// NewPatchSourcesIDNoContent creates PatchSourcesIDNoContent with default headers values
func NewPatchSourcesIDNoContent() *PatchSourcesIDNoContent {
return &PatchSourcesIDNoContent{}
}
// WriteResponse to the client
func (o *PatchSourcesIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*PatchSourcesIDNotFound Happens when trying to access a non-existent data source.
swagger:response patchSourcesIdNotFound
*/
type PatchSourcesIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDNotFound creates PatchSourcesIDNotFound with default headers values
func NewPatchSourcesIDNotFound() *PatchSourcesIDNotFound {
return &PatchSourcesIDNotFound{}
}
// WithPayload adds the payload to the patch sources Id not found response
func (o *PatchSourcesIDNotFound) WithPayload(payload *models.Error) *PatchSourcesIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources Id not found response
func (o *PatchSourcesIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PatchSourcesIDDefault A processing or an unexpected error.
swagger:response patchSourcesIdDefault
*/
type PatchSourcesIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDDefault creates PatchSourcesIDDefault with default headers values
func NewPatchSourcesIDDefault(code int) *PatchSourcesIDDefault {
if code <= 0 {
code = 500
}
return &PatchSourcesIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch sources ID default response
func (o *PatchSourcesIDDefault) WithStatusCode(code int) *PatchSourcesIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch sources ID default response
func (o *PatchSourcesIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch sources ID default response
func (o *PatchSourcesIDDefault) WithPayload(payload *models.Error) *PatchSourcesIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources ID default response
func (o *PatchSourcesIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PatchSourcesIDRolesRoleIDHandlerFunc turns a function with the right signature into a patch sources ID roles role ID handler
type PatchSourcesIDRolesRoleIDHandlerFunc func(context.Context, PatchSourcesIDRolesRoleIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchSourcesIDRolesRoleIDHandlerFunc) Handle(ctx context.Context, params PatchSourcesIDRolesRoleIDParams) middleware.Responder {
return fn(ctx, params)
}
// PatchSourcesIDRolesRoleIDHandler interface for that can handle valid patch sources ID roles role ID params
type PatchSourcesIDRolesRoleIDHandler interface {
Handle(context.Context, PatchSourcesIDRolesRoleIDParams) middleware.Responder
}
// NewPatchSourcesIDRolesRoleID creates a new http.Handler for the patch sources ID roles role ID operation
func NewPatchSourcesIDRolesRoleID(ctx *middleware.Context, handler PatchSourcesIDRolesRoleIDHandler) *PatchSourcesIDRolesRoleID {
return &PatchSourcesIDRolesRoleID{Context: ctx, Handler: handler}
}
/*PatchSourcesIDRolesRoleID swagger:route PATCH /sources/{id}/roles/{role_id} patchSourcesIdRolesRoleId
Update role configuration
*/
type PatchSourcesIDRolesRoleID struct {
Context *middleware.Context
Handler PatchSourcesIDRolesRoleIDHandler
}
func (o *PatchSourcesIDRolesRoleID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchSourcesIDRolesRoleIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,118 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
"github.com/influxdata/mrfusion/models"
)
// NewPatchSourcesIDRolesRoleIDParams creates a new PatchSourcesIDRolesRoleIDParams object
// with the default values initialized.
func NewPatchSourcesIDRolesRoleIDParams() PatchSourcesIDRolesRoleIDParams {
var ()
return PatchSourcesIDRolesRoleIDParams{}
}
// PatchSourcesIDRolesRoleIDParams contains all the bound params for the patch sources ID roles role ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters PatchSourcesIDRolesRoleID
type PatchSourcesIDRolesRoleIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*role configuration
Required: true
In: body
*/
Config *models.Role
/*ID of a data source
Required: true
In: path
*/
ID string
/*ID of the specific role
Required: true
In: path
*/
RoleID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *PatchSourcesIDRolesRoleIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.Role
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("config", "body"))
} else {
res = append(res, errors.NewParseError("config", "body", "", err))
}
} else {
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Config = &body
}
}
} else {
res = append(res, errors.Required("config", "body"))
}
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rRoleID, rhkRoleID, _ := route.Params.GetOK("role_id")
if err := o.bindRoleID(rRoleID, rhkRoleID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PatchSourcesIDRolesRoleIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *PatchSourcesIDRolesRoleIDParams) bindRoleID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.RoleID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*PatchSourcesIDRolesRoleIDNoContent Role's configuration was changed
swagger:response patchSourcesIdRolesRoleIdNoContent
*/
type PatchSourcesIDRolesRoleIDNoContent struct {
}
// NewPatchSourcesIDRolesRoleIDNoContent creates PatchSourcesIDRolesRoleIDNoContent with default headers values
func NewPatchSourcesIDRolesRoleIDNoContent() *PatchSourcesIDRolesRoleIDNoContent {
return &PatchSourcesIDRolesRoleIDNoContent{}
}
// WriteResponse to the client
func (o *PatchSourcesIDRolesRoleIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*PatchSourcesIDRolesRoleIDNotFound Happens when trying to access a non-existent role.
swagger:response patchSourcesIdRolesRoleIdNotFound
*/
type PatchSourcesIDRolesRoleIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDRolesRoleIDNotFound creates PatchSourcesIDRolesRoleIDNotFound with default headers values
func NewPatchSourcesIDRolesRoleIDNotFound() *PatchSourcesIDRolesRoleIDNotFound {
return &PatchSourcesIDRolesRoleIDNotFound{}
}
// WithPayload adds the payload to the patch sources Id roles role Id not found response
func (o *PatchSourcesIDRolesRoleIDNotFound) WithPayload(payload *models.Error) *PatchSourcesIDRolesRoleIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources Id roles role Id not found response
func (o *PatchSourcesIDRolesRoleIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDRolesRoleIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PatchSourcesIDRolesRoleIDDefault A processing or an unexpected error.
swagger:response patchSourcesIdRolesRoleIdDefault
*/
type PatchSourcesIDRolesRoleIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDRolesRoleIDDefault creates PatchSourcesIDRolesRoleIDDefault with default headers values
func NewPatchSourcesIDRolesRoleIDDefault(code int) *PatchSourcesIDRolesRoleIDDefault {
if code <= 0 {
code = 500
}
return &PatchSourcesIDRolesRoleIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch sources ID roles role ID default response
func (o *PatchSourcesIDRolesRoleIDDefault) WithStatusCode(code int) *PatchSourcesIDRolesRoleIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch sources ID roles role ID default response
func (o *PatchSourcesIDRolesRoleIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch sources ID roles role ID default response
func (o *PatchSourcesIDRolesRoleIDDefault) WithPayload(payload *models.Error) *PatchSourcesIDRolesRoleIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources ID roles role ID default response
func (o *PatchSourcesIDRolesRoleIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDRolesRoleIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PatchSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc turns a function with the right signature into a patch sources ID user user ID explorations exploration ID handler
type PatchSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc func(context.Context, PatchSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchSourcesIDUserUserIDExplorationsExplorationIDHandlerFunc) Handle(ctx context.Context, params PatchSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder {
return fn(ctx, params)
}
// PatchSourcesIDUserUserIDExplorationsExplorationIDHandler interface for that can handle valid patch sources ID user user ID explorations exploration ID params
type PatchSourcesIDUserUserIDExplorationsExplorationIDHandler interface {
Handle(context.Context, PatchSourcesIDUserUserIDExplorationsExplorationIDParams) middleware.Responder
}
// NewPatchSourcesIDUserUserIDExplorationsExplorationID creates a new http.Handler for the patch sources ID user user ID explorations exploration ID operation
func NewPatchSourcesIDUserUserIDExplorationsExplorationID(ctx *middleware.Context, handler PatchSourcesIDUserUserIDExplorationsExplorationIDHandler) *PatchSourcesIDUserUserIDExplorationsExplorationID {
return &PatchSourcesIDUserUserIDExplorationsExplorationID{Context: ctx, Handler: handler}
}
/*PatchSourcesIDUserUserIDExplorationsExplorationID swagger:route PATCH /sources/{id}/user/{user_id}/explorations/{exploration_id} patchSourcesIdUserUserIdExplorationsExplorationId
Update exploration configuration
*/
type PatchSourcesIDUserUserIDExplorationsExplorationID struct {
Context *middleware.Context
Handler PatchSourcesIDUserUserIDExplorationsExplorationIDHandler
}
func (o *PatchSourcesIDUserUserIDExplorationsExplorationID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchSourcesIDUserUserIDExplorationsExplorationIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,139 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
"github.com/influxdata/mrfusion/models"
)
// NewPatchSourcesIDUserUserIDExplorationsExplorationIDParams creates a new PatchSourcesIDUserUserIDExplorationsExplorationIDParams object
// with the default values initialized.
func NewPatchSourcesIDUserUserIDExplorationsExplorationIDParams() PatchSourcesIDUserUserIDExplorationsExplorationIDParams {
var ()
return PatchSourcesIDUserUserIDExplorationsExplorationIDParams{}
}
// PatchSourcesIDUserUserIDExplorationsExplorationIDParams contains all the bound params for the patch sources ID user user ID explorations exploration ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters PatchSourcesIDUserUserIDExplorationsExplorationID
type PatchSourcesIDUserUserIDExplorationsExplorationIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*Update the exploration information to this.
Required: true
In: body
*/
Exploration *models.Exploration
/*ID of the specific exploration.
Required: true
In: path
*/
ExplorationID string
/*ID of the data source
Required: true
In: path
*/
ID string
/*ID of user
Required: true
In: path
*/
UserID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.Exploration
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("exploration", "body"))
} else {
res = append(res, errors.NewParseError("exploration", "body", "", err))
}
} else {
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Exploration = &body
}
}
} else {
res = append(res, errors.Required("exploration", "body"))
}
rExplorationID, rhkExplorationID, _ := route.Params.GetOK("exploration_id")
if err := o.bindExplorationID(rExplorationID, rhkExplorationID, route.Formats); err != nil {
res = append(res, err)
}
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rUserID, rhkUserID, _ := route.Params.GetOK("user_id")
if err := o.bindUserID(rUserID, rhkUserID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDParams) bindExplorationID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ExplorationID = raw
return nil
}
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDParams) bindUserID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.UserID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*PatchSourcesIDUserUserIDExplorationsExplorationIDNoContent Exploration's configuration was changed
swagger:response patchSourcesIdUserUserIdExplorationsExplorationIdNoContent
*/
type PatchSourcesIDUserUserIDExplorationsExplorationIDNoContent struct {
}
// NewPatchSourcesIDUserUserIDExplorationsExplorationIDNoContent creates PatchSourcesIDUserUserIDExplorationsExplorationIDNoContent with default headers values
func NewPatchSourcesIDUserUserIDExplorationsExplorationIDNoContent() *PatchSourcesIDUserUserIDExplorationsExplorationIDNoContent {
return &PatchSourcesIDUserUserIDExplorationsExplorationIDNoContent{}
}
// WriteResponse to the client
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound Data source id, user, or exploration does not exist.
swagger:response patchSourcesIdUserUserIdExplorationsExplorationIdNotFound
*/
type PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDUserUserIDExplorationsExplorationIDNotFound creates PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound with default headers values
func NewPatchSourcesIDUserUserIDExplorationsExplorationIDNotFound() *PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound {
return &PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound{}
}
// WithPayload adds the payload to the patch sources Id user user Id explorations exploration Id not found response
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound) WithPayload(payload *models.Error) *PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources Id user user Id explorations exploration Id not found response
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PatchSourcesIDUserUserIDExplorationsExplorationIDDefault A processing or an unexpected error.
swagger:response patchSourcesIdUserUserIdExplorationsExplorationIdDefault
*/
type PatchSourcesIDUserUserIDExplorationsExplorationIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDUserUserIDExplorationsExplorationIDDefault creates PatchSourcesIDUserUserIDExplorationsExplorationIDDefault with default headers values
func NewPatchSourcesIDUserUserIDExplorationsExplorationIDDefault(code int) *PatchSourcesIDUserUserIDExplorationsExplorationIDDefault {
if code <= 0 {
code = 500
}
return &PatchSourcesIDUserUserIDExplorationsExplorationIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch sources ID user user ID explorations exploration ID default response
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDDefault) WithStatusCode(code int) *PatchSourcesIDUserUserIDExplorationsExplorationIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch sources ID user user ID explorations exploration ID default response
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch sources ID user user ID explorations exploration ID default response
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDDefault) WithPayload(payload *models.Error) *PatchSourcesIDUserUserIDExplorationsExplorationIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources ID user user ID explorations exploration ID default response
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDUserUserIDExplorationsExplorationIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PatchSourcesIDUsersUserIDHandlerFunc turns a function with the right signature into a patch sources ID users user ID handler
type PatchSourcesIDUsersUserIDHandlerFunc func(context.Context, PatchSourcesIDUsersUserIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchSourcesIDUsersUserIDHandlerFunc) Handle(ctx context.Context, params PatchSourcesIDUsersUserIDParams) middleware.Responder {
return fn(ctx, params)
}
// PatchSourcesIDUsersUserIDHandler interface for that can handle valid patch sources ID users user ID params
type PatchSourcesIDUsersUserIDHandler interface {
Handle(context.Context, PatchSourcesIDUsersUserIDParams) middleware.Responder
}
// NewPatchSourcesIDUsersUserID creates a new http.Handler for the patch sources ID users user ID operation
func NewPatchSourcesIDUsersUserID(ctx *middleware.Context, handler PatchSourcesIDUsersUserIDHandler) *PatchSourcesIDUsersUserID {
return &PatchSourcesIDUsersUserID{Context: ctx, Handler: handler}
}
/*PatchSourcesIDUsersUserID swagger:route PATCH /sources/{id}/users/{user_id} patchSourcesIdUsersUserId
Update user configuration
*/
type PatchSourcesIDUsersUserID struct {
Context *middleware.Context
Handler PatchSourcesIDUsersUserIDHandler
}
func (o *PatchSourcesIDUsersUserID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchSourcesIDUsersUserIDParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,118 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
"github.com/influxdata/mrfusion/models"
)
// NewPatchSourcesIDUsersUserIDParams creates a new PatchSourcesIDUsersUserIDParams object
// with the default values initialized.
func NewPatchSourcesIDUsersUserIDParams() PatchSourcesIDUsersUserIDParams {
var ()
return PatchSourcesIDUsersUserIDParams{}
}
// PatchSourcesIDUsersUserIDParams contains all the bound params for the patch sources ID users user ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters PatchSourcesIDUsersUserID
type PatchSourcesIDUsersUserIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*user configuration
Required: true
In: body
*/
Config *models.User
/*ID of a data source
Required: true
In: path
*/
ID string
/*ID of the specific user
Required: true
In: path
*/
UserID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *PatchSourcesIDUsersUserIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.User
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("config", "body"))
} else {
res = append(res, errors.NewParseError("config", "body", "", err))
}
} else {
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Config = &body
}
}
} else {
res = append(res, errors.Required("config", "body"))
}
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rUserID, rhkUserID, _ := route.Params.GetOK("user_id")
if err := o.bindUserID(rUserID, rhkUserID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PatchSourcesIDUsersUserIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *PatchSourcesIDUsersUserIDParams) bindUserID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.UserID = raw
return nil
}

View File

@ -0,0 +1,122 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*PatchSourcesIDUsersUserIDNoContent Users's configuration was changed
swagger:response patchSourcesIdUsersUserIdNoContent
*/
type PatchSourcesIDUsersUserIDNoContent struct {
}
// NewPatchSourcesIDUsersUserIDNoContent creates PatchSourcesIDUsersUserIDNoContent with default headers values
func NewPatchSourcesIDUsersUserIDNoContent() *PatchSourcesIDUsersUserIDNoContent {
return &PatchSourcesIDUsersUserIDNoContent{}
}
// WriteResponse to the client
func (o *PatchSourcesIDUsersUserIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*PatchSourcesIDUsersUserIDNotFound Happens when trying to access a non-existent user.
swagger:response patchSourcesIdUsersUserIdNotFound
*/
type PatchSourcesIDUsersUserIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDUsersUserIDNotFound creates PatchSourcesIDUsersUserIDNotFound with default headers values
func NewPatchSourcesIDUsersUserIDNotFound() *PatchSourcesIDUsersUserIDNotFound {
return &PatchSourcesIDUsersUserIDNotFound{}
}
// WithPayload adds the payload to the patch sources Id users user Id not found response
func (o *PatchSourcesIDUsersUserIDNotFound) WithPayload(payload *models.Error) *PatchSourcesIDUsersUserIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources Id users user Id not found response
func (o *PatchSourcesIDUsersUserIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDUsersUserIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PatchSourcesIDUsersUserIDDefault A processing or an unexpected error.
swagger:response patchSourcesIdUsersUserIdDefault
*/
type PatchSourcesIDUsersUserIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDUsersUserIDDefault creates PatchSourcesIDUsersUserIDDefault with default headers values
func NewPatchSourcesIDUsersUserIDDefault(code int) *PatchSourcesIDUsersUserIDDefault {
if code <= 0 {
code = 500
}
return &PatchSourcesIDUsersUserIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch sources ID users user ID default response
func (o *PatchSourcesIDUsersUserIDDefault) WithStatusCode(code int) *PatchSourcesIDUsersUserIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch sources ID users user ID default response
func (o *PatchSourcesIDUsersUserIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch sources ID users user ID default response
func (o *PatchSourcesIDUsersUserIDDefault) WithPayload(payload *models.Error) *PatchSourcesIDUsersUserIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources ID users user ID default response
func (o *PatchSourcesIDUsersUserIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDUsersUserIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PostDashboardsHandlerFunc turns a function with the right signature into a post dashboards handler
type PostDashboardsHandlerFunc func(context.Context, PostDashboardsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostDashboardsHandlerFunc) Handle(ctx context.Context, params PostDashboardsParams) middleware.Responder {
return fn(ctx, params)
}
// PostDashboardsHandler interface for that can handle valid post dashboards params
type PostDashboardsHandler interface {
Handle(context.Context, PostDashboardsParams) middleware.Responder
}
// NewPostDashboards creates a new http.Handler for the post dashboards operation
func NewPostDashboards(ctx *middleware.Context, handler PostDashboardsHandler) *PostDashboards {
return &PostDashboards{Context: ctx, Handler: handler}
}
/*PostDashboards swagger:route POST /dashboards postDashboards
Create new Dashboard
*/
type PostDashboards struct {
Context *middleware.Context
Handler PostDashboardsHandler
}
func (o *PostDashboards) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostDashboardsParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,65 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/influxdata/mrfusion/models"
)
// NewPostDashboardsParams creates a new PostDashboardsParams object
// with the default values initialized.
func NewPostDashboardsParams() PostDashboardsParams {
var ()
return PostDashboardsParams{}
}
// PostDashboardsParams contains all the bound params for the post dashboards operation
// typically these are obtained from a http.Request
//
// swagger:parameters PostDashboards
type PostDashboardsParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*Defines the dashboard and queries of the cells within the dashboard.
In: body
*/
Dashboard *models.Dashboard
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *PostDashboardsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.Dashboard
if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("dashboard", "body", "", err))
} else {
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Dashboard = &body
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,123 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*PostDashboardsCreated Successfully created new dashboard
swagger:response postDashboardsCreated
*/
type PostDashboardsCreated struct {
/*Location of the newly created dashboard
Required: true
*/
Location string `json:"Location"`
// In: body
Payload *models.Dashboard `json:"body,omitempty"`
}
// NewPostDashboardsCreated creates PostDashboardsCreated with default headers values
func NewPostDashboardsCreated() *PostDashboardsCreated {
return &PostDashboardsCreated{}
}
// WithLocation adds the location to the post dashboards created response
func (o *PostDashboardsCreated) WithLocation(location string) *PostDashboardsCreated {
o.Location = location
return o
}
// SetLocation sets the location to the post dashboards created response
func (o *PostDashboardsCreated) SetLocation(location string) {
o.Location = location
}
// WithPayload adds the payload to the post dashboards created response
func (o *PostDashboardsCreated) WithPayload(payload *models.Dashboard) *PostDashboardsCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post dashboards created response
func (o *PostDashboardsCreated) SetPayload(payload *models.Dashboard) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostDashboardsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
// response header Location
rw.Header().Add("Location", fmt.Sprintf("%v", o.Location))
rw.WriteHeader(201)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PostDashboardsDefault A processing or an unexpected error.
swagger:response postDashboardsDefault
*/
type PostDashboardsDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostDashboardsDefault creates PostDashboardsDefault with default headers values
func NewPostDashboardsDefault(code int) *PostDashboardsDefault {
if code <= 0 {
code = 500
}
return &PostDashboardsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the post dashboards default response
func (o *PostDashboardsDefault) WithStatusCode(code int) *PostDashboardsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the post dashboards default response
func (o *PostDashboardsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the post dashboards default response
func (o *PostDashboardsDefault) WithPayload(payload *models.Error) *PostDashboardsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post dashboards default response
func (o *PostDashboardsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostDashboardsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PostSourcesHandlerFunc turns a function with the right signature into a post sources handler
type PostSourcesHandlerFunc func(context.Context, PostSourcesParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostSourcesHandlerFunc) Handle(ctx context.Context, params PostSourcesParams) middleware.Responder {
return fn(ctx, params)
}
// PostSourcesHandler interface for that can handle valid post sources params
type PostSourcesHandler interface {
Handle(context.Context, PostSourcesParams) middleware.Responder
}
// NewPostSources creates a new http.Handler for the post sources operation
func NewPostSources(ctx *middleware.Context, handler PostSourcesHandler) *PostSources {
return &PostSources{Context: ctx, Handler: handler}
}
/*PostSources swagger:route POST /sources postSources
Create new data source
*/
type PostSources struct {
Context *middleware.Context
Handler PostSourcesHandler
}
func (o *PostSources) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostSourcesParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PostSourcesIDProxyHandlerFunc turns a function with the right signature into a post sources ID proxy handler
type PostSourcesIDProxyHandlerFunc func(context.Context, PostSourcesIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostSourcesIDProxyHandlerFunc) Handle(ctx context.Context, params PostSourcesIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// PostSourcesIDProxyHandler interface for that can handle valid post sources ID proxy params
type PostSourcesIDProxyHandler interface {
Handle(context.Context, PostSourcesIDProxyParams) middleware.Responder
}
// NewPostSourcesIDProxy creates a new http.Handler for the post sources ID proxy operation
func NewPostSourcesIDProxy(ctx *middleware.Context, handler PostSourcesIDProxyHandler) *PostSourcesIDProxy {
return &PostSourcesIDProxy{Context: ctx, Handler: handler}
}
/*PostSourcesIDProxy swagger:route POST /sources/{id}/proxy postSourcesIdProxy
Query the backend time series data source and return the response according to `format`
*/
type PostSourcesIDProxy struct {
Context *middleware.Context
Handler PostSourcesIDProxyHandler
}
func (o *PostSourcesIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostSourcesIDProxyParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,97 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
"github.com/influxdata/mrfusion/models"
)
// NewPostSourcesIDProxyParams creates a new PostSourcesIDProxyParams object
// with the default values initialized.
func NewPostSourcesIDProxyParams() PostSourcesIDProxyParams {
var ()
return PostSourcesIDProxyParams{}
}
// PostSourcesIDProxyParams contains all the bound params for the post sources ID proxy operation
// typically these are obtained from a http.Request
//
// swagger:parameters PostSourcesIDProxy
type PostSourcesIDProxyParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
/*Query Parameters
Required: true
In: body
*/
Query *models.Proxy
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *PostSourcesIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.Proxy
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("query", "body"))
} else {
res = append(res, errors.NewParseError("query", "body", "", err))
}
} else {
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Query = &body
}
}
} else {
res = append(res, errors.Required("query", "body"))
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PostSourcesIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,215 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*PostSourcesIDProxyOK Result of the query from the backend time series data source.
swagger:response postSourcesIdProxyOK
*/
type PostSourcesIDProxyOK struct {
// In: body
Payload *models.ProxyResponse `json:"body,omitempty"`
}
// NewPostSourcesIDProxyOK creates PostSourcesIDProxyOK with default headers values
func NewPostSourcesIDProxyOK() *PostSourcesIDProxyOK {
return &PostSourcesIDProxyOK{}
}
// WithPayload adds the payload to the post sources Id proxy o k response
func (o *PostSourcesIDProxyOK) WithPayload(payload *models.ProxyResponse) *PostSourcesIDProxyOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources Id proxy o k response
func (o *PostSourcesIDProxyOK) SetPayload(payload *models.ProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDProxyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PostSourcesIDProxyBadRequest Any query that results in a data source error (syntax error, etc) will cause this response. The error message will be passed back in the body
swagger:response postSourcesIdProxyBadRequest
*/
type PostSourcesIDProxyBadRequest struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostSourcesIDProxyBadRequest creates PostSourcesIDProxyBadRequest with default headers values
func NewPostSourcesIDProxyBadRequest() *PostSourcesIDProxyBadRequest {
return &PostSourcesIDProxyBadRequest{}
}
// WithPayload adds the payload to the post sources Id proxy bad request response
func (o *PostSourcesIDProxyBadRequest) WithPayload(payload *models.Error) *PostSourcesIDProxyBadRequest {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources Id proxy bad request response
func (o *PostSourcesIDProxyBadRequest) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDProxyBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(400)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PostSourcesIDProxyNotFound Data source id does not exist.
swagger:response postSourcesIdProxyNotFound
*/
type PostSourcesIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostSourcesIDProxyNotFound creates PostSourcesIDProxyNotFound with default headers values
func NewPostSourcesIDProxyNotFound() *PostSourcesIDProxyNotFound {
return &PostSourcesIDProxyNotFound{}
}
// WithPayload adds the payload to the post sources Id proxy not found response
func (o *PostSourcesIDProxyNotFound) WithPayload(payload *models.Error) *PostSourcesIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources Id proxy not found response
func (o *PostSourcesIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDProxyNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PostSourcesIDProxyRequestTimeout Timeout trying to query data source.
swagger:response postSourcesIdProxyRequestTimeout
*/
type PostSourcesIDProxyRequestTimeout struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostSourcesIDProxyRequestTimeout creates PostSourcesIDProxyRequestTimeout with default headers values
func NewPostSourcesIDProxyRequestTimeout() *PostSourcesIDProxyRequestTimeout {
return &PostSourcesIDProxyRequestTimeout{}
}
// WithPayload adds the payload to the post sources Id proxy request timeout response
func (o *PostSourcesIDProxyRequestTimeout) WithPayload(payload *models.Error) *PostSourcesIDProxyRequestTimeout {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources Id proxy request timeout response
func (o *PostSourcesIDProxyRequestTimeout) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDProxyRequestTimeout) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(408)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PostSourcesIDProxyDefault Unexpected internal service error
swagger:response postSourcesIdProxyDefault
*/
type PostSourcesIDProxyDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostSourcesIDProxyDefault creates PostSourcesIDProxyDefault with default headers values
func NewPostSourcesIDProxyDefault(code int) *PostSourcesIDProxyDefault {
if code <= 0 {
code = 500
}
return &PostSourcesIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the post sources ID proxy default response
func (o *PostSourcesIDProxyDefault) WithStatusCode(code int) *PostSourcesIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the post sources ID proxy default response
func (o *PostSourcesIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the post sources ID proxy default response
func (o *PostSourcesIDProxyDefault) WithPayload(payload *models.Error) *PostSourcesIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources ID proxy default response
func (o *PostSourcesIDProxyDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PostSourcesIDRolesHandlerFunc turns a function with the right signature into a post sources ID roles handler
type PostSourcesIDRolesHandlerFunc func(context.Context, PostSourcesIDRolesParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostSourcesIDRolesHandlerFunc) Handle(ctx context.Context, params PostSourcesIDRolesParams) middleware.Responder {
return fn(ctx, params)
}
// PostSourcesIDRolesHandler interface for that can handle valid post sources ID roles params
type PostSourcesIDRolesHandler interface {
Handle(context.Context, PostSourcesIDRolesParams) middleware.Responder
}
// NewPostSourcesIDRoles creates a new http.Handler for the post sources ID roles operation
func NewPostSourcesIDRoles(ctx *middleware.Context, handler PostSourcesIDRolesHandler) *PostSourcesIDRoles {
return &PostSourcesIDRoles{Context: ctx, Handler: handler}
}
/*PostSourcesIDRoles swagger:route POST /sources/{id}/roles postSourcesIdRoles
Create new role for this data source
*/
type PostSourcesIDRoles struct {
Context *middleware.Context
Handler PostSourcesIDRolesHandler
}
func (o *PostSourcesIDRoles) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostSourcesIDRolesParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,88 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
"github.com/influxdata/mrfusion/models"
)
// NewPostSourcesIDRolesParams creates a new PostSourcesIDRolesParams object
// with the default values initialized.
func NewPostSourcesIDRolesParams() PostSourcesIDRolesParams {
var ()
return PostSourcesIDRolesParams{}
}
// PostSourcesIDRolesParams contains all the bound params for the post sources ID roles operation
// typically these are obtained from a http.Request
//
// swagger:parameters PostSourcesIDRoles
type PostSourcesIDRolesParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
/*Configuration options for new role
In: body
*/
Role *models.Role
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *PostSourcesIDRolesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.Role
if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("role", "body", "", err))
} else {
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Role = &body
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PostSourcesIDRolesParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,123 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*PostSourcesIDRolesCreated Successfully created new role
swagger:response postSourcesIdRolesCreated
*/
type PostSourcesIDRolesCreated struct {
/*Location of the newly created role resource.
Required: true
*/
Location string `json:"Location"`
// In: body
Payload *models.Role `json:"body,omitempty"`
}
// NewPostSourcesIDRolesCreated creates PostSourcesIDRolesCreated with default headers values
func NewPostSourcesIDRolesCreated() *PostSourcesIDRolesCreated {
return &PostSourcesIDRolesCreated{}
}
// WithLocation adds the location to the post sources Id roles created response
func (o *PostSourcesIDRolesCreated) WithLocation(location string) *PostSourcesIDRolesCreated {
o.Location = location
return o
}
// SetLocation sets the location to the post sources Id roles created response
func (o *PostSourcesIDRolesCreated) SetLocation(location string) {
o.Location = location
}
// WithPayload adds the payload to the post sources Id roles created response
func (o *PostSourcesIDRolesCreated) WithPayload(payload *models.Role) *PostSourcesIDRolesCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources Id roles created response
func (o *PostSourcesIDRolesCreated) SetPayload(payload *models.Role) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDRolesCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
// response header Location
rw.Header().Add("Location", fmt.Sprintf("%v", o.Location))
rw.WriteHeader(201)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PostSourcesIDRolesDefault A processing or an unexpected error.
swagger:response postSourcesIdRolesDefault
*/
type PostSourcesIDRolesDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostSourcesIDRolesDefault creates PostSourcesIDRolesDefault with default headers values
func NewPostSourcesIDRolesDefault(code int) *PostSourcesIDRolesDefault {
if code <= 0 {
code = 500
}
return &PostSourcesIDRolesDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the post sources ID roles default response
func (o *PostSourcesIDRolesDefault) WithStatusCode(code int) *PostSourcesIDRolesDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the post sources ID roles default response
func (o *PostSourcesIDRolesDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the post sources ID roles default response
func (o *PostSourcesIDRolesDefault) WithPayload(payload *models.Error) *PostSourcesIDRolesDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources ID roles default response
func (o *PostSourcesIDRolesDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDRolesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PostSourcesIDUsersHandlerFunc turns a function with the right signature into a post sources ID users handler
type PostSourcesIDUsersHandlerFunc func(context.Context, PostSourcesIDUsersParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostSourcesIDUsersHandlerFunc) Handle(ctx context.Context, params PostSourcesIDUsersParams) middleware.Responder {
return fn(ctx, params)
}
// PostSourcesIDUsersHandler interface for that can handle valid post sources ID users params
type PostSourcesIDUsersHandler interface {
Handle(context.Context, PostSourcesIDUsersParams) middleware.Responder
}
// NewPostSourcesIDUsers creates a new http.Handler for the post sources ID users operation
func NewPostSourcesIDUsers(ctx *middleware.Context, handler PostSourcesIDUsersHandler) *PostSourcesIDUsers {
return &PostSourcesIDUsers{Context: ctx, Handler: handler}
}
/*PostSourcesIDUsers swagger:route POST /sources/{id}/users postSourcesIdUsers
Create new user for this data source
*/
type PostSourcesIDUsers struct {
Context *middleware.Context
Handler PostSourcesIDUsersHandler
}
func (o *PostSourcesIDUsers) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostSourcesIDUsersParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,88 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
strfmt "github.com/go-openapi/strfmt"
"github.com/influxdata/mrfusion/models"
)
// NewPostSourcesIDUsersParams creates a new PostSourcesIDUsersParams object
// with the default values initialized.
func NewPostSourcesIDUsersParams() PostSourcesIDUsersParams {
var ()
return PostSourcesIDUsersParams{}
}
// PostSourcesIDUsersParams contains all the bound params for the post sources ID users operation
// typically these are obtained from a http.Request
//
// swagger:parameters PostSourcesIDUsers
type PostSourcesIDUsersParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the data source
Required: true
In: path
*/
ID string
/*Configuration options for new user
In: body
*/
User *models.User
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *PostSourcesIDUsersParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.User
if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("user", "body", "", err))
} else {
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.User = &body
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PostSourcesIDUsersParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -0,0 +1,123 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"net/http"
"github.com/go-openapi/runtime"
"github.com/influxdata/mrfusion/models"
)
/*PostSourcesIDUsersCreated Successfully created new user
swagger:response postSourcesIdUsersCreated
*/
type PostSourcesIDUsersCreated struct {
/*Location of the newly created user resource.
Required: true
*/
Location string `json:"Location"`
// In: body
Payload *models.User `json:"body,omitempty"`
}
// NewPostSourcesIDUsersCreated creates PostSourcesIDUsersCreated with default headers values
func NewPostSourcesIDUsersCreated() *PostSourcesIDUsersCreated {
return &PostSourcesIDUsersCreated{}
}
// WithLocation adds the location to the post sources Id users created response
func (o *PostSourcesIDUsersCreated) WithLocation(location string) *PostSourcesIDUsersCreated {
o.Location = location
return o
}
// SetLocation sets the location to the post sources Id users created response
func (o *PostSourcesIDUsersCreated) SetLocation(location string) {
o.Location = location
}
// WithPayload adds the payload to the post sources Id users created response
func (o *PostSourcesIDUsersCreated) WithPayload(payload *models.User) *PostSourcesIDUsersCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources Id users created response
func (o *PostSourcesIDUsersCreated) SetPayload(payload *models.User) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDUsersCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
// response header Location
rw.Header().Add("Location", fmt.Sprintf("%v", o.Location))
rw.WriteHeader(201)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*PostSourcesIDUsersDefault A processing or an unexpected error.
swagger:response postSourcesIdUsersDefault
*/
type PostSourcesIDUsersDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostSourcesIDUsersDefault creates PostSourcesIDUsersDefault with default headers values
func NewPostSourcesIDUsersDefault(code int) *PostSourcesIDUsersDefault {
if code <= 0 {
code = 500
}
return &PostSourcesIDUsersDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the post sources ID users default response
func (o *PostSourcesIDUsersDefault) WithStatusCode(code int) *PostSourcesIDUsersDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the post sources ID users default response
func (o *PostSourcesIDUsersDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the post sources ID users default response
func (o *PostSourcesIDUsersDefault) WithPayload(payload *models.Error) *PostSourcesIDUsersDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources ID users default response
func (o *PostSourcesIDUsersDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDUsersDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@ -0,0 +1,55 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
context "golang.org/x/net/context"
middleware "github.com/go-openapi/runtime/middleware"
)
// PostSourcesIDUsersUserIDExplorationsHandlerFunc turns a function with the right signature into a post sources ID users user ID explorations handler
type PostSourcesIDUsersUserIDExplorationsHandlerFunc func(context.Context, PostSourcesIDUsersUserIDExplorationsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostSourcesIDUsersUserIDExplorationsHandlerFunc) Handle(ctx context.Context, params PostSourcesIDUsersUserIDExplorationsParams) middleware.Responder {
return fn(ctx, params)
}
// PostSourcesIDUsersUserIDExplorationsHandler interface for that can handle valid post sources ID users user ID explorations params
type PostSourcesIDUsersUserIDExplorationsHandler interface {
Handle(context.Context, PostSourcesIDUsersUserIDExplorationsParams) middleware.Responder
}
// NewPostSourcesIDUsersUserIDExplorations creates a new http.Handler for the post sources ID users user ID explorations operation
func NewPostSourcesIDUsersUserIDExplorations(ctx *middleware.Context, handler PostSourcesIDUsersUserIDExplorationsHandler) *PostSourcesIDUsersUserIDExplorations {
return &PostSourcesIDUsersUserIDExplorations{Context: ctx, Handler: handler}
}
/*PostSourcesIDUsersUserIDExplorations swagger:route POST /sources/{id}/users/{user_id}/explorations postSourcesIdUsersUserIdExplorations
Create new named exploration for this user
*/
type PostSourcesIDUsersUserIDExplorations struct {
Context *middleware.Context
Handler PostSourcesIDUsersUserIDExplorationsHandler
}
func (o *PostSourcesIDUsersUserIDExplorations) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostSourcesIDUsersUserIDExplorationsParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

Some files were not shown because too many files have changed in this diff Show More