1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Prometheus Team 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 package alert 18 19 // This file was generated by the swagger tool. 20 // Editing this file might prove futile when you re-run the generate command 21 22 import ( 23 "net/http" 24 25 "github.com/go-openapi/runtime/middleware" 26 ) 27 28 // GetAlertsHandlerFunc turns a function with the right signature into a get alerts handler 29 type GetAlertsHandlerFunc func(GetAlertsParams) middleware.Responder 30 31 // Handle executing the request and returning a response 32 func (fn GetAlertsHandlerFunc) Handle(params GetAlertsParams) middleware.Responder { 33 return fn(params) 34 } 35 36 // GetAlertsHandler interface for that can handle valid get alerts params 37 type GetAlertsHandler interface { 38 Handle(GetAlertsParams) middleware.Responder 39 } 40 41 // NewGetAlerts creates a new http.Handler for the get alerts operation 42 func NewGetAlerts(ctx *middleware.Context, handler GetAlertsHandler) *GetAlerts { 43 return &GetAlerts{Context: ctx, Handler: handler} 44 } 45 46 /* 47 GetAlerts swagger:route GET /alerts alert getAlerts 48 49 Get a list of alerts 50 */ 51 type GetAlerts struct { 52 Context *middleware.Context 53 Handler GetAlertsHandler 54 } 55 56 func (o *GetAlerts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 57 route, rCtx, _ := o.Context.RouteInfo(r) 58 if rCtx != nil { 59 *r = *rCtx 60 } 61 var Params = NewGetAlertsParams() 62 if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 63 o.Context.Respond(rw, r, route.Produces, route, err) 64 return 65 } 66 67 res := o.Handler.Handle(Params) // actually handle the request 68 o.Context.Respond(rw, r, route.Produces, route, res) 69 70 } 71