influxdb/restapi/operations/patch_sources_id.go

56 lines
1.7 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"
)
// 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)
}