Merge develop

pull/35/head
Will Piers 2016-09-14 14:33:32 -07:00
commit 848b324796
121 changed files with 11377 additions and 654 deletions

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM mhart/alpine-node:latest
ADD package.json /package.json
ADD webpack.config.js /webpack.config.js
ADD ui /ui
# Install node deps
RUN npm install
# Build assets to ./dist
RUN $(npm bin)/webpack
# Run the image as a non-root user
RUN adduser -D mrfusion
USER mrfusion
# Start the server. Currently this is just a webpack dev server
# in the future we'd start the go process here.
CMD $(npm bin)/webpack-dev-server --host 0.0.0.0 --port $PORT

19
Godeps Normal file
View File

@ -0,0 +1,19 @@
github.com/PuerkitoBio/purell 8a290539e2e8629dbc4e6bad948158f790ec31f4
github.com/PuerkitoBio/urlesc 5bd2802263f21d8788851d5305584c82a5c75d7e
github.com/asaskevich/govalidator 593d64559f7600f29581a3ee42177f5dbded27a9
github.com/go-openapi/analysis b44dc874b601d9e4e2f6e19140e794ba24bead3b
github.com/go-openapi/errors 4178436c9f2430cdd945c50301cfb61563b56573
github.com/go-openapi/jsonpointer 46af16f9f7b149af66e5d1bd010e3574dc06de98
github.com/go-openapi/jsonreference 13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272
github.com/go-openapi/loads 18441dfa706d924a39a030ee2c3b1d8d81917b38
github.com/go-openapi/runtime 18efe8c11921c0ddabc8e91554971d6db1f91c7c
github.com/go-openapi/spec 6aced65f8501fe1217321abf0749d354824ba2ff
github.com/go-openapi/strfmt d65c7fdb29eca313476e529628176fe17e58c488
github.com/go-openapi/swag 0e04f5e499b19bf51031c01a00f098f25067d8dc
github.com/go-openapi/validate deaf2c9013bc1a7f4c774662259a506ba874d80f
github.com/gorilla/context 08b5f424b9271eedf6f9f0ce86cb9396ed337a42
github.com/jessevdk/go-flags 4cc2832a6e6d1d3b815e2b9d544b2a4dfb3ce8fa
github.com/mailru/easyjson e978125a7e335d8f4db746a9ac5b44643f27416b
github.com/tylerb/graceful 50a48b6e73fcc75b45e22c05b79629a67c79e938
golang.org/x/net 749a502dd1eaf3e5bfd4f8956748c502357c0bbe
golang.org/x/text 1e65e9bf72c307081cea196f47ef37aed17eb316

View File

@ -1 +1,24 @@
# mrfusion
# mrfusion
Includes a Dockerfile that builds a container suitable for Heroku.
In order to push to heroku, make sure you've logged into Heroku normally with...
`heroku login`
Add the acceptance server git remote...
`git remote add acceptance https://git.heroku.com/mrfusion-acc.git`
When you run `heroku apps` you should see "mrfusion-acc".
Then install the container plugin
`heroku plugins:install heroku-container-registry`
Then log into the container registry with...
`heroku container:login`
Build and push the web container by running...
`heroku container:push web`

21
circle.yml Normal file
View File

@ -0,0 +1,21 @@
---
machine:
services:
- docker
dependencies:
override:
- docker info
- docker build --rm=false -t influxdata/mrfusion .
test:
override:
- docker run -d -p 8080:5000 -e PORT=5000 influxdata/mrfusion; sleep 10
- curl --retry 10 --retry-delay 5 -v http://localhost:8080
deployment:
heroku:
branch: develop
commands:
- docker login -e $HEROKU_EMAIL -u $HEROKU_EMAIL -p $HEROKU_PASS registry.heroku.com
- docker tag influxdata/mrfusion registry.heroku.com/mrfusion-acc/web
- docker push registry.heroku.com/mrfusion-acc/web

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)
}
}

215
docs/design.md Normal file
View File

@ -0,0 +1,215 @@
## Chronograf
[TOC]
### Design Philosophy
1. Present uniform interface to front-end covering Plutonium and InfluxDB OSS offerings.
2. Simplify the front-end interaction with time-series database.
3. Ease of setup and use.
4. Extensible as base for future applications
5. There will be an open source version of this.
7. Stress Parallel Development across all teams.
8. First class support of on-prem.
9. Release to cloud first.
### Initial Goals
1. Produce pre-canned graphs for devops telegraf data for docker containers or system stats.
2. Up and running in 2 minutes
3. User administration for Influx Enterprise.
4. Leverage our existing enterprise front-end code.
5. Leverage lessons-learned for enterprise back-end code.
### Versions
Each version will contain more and more features around monitoring various devops components.
#### Features
1. v1
- Data explorer for both OSS and Enterprise
- Dashboards for telegraf system metrics
- User and Role adminstration
- Proxy queries over OSS and Enterprise
- Authenticate against OSS/Enterprise
2. v2
- Telegraf agent service
- Additional Dashboards for telegraf agent
### Supported Versions of TICK Stack
We will only support 1.0 of the TICK stack.
### Closed source vs Open Source
- Ideally, we would use the soon-to-be open source plutonium client to interact with Influx Enterprise. This would mean that this application could be entirely open source. (We should check with Todd and Nate.)
- However, if in the future we want to deliver a closed source version, we'll use the open source version as a library. The open source library will define certain routes (/users, /whatever); the closed source version will either override those routes, or add new ones. This implies that the closed source version is simply additional or manipulated routes on the server.
- Survey the experience of closed source with Jason and Nathaniel.
### Repository
#### Structure
Both the javascript and go source will be in the same repository.
#### Builds
Javascript build will be decoupled from Go build process.
Asset compilation will happen during build of backend-server.
This allows the front-end team to swap in mocked, auto-generated swagger backend for testing and development.
##### Javascript
Webpack
Static asset compilation during backend-server build.
##### Go
We'll use GDM as the vendoring solution to maintain consistency with other pieces of TICK stack.
*Future work*: we must switch to the community vendoring solution when it actually seems mature.
### API
#### REST
We'll use swagger interface definition to specify API and JSON validation. The goal is to emphasize designing to an interface facilitating parallel development.
#### Queries
Features would include:
1. Load balancing against all data nodes in cluster.
1. Formatting the output results to be simple to use in frontend.
1. Decimating the results to minimize network traffic.
1. Use parameters to move query time range.
1. Allow different types of response protocols (http GET, websocket, etc.).
- **`/proxy`:** used to send queries directly to the Influx backend. They should be most useful for the data explorer or other ad hoc query functionality.
##### `/proxy` Queries
Queries to the `/proxy` endpoint do not create new REST resources. Instead, it returns results of the query.
This endpoint uses POST with a JSON object to specify the query and the parameters. The endpoint's response will be the results of the query, or, the errors from the backend InfluxDB.
Errors in the 4xx range come from the Influxdb data source.
```sequence
App->/proxy: POST query
Note right of /proxy: Query Validation
Note right of /proxy: Load balance query
/proxy->Influx/Relay/Cluster: SELECT
Influx/Relay/Cluster-->/proxy: Time Series
Note right of /proxy: Format
/proxy-->App: Formatted results
```
Request:
```http
POST /enterprise/v1/sources/{id}/proxy HTTP/1.1
Accept: application/json
Content-Type: application/json
{
"query": "SELECT * from telegraf where time > $value",
"format": "dygraph",
}
```
Response:
```http
HTTP/1.1 200 OK
Content-Type: application/json
{
"results": "..."
}
```
Error Response:
```http
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"code": 400,
"message": "error parsing query: found..."
}
```
##### Load balancing
Use simple round robin load balancing requests to data nodes.
Discover active data nodes using Plutonium meta client.
#### Backend-server store
We will build a interface for storing API resources.
Some API resources could come from the influx data source (like users) most will be stored in a key/value or relational store.
Version 1.1 will use boltdb as the key/value store.
Future versions will support more HA data stores.
##### Objects
1. Data source
- Version 1.1 will have only one data source.
- InfluxDB
- InfluxDB Enterprise (this means clustering)
- InfluxDB relay possibly.
- Will provide meta data describing the data source (e.g. number of nodes)
1. User
- Version 1.1 will be a one-to-one mapping to influx.
1. Dashboards
- precanned dashboards for telegraf
- Includes location of query resources.
1. Queries
- Used to construct influxql.
1. Sessions
- We could simply use the JWT token as the session information
1. Server Configuration
- Any setting that would normally in TICK stack land be in a file, we'll expose through an updatable API.
- License/Organization info, modules(pre-canned dash, query builder, customer dash, config builder), usage and debug history/info, support contacts
#### Authentication
We want the backend data store (influx oss or influx meta) handle the authentication so that the web server has less responsibility.
We'll use JWT throughout.
### Testing
Talk with Mark and Michael and talk about larger efforts. This will impact the repository layout.
There is a potentially large testing matrix of components.
#### Integration Testing
Because we are pulling together so many TICK stack components we will need strong integration testing.
- Stress testing.
- Benchmark pathological queries
- End to end testing. Telegraf -> Plutonium -> Chronograf = expected graph.
- Would be nice to translate user stories to integration tests.
- If someone finds a bug in the integration we need a test so it will never happen again.
- Upgrade testing.
- Version support.
#### Usability and Experience Testing
1. Owned by design team.
1. We are trying to attract the devops crowd.
- Deployment experience
- Ease of use.
- Speed to accomplish task, e.g. find specific info, change setting.

30
docs/queries.md Normal file
View File

@ -0,0 +1,30 @@
##
Query proxy will be a façade over InfluxDB, InfluxDB Enterprise Cluster, and InfluxDB Relay.
It will provide a uniform interface to `SELECT` a time range of data.
```http
POST /enterprise/v1/sources/{id}/query HTTP/1.1
Accept: application/json
Content-Type: application/json
{
"query": "SELECT * from telegraf",
"format": "dygraph",
"max_points": 1000,
"type": "http"
}
```
Response:
```http
HTTP/1.1 202 OK
{
"link": {
"rel": "self",
"href": "/enterprise/v1/sources/{id}/query/{qid}",
"type": "http"
}
}
```

129
mock/handlers.go Normal file
View File

@ -0,0 +1,129 @@
package mock
import (
"strconv"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/influxdata/mrfusion"
"github.com/influxdata/mrfusion/models"
op "github.com/influxdata/mrfusion/restapi/operations"
"golang.org/x/net/context"
)
type Handler struct {
Store mrfusion.ExplorationStore
Response mrfusion.Response
}
func NewHandler() Handler {
return Handler{
DefaultExplorationStore,
SampleResponse,
}
}
func (m *Handler) Proxy(ctx context.Context, params op.PostSourcesIDProxyParams) middleware.Responder {
results, err := m.Response.Results()
if err != nil {
return op.NewPostSourcesIDProxyDefault(500)
}
res := &models.ProxyResponse{
Results: results,
}
return op.NewPostSourcesIDProxyOK().WithPayload(res)
}
func (m *Handler) Explorations(ctx context.Context, params op.GetSourcesIDUsersUserIDExplorationsParams) middleware.Responder {
id, err := strconv.Atoi(params.UserID)
if err != nil {
return op.NewGetSourcesIDUsersUserIDExplorationsDefault(500)
}
exs, err := m.Store.Query(ctx, id)
if err != nil {
return op.NewGetSourcesIDUsersUserIDExplorationsNotFound()
}
res := &models.Explorations{}
for _, e := range exs {
res.Explorations = append(res.Explorations, &models.Exploration{
Data: e.Data,
Name: e.Name,
UpdatedAt: strfmt.DateTime(e.UpdatedAt),
CreatedAt: strfmt.DateTime(e.CreatedAt),
},
)
}
return op.NewGetSourcesIDUsersUserIDExplorationsOK().WithPayload(res)
}
func (m *Handler) Exploration(ctx context.Context, params op.GetSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder {
eID, err := strconv.Atoi(params.ExplorationID)
if err != nil {
return op.NewGetSourcesIDUsersUserIDExplorationsExplorationIDDefault(500)
}
e, err := m.Store.Get(ctx, eID)
if err != nil {
return op.NewGetSourcesIDUsersUserIDExplorationsExplorationIDNotFound()
}
res := &models.Exploration{
Data: e.Data,
Name: e.Name,
UpdatedAt: strfmt.DateTime(e.UpdatedAt),
CreatedAt: strfmt.DateTime(e.CreatedAt),
}
return op.NewGetSourcesIDUsersUserIDExplorationsExplorationIDOK().WithPayload(res)
}
func (m *Handler) UpdateExploration(ctx context.Context, params op.PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder {
eID, err := strconv.Atoi(params.ExplorationID)
if err != nil {
return op.NewPatchSourcesIDUsersUserIDExplorationsExplorationIDDefault(500)
}
e, err := m.Store.Get(ctx, eID)
if err != nil {
return op.NewPatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound()
}
if params.Exploration != nil {
e.Data = params.Exploration.Data.(string)
e.Name = params.Exploration.Name
m.Store.Update(ctx, e)
}
return op.NewPatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent()
}
func (m *Handler) NewExploration(ctx context.Context, params op.PostSourcesIDUsersUserIDExplorationsParams) middleware.Responder {
id, err := strconv.Atoi(params.UserID)
if err != nil {
return op.NewPostSourcesIDUsersUserIDExplorationsDefault(500)
}
exs, err := m.Store.Query(ctx, id)
if err != nil {
return op.NewPostSourcesIDUsersUserIDExplorationsNotFound()
}
eID := len(exs)
if params.Exploration != nil {
e := mrfusion.Exploration{
Data: params.Exploration.Data.(string),
Name: params.Exploration.Name,
ID: eID,
}
m.Store.Add(ctx, e)
}
return op.NewPostSourcesIDUsersUserIDExplorationsCreated()
}
func (m *Handler) DeleteExploration(ctx context.Context, params op.DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder {
ID, err := strconv.Atoi(params.ExplorationID)
if err != nil {
return op.NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault(500)
}
if err := m.Store.Delete(ctx, mrfusion.Exploration{ID: ID}); err != nil {
return op.NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound()
}
return op.NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent()
}

134
mock/mock.go Normal file
View File

@ -0,0 +1,134 @@
package mock
import (
"encoding/json"
"fmt"
"time"
"github.com/influxdata/mrfusion"
"golang.org/x/net/context"
)
type ExplorationStore struct {
db map[int]mrfusion.Exploration
NowFunc func() time.Time
}
func NewExplorationStore(nowFunc func() time.Time) mrfusion.ExplorationStore {
e := ExplorationStore{
NowFunc: nowFunc,
db: map[int]mrfusion.Exploration{},
}
e.db[1] = mrfusion.Exploration{
ID: 1,
Name: "Ferdinand Magellan",
UserID: 1,
Data: `"{"panels":{“123":{"id”:"123","queryIds":[“456"]}},"queryConfigs":{"456":{"id”:"456","database":null,"measurement":null,"retentionPolicy":null,"fields":[],"tags":{},"groupBy":{"time":null,"tags":[]},"areTagsAccepted":true,"rawText":null}}}"`,
CreatedAt: nowFunc(),
UpdatedAt: nowFunc(),
}
return &e
}
var DefaultExplorationStore mrfusion.ExplorationStore = NewExplorationStore(time.Now)
func (m *ExplorationStore) Query(ctx context.Context, userID int) ([]mrfusion.Exploration, error) {
res := []mrfusion.Exploration{}
for _, v := range m.db {
res = append(res, v)
}
return res, nil
}
func (m *ExplorationStore) Add(ctx context.Context, e mrfusion.Exploration) error {
e.CreatedAt = m.NowFunc()
e.UpdatedAt = m.NowFunc()
m.db[len(m.db)] = e
return nil
}
func (m *ExplorationStore) Delete(ctx context.Context, e mrfusion.Exploration) error {
delete(m.db, e.ID)
return nil
}
func (m *ExplorationStore) Get(ctx context.Context, ID int) (mrfusion.Exploration, error) {
e, ok := m.db[ID]
if !ok {
return mrfusion.Exploration{}, fmt.Errorf("Unknown ID %d", ID)
}
return e, nil
}
func (m *ExplorationStore) Update(ctx context.Context, e mrfusion.Exploration) error {
_, ok := m.db[e.ID]
if !ok {
return fmt.Errorf("Unknown ID %d", e.ID)
}
e.UpdatedAt = m.NowFunc()
m.db[e.ID] = e
return nil
}
type Row struct {
name string `json:"name,omitempty"`
tags map[string]string `json:"tags,omitempty"`
columns []string `json:"columns,omitempty"`
values [][]interface{} `json:"values,omitempty"`
}
func NewRow(row string) mrfusion.Row {
r := Row{}
json.Unmarshal([]byte(row), &r)
return &r
}
var SampleRow mrfusion.Row = NewRow(`{"name":"cpu","columns":["time","value"],"values":[["2000-01-01T01:00:00Z",1]]}`)
func (r *Row) Name() string {
return r.name
}
func (r *Row) Tags() map[string]string {
return r.tags
}
func (r *Row) Columns() []string {
return r.columns
}
func (r *Row) Values() [][]interface{} {
return r.values
}
type Result struct {
rows []mrfusion.Row
}
func NewResult(row mrfusion.Row) mrfusion.Result {
return &Result{
rows: []mrfusion.Row{row},
}
}
var SampleResult mrfusion.Result = NewResult(SampleRow)
func (r *Result) Series() ([]mrfusion.Row, error) {
return r.rows, nil
}
type Response struct {
results []mrfusion.Result
}
var SampleResponse mrfusion.Response = NewResponse(SampleResult)
func NewResponse(result mrfusion.Result) mrfusion.Response {
return &Response{
results: []mrfusion.Result{result},
}
}
func (r *Response) Results() ([]mrfusion.Result, error) {
return r.results, nil
}

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,144 @@
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/mock"
"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()
mockHandler := mock.NewHandler()
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.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler = operations.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(func(ctx context.Context, params operations.DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder {
return middleware.NotImplemented("operation .DeleteSourcesIDUsersUserIDExplorationsExplorationID 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.GetSourcesIDUsersUserIDExplorationsExplorationIDHandler = operations.GetSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(mockHandler.Exploration)
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(mockHandler.Explorations)
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.PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler = operations.PatchSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(func(ctx context.Context, params operations.PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder {
return middleware.NotImplemented("operation .PatchSourcesIDUsersUserIDExplorationsExplorationID 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(mockHandler.Proxy)
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

13
restapi/embedded_spec.go Normal file

File diff suppressed because one or more lines are too long

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"
)
// 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,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"
)
// DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc turns a function with the right signature into a delete sources ID users user ID explorations exploration ID handler
type DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc func(context.Context, DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc) Handle(ctx context.Context, params DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler interface for that can handle valid delete sources ID users user ID explorations exploration ID params
type DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler interface {
Handle(context.Context, DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder
}
// NewDeleteSourcesIDUsersUserIDExplorationsExplorationID creates a new http.Handler for the delete sources ID users user ID explorations exploration ID operation
func NewDeleteSourcesIDUsersUserIDExplorationsExplorationID(ctx *middleware.Context, handler DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler) *DeleteSourcesIDUsersUserIDExplorationsExplorationID {
return &DeleteSourcesIDUsersUserIDExplorationsExplorationID{Context: ctx, Handler: handler}
}
/*DeleteSourcesIDUsersUserIDExplorationsExplorationID swagger:route DELETE /sources/{id}/users/{user_id}/explorations/{exploration_id} deleteSourcesIdUsersUserIdExplorationsExplorationId
This specific exporer session will be removed.
*/
type DeleteSourcesIDUsersUserIDExplorationsExplorationID struct {
Context *middleware.Context
Handler DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler
}
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDParams()
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"
)
// NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDParams creates a new DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams object
// with the default values initialized.
func NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDParams() DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams {
var ()
return DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams{}
}
// DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams contains all the bound params for the delete sources ID users user ID explorations exploration ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteSourcesIDUsersUserIDExplorationsExplorationID
type DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams 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 *DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *DeleteSourcesIDUsersUserIDExplorationsExplorationIDParams) 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"
)
/*DeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent Exploration session has been removed
swagger:response deleteSourcesIdUsersUserIdExplorationsExplorationIdNoContent
*/
type DeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent struct {
}
// NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent creates DeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent with default headers values
func NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent() *DeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent {
return &DeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent{}
}
// WriteResponse to the client
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound Data source id, user, or exploration does not exist.
swagger:response deleteSourcesIdUsersUserIdExplorationsExplorationIdNotFound
*/
type DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound creates DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound with default headers values
func NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound() *DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound {
return &DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound{}
}
// WithPayload adds the payload to the delete sources Id users user Id explorations exploration Id not found response
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound) WithPayload(payload *models.Error) *DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources Id users user Id explorations exploration Id not found response
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound) 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
}
}
}
/*DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault Unexpected internal service error
swagger:response deleteSourcesIdUsersUserIdExplorationsExplorationIdDefault
*/
type DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault creates DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault with default headers values
func NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault(code int) *DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault {
if code <= 0 {
code = 500
}
return &DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete sources ID users user ID explorations exploration ID default response
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault) WithStatusCode(code int) *DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete sources ID users user ID explorations exploration ID default response
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete sources ID users user ID explorations exploration ID default response
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault) WithPayload(payload *models.Error) *DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources ID users user ID explorations exploration ID default response
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault) 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"
)
// 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,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,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"
)
// GetSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc turns a function with the right signature into a get sources ID users user ID explorations exploration ID handler
type GetSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc func(context.Context, GetSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc) Handle(ctx context.Context, params GetSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDUsersUserIDExplorationsExplorationIDHandler interface for that can handle valid get sources ID users user ID explorations exploration ID params
type GetSourcesIDUsersUserIDExplorationsExplorationIDHandler interface {
Handle(context.Context, GetSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder
}
// NewGetSourcesIDUsersUserIDExplorationsExplorationID creates a new http.Handler for the get sources ID users user ID explorations exploration ID operation
func NewGetSourcesIDUsersUserIDExplorationsExplorationID(ctx *middleware.Context, handler GetSourcesIDUsersUserIDExplorationsExplorationIDHandler) *GetSourcesIDUsersUserIDExplorationsExplorationID {
return &GetSourcesIDUsersUserIDExplorationsExplorationID{Context: ctx, Handler: handler}
}
/*GetSourcesIDUsersUserIDExplorationsExplorationID swagger:route GET /sources/{id}/users/{user_id}/explorations/{exploration_id} getSourcesIdUsersUserIdExplorationsExplorationId
Returns the specified data exploration session
A data exploration session specifies query information.
*/
type GetSourcesIDUsersUserIDExplorationsExplorationID struct {
Context *middleware.Context
Handler GetSourcesIDUsersUserIDExplorationsExplorationIDHandler
}
func (o *GetSourcesIDUsersUserIDExplorationsExplorationID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDUsersUserIDExplorationsExplorationIDParams()
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"
)
// NewGetSourcesIDUsersUserIDExplorationsExplorationIDParams creates a new GetSourcesIDUsersUserIDExplorationsExplorationIDParams object
// with the default values initialized.
func NewGetSourcesIDUsersUserIDExplorationsExplorationIDParams() GetSourcesIDUsersUserIDExplorationsExplorationIDParams {
var ()
return GetSourcesIDUsersUserIDExplorationsExplorationIDParams{}
}
// GetSourcesIDUsersUserIDExplorationsExplorationIDParams contains all the bound params for the get sources ID users user ID explorations exploration ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDUsersUserIDExplorationsExplorationID
type GetSourcesIDUsersUserIDExplorationsExplorationIDParams 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 *GetSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *GetSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *GetSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *GetSourcesIDUsersUserIDExplorationsExplorationIDParams) 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"
)
/*GetSourcesIDUsersUserIDExplorationsExplorationIDOK Information relating to the exploration
swagger:response getSourcesIdUsersUserIdExplorationsExplorationIdOK
*/
type GetSourcesIDUsersUserIDExplorationsExplorationIDOK struct {
// In: body
Payload *models.Exploration `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDExplorationsExplorationIDOK creates GetSourcesIDUsersUserIDExplorationsExplorationIDOK with default headers values
func NewGetSourcesIDUsersUserIDExplorationsExplorationIDOK() *GetSourcesIDUsersUserIDExplorationsExplorationIDOK {
return &GetSourcesIDUsersUserIDExplorationsExplorationIDOK{}
}
// WithPayload adds the payload to the get sources Id users user Id explorations exploration Id o k response
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDOK) WithPayload(payload *models.Exploration) *GetSourcesIDUsersUserIDExplorationsExplorationIDOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id users user Id explorations exploration Id o k response
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDOK) SetPayload(payload *models.Exploration) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDOK) 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
}
}
}
/*GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound Data source id, user, or exploration does not exist.
swagger:response getSourcesIdUsersUserIdExplorationsExplorationIdNotFound
*/
type GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDExplorationsExplorationIDNotFound creates GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound with default headers values
func NewGetSourcesIDUsersUserIDExplorationsExplorationIDNotFound() *GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound {
return &GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound{}
}
// WithPayload adds the payload to the get sources Id users user Id explorations exploration Id not found response
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound) WithPayload(payload *models.Error) *GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id users user Id explorations exploration Id not found response
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDNotFound) 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
}
}
}
/*GetSourcesIDUsersUserIDExplorationsExplorationIDDefault Unexpected internal service error
swagger:response getSourcesIdUsersUserIdExplorationsExplorationIdDefault
*/
type GetSourcesIDUsersUserIDExplorationsExplorationIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDUsersUserIDExplorationsExplorationIDDefault creates GetSourcesIDUsersUserIDExplorationsExplorationIDDefault with default headers values
func NewGetSourcesIDUsersUserIDExplorationsExplorationIDDefault(code int) *GetSourcesIDUsersUserIDExplorationsExplorationIDDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDUsersUserIDExplorationsExplorationIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID users user ID explorations exploration ID default response
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDDefault) WithStatusCode(code int) *GetSourcesIDUsersUserIDExplorationsExplorationIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID users user ID explorations exploration ID default response
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID users user ID explorations exploration ID default response
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDDefault) WithPayload(payload *models.Error) *GetSourcesIDUsersUserIDExplorationsExplorationIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID users user ID explorations exploration ID default response
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDUsersUserIDExplorationsExplorationIDDefault) 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"
)
// 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
// DeleteSourcesIDUsersUserIDHandler sets the operation handler for the delete sources ID users user ID operation
DeleteSourcesIDUsersUserIDHandler DeleteSourcesIDUsersUserIDHandler
// DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler sets the operation handler for the delete sources ID users user ID explorations exploration ID operation
DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler
// 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
// 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
// GetSourcesIDUsersUserIDExplorationsExplorationIDHandler sets the operation handler for the get sources ID users user ID explorations exploration ID operation
GetSourcesIDUsersUserIDExplorationsExplorationIDHandler GetSourcesIDUsersUserIDExplorationsExplorationIDHandler
// 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
// PatchSourcesIDUsersUserIDHandler sets the operation handler for the patch sources ID users user ID operation
PatchSourcesIDUsersUserIDHandler PatchSourcesIDUsersUserIDHandler
// PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler sets the operation handler for the patch sources ID users user ID explorations exploration ID operation
PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler
// 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.DeleteSourcesIDUsersUserIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDUsersUserIDHandler")
}
if o.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler")
}
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.GetSourcesIDUsersHandler == nil {
unregistered = append(unregistered, "GetSourcesIDUsersHandler")
}
if o.GetSourcesIDUsersUserIDHandler == nil {
unregistered = append(unregistered, "GetSourcesIDUsersUserIDHandler")
}
if o.GetSourcesIDUsersUserIDExplorationsHandler == nil {
unregistered = append(unregistered, "GetSourcesIDUsersUserIDExplorationsHandler")
}
if o.GetSourcesIDUsersUserIDExplorationsExplorationIDHandler == nil {
unregistered = append(unregistered, "GetSourcesIDUsersUserIDExplorationsExplorationIDHandler")
}
if o.PatchSourcesIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDHandler")
}
if o.PatchSourcesIDRolesRoleIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDRolesRoleIDHandler")
}
if o.PatchSourcesIDUsersUserIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDUsersUserIDHandler")
}
if o.PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler")
}
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}/users/{user_id}"] = NewDeleteSourcesIDUsersUserID(o.context, o.DeleteSourcesIDUsersUserIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/sources/{id}/users/{user_id}/explorations/{exploration_id}"] = NewDeleteSourcesIDUsersUserIDExplorationsExplorationID(o.context, o.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler)
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}/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["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/users/{user_id}/explorations/{exploration_id}"] = NewGetSourcesIDUsersUserIDExplorationsExplorationID(o.context, o.GetSourcesIDUsersUserIDExplorationsExplorationIDHandler)
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}/users/{user_id}"] = NewPatchSourcesIDUsersUserID(o.context, o.PatchSourcesIDUsersUserIDHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/sources/{id}/users/{user_id}/explorations/{exploration_id}"] = NewPatchSourcesIDUsersUserIDExplorationsExplorationID(o.context, o.PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler)
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"
)
// 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,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"
)
// PatchSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc turns a function with the right signature into a patch sources ID users user ID explorations exploration ID handler
type PatchSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc func(context.Context, PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc) Handle(ctx context.Context, params PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder {
return fn(ctx, params)
}
// PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler interface for that can handle valid patch sources ID users user ID explorations exploration ID params
type PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler interface {
Handle(context.Context, PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) middleware.Responder
}
// NewPatchSourcesIDUsersUserIDExplorationsExplorationID creates a new http.Handler for the patch sources ID users user ID explorations exploration ID operation
func NewPatchSourcesIDUsersUserIDExplorationsExplorationID(ctx *middleware.Context, handler PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler) *PatchSourcesIDUsersUserIDExplorationsExplorationID {
return &PatchSourcesIDUsersUserIDExplorationsExplorationID{Context: ctx, Handler: handler}
}
/*PatchSourcesIDUsersUserIDExplorationsExplorationID swagger:route PATCH /sources/{id}/users/{user_id}/explorations/{exploration_id} patchSourcesIdUsersUserIdExplorationsExplorationId
Update exploration configuration
*/
type PatchSourcesIDUsersUserIDExplorationsExplorationID struct {
Context *middleware.Context
Handler PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler
}
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchSourcesIDUsersUserIDExplorationsExplorationIDParams()
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"
)
// NewPatchSourcesIDUsersUserIDExplorationsExplorationIDParams creates a new PatchSourcesIDUsersUserIDExplorationsExplorationIDParams object
// with the default values initialized.
func NewPatchSourcesIDUsersUserIDExplorationsExplorationIDParams() PatchSourcesIDUsersUserIDExplorationsExplorationIDParams {
var ()
return PatchSourcesIDUsersUserIDExplorationsExplorationIDParams{}
}
// PatchSourcesIDUsersUserIDExplorationsExplorationIDParams contains all the bound params for the patch sources ID users user ID explorations exploration ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters PatchSourcesIDUsersUserIDExplorationsExplorationID
type PatchSourcesIDUsersUserIDExplorationsExplorationIDParams 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 *PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) 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 *PatchSourcesIDUsersUserIDExplorationsExplorationIDParams) 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"
)
/*PatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent Exploration's configuration was changed
swagger:response patchSourcesIdUsersUserIdExplorationsExplorationIdNoContent
*/
type PatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent struct {
}
// NewPatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent creates PatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent with default headers values
func NewPatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent() *PatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent {
return &PatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent{}
}
// WriteResponse to the client
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound Data source id, user, or exploration does not exist.
swagger:response patchSourcesIdUsersUserIdExplorationsExplorationIdNotFound
*/
type PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound creates PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound with default headers values
func NewPatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound() *PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound {
return &PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound{}
}
// WithPayload adds the payload to the patch sources Id users user Id explorations exploration Id not found response
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound) WithPayload(payload *models.Error) *PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources Id users user Id explorations exploration Id not found response
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound) 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
}
}
}
/*PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault A processing or an unexpected error.
swagger:response patchSourcesIdUsersUserIdExplorationsExplorationIdDefault
*/
type PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDUsersUserIDExplorationsExplorationIDDefault creates PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault with default headers values
func NewPatchSourcesIDUsersUserIDExplorationsExplorationIDDefault(code int) *PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault {
if code <= 0 {
code = 500
}
return &PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch sources ID users user ID explorations exploration ID default response
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault) WithStatusCode(code int) *PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch sources ID users user ID explorations exploration ID default response
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch sources ID users user ID explorations exploration ID default response
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault) WithPayload(payload *models.Error) *PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources ID users user ID explorations exploration ID default response
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDUsersUserIDExplorationsExplorationIDDefault) 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,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)
}

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