...

Source file src/github.com/prometheus/alertmanager/api/v2/restapi/operations/receiver/get_receivers_responses.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 swagger generate command
    21  
    22  import (
    23  	"net/http"
    24  
    25  	"github.com/go-openapi/runtime"
    26  
    27  	"github.com/prometheus/alertmanager/api/v2/models"
    28  )
    29  
    30  // GetReceiversOKCode is the HTTP code returned for type GetReceiversOK
    31  const GetReceiversOKCode int = 200
    32  
    33  /*
    34  GetReceiversOK Get receivers response
    35  
    36  swagger:response getReceiversOK
    37  */
    38  type GetReceiversOK struct {
    39  
    40  	/*
    41  	  In: Body
    42  	*/
    43  	Payload []*models.Receiver `json:"body,omitempty"`
    44  }
    45  
    46  // NewGetReceiversOK creates GetReceiversOK with default headers values
    47  func NewGetReceiversOK() *GetReceiversOK {
    48  
    49  	return &GetReceiversOK{}
    50  }
    51  
    52  // WithPayload adds the payload to the get receivers o k response
    53  func (o *GetReceiversOK) WithPayload(payload []*models.Receiver) *GetReceiversOK {
    54  	o.Payload = payload
    55  	return o
    56  }
    57  
    58  // SetPayload sets the payload to the get receivers o k response
    59  func (o *GetReceiversOK) SetPayload(payload []*models.Receiver) {
    60  	o.Payload = payload
    61  }
    62  
    63  // WriteResponse to the client
    64  func (o *GetReceiversOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    65  
    66  	rw.WriteHeader(200)
    67  	payload := o.Payload
    68  	if payload == nil {
    69  		// return empty array
    70  		payload = make([]*models.Receiver, 0, 50)
    71  	}
    72  
    73  	if err := producer.Produce(rw, payload); err != nil {
    74  		panic(err) // let the recovery middleware deal with this
    75  	}
    76  }
    77  

View as plain text