influxdb/restapi/operations/post_sources_id_users.go

56 lines
1.8 KiB
Go

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