...

Source file src/github.com/prometheus/alertmanager/api/v2/restapi/operations/receiver/get_receivers.go

Documentation: github.com/prometheus/alertmanager/api/v2/restapi/operations/receiver

     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 receiver
    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  // GetReceiversHandlerFunc turns a function with the right signature into a get receivers handler
    29  type GetReceiversHandlerFunc func(GetReceiversParams) middleware.Responder
    30  
    31  // Handle executing the request and returning a response
    32  func (fn GetReceiversHandlerFunc) Handle(params GetReceiversParams) middleware.Responder {
    33  	return fn(params)
    34  }
    35  
    36  // GetReceiversHandler interface for that can handle valid get receivers params
    37  type GetReceiversHandler interface {
    38  	Handle(GetReceiversParams) middleware.Responder
    39  }
    40  
    41  // NewGetReceivers creates a new http.Handler for the get receivers operation
    42  func NewGetReceivers(ctx *middleware.Context, handler GetReceiversHandler) *GetReceivers {
    43  	return &GetReceivers{Context: ctx, Handler: handler}
    44  }
    45  
    46  /*
    47  	GetReceivers swagger:route GET /receivers receiver getReceivers
    48  
    49  Get list of all receivers (name of notification integrations)
    50  */
    51  type GetReceivers struct {
    52  	Context *middleware.Context
    53  	Handler GetReceiversHandler
    54  }
    55  
    56  func (o *GetReceivers) 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 = NewGetReceiversParams()
    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  

View as plain text