...

Source file src/github.com/prometheus/alertmanager/api/v2/restapi/operations/alertgroup/get_alert_groups.go

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

     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 alertgroup
    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  // GetAlertGroupsHandlerFunc turns a function with the right signature into a get alert groups handler
    29  type GetAlertGroupsHandlerFunc func(GetAlertGroupsParams) middleware.Responder
    30  
    31  // Handle executing the request and returning a response
    32  func (fn GetAlertGroupsHandlerFunc) Handle(params GetAlertGroupsParams) middleware.Responder {
    33  	return fn(params)
    34  }
    35  
    36  // GetAlertGroupsHandler interface for that can handle valid get alert groups params
    37  type GetAlertGroupsHandler interface {
    38  	Handle(GetAlertGroupsParams) middleware.Responder
    39  }
    40  
    41  // NewGetAlertGroups creates a new http.Handler for the get alert groups operation
    42  func NewGetAlertGroups(ctx *middleware.Context, handler GetAlertGroupsHandler) *GetAlertGroups {
    43  	return &GetAlertGroups{Context: ctx, Handler: handler}
    44  }
    45  
    46  /*
    47  	GetAlertGroups swagger:route GET /alerts/groups alertgroup getAlertGroups
    48  
    49  Get a list of alert groups
    50  */
    51  type GetAlertGroups struct {
    52  	Context *middleware.Context
    53  	Handler GetAlertGroupsHandler
    54  }
    55  
    56  func (o *GetAlertGroups) 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 = NewGetAlertGroupsParams()
    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