...

Source file src/github.com/prometheus/alertmanager/api/v2/restapi/operations/silence/get_silence_responses.go

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

     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 silence
    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  // GetSilenceOKCode is the HTTP code returned for type GetSilenceOK
    31  const GetSilenceOKCode int = 200
    32  
    33  /*
    34  GetSilenceOK Get silence response
    35  
    36  swagger:response getSilenceOK
    37  */
    38  type GetSilenceOK struct {
    39  
    40  	/*
    41  	  In: Body
    42  	*/
    43  	Payload *models.GettableSilence `json:"body,omitempty"`
    44  }
    45  
    46  // NewGetSilenceOK creates GetSilenceOK with default headers values
    47  func NewGetSilenceOK() *GetSilenceOK {
    48  
    49  	return &GetSilenceOK{}
    50  }
    51  
    52  // WithPayload adds the payload to the get silence o k response
    53  func (o *GetSilenceOK) WithPayload(payload *models.GettableSilence) *GetSilenceOK {
    54  	o.Payload = payload
    55  	return o
    56  }
    57  
    58  // SetPayload sets the payload to the get silence o k response
    59  func (o *GetSilenceOK) SetPayload(payload *models.GettableSilence) {
    60  	o.Payload = payload
    61  }
    62  
    63  // WriteResponse to the client
    64  func (o *GetSilenceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    65  
    66  	rw.WriteHeader(200)
    67  	if o.Payload != nil {
    68  		payload := o.Payload
    69  		if err := producer.Produce(rw, payload); err != nil {
    70  			panic(err) // let the recovery middleware deal with this
    71  		}
    72  	}
    73  }
    74  
    75  // GetSilenceNotFoundCode is the HTTP code returned for type GetSilenceNotFound
    76  const GetSilenceNotFoundCode int = 404
    77  
    78  /*
    79  GetSilenceNotFound A silence with the specified ID was not found
    80  
    81  swagger:response getSilenceNotFound
    82  */
    83  type GetSilenceNotFound struct {
    84  }
    85  
    86  // NewGetSilenceNotFound creates GetSilenceNotFound with default headers values
    87  func NewGetSilenceNotFound() *GetSilenceNotFound {
    88  
    89  	return &GetSilenceNotFound{}
    90  }
    91  
    92  // WriteResponse to the client
    93  func (o *GetSilenceNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    94  
    95  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    96  
    97  	rw.WriteHeader(404)
    98  }
    99  
   100  // GetSilenceInternalServerErrorCode is the HTTP code returned for type GetSilenceInternalServerError
   101  const GetSilenceInternalServerErrorCode int = 500
   102  
   103  /*
   104  GetSilenceInternalServerError Internal server error
   105  
   106  swagger:response getSilenceInternalServerError
   107  */
   108  type GetSilenceInternalServerError struct {
   109  
   110  	/*
   111  	  In: Body
   112  	*/
   113  	Payload string `json:"body,omitempty"`
   114  }
   115  
   116  // NewGetSilenceInternalServerError creates GetSilenceInternalServerError with default headers values
   117  func NewGetSilenceInternalServerError() *GetSilenceInternalServerError {
   118  
   119  	return &GetSilenceInternalServerError{}
   120  }
   121  
   122  // WithPayload adds the payload to the get silence internal server error response
   123  func (o *GetSilenceInternalServerError) WithPayload(payload string) *GetSilenceInternalServerError {
   124  	o.Payload = payload
   125  	return o
   126  }
   127  
   128  // SetPayload sets the payload to the get silence internal server error response
   129  func (o *GetSilenceInternalServerError) SetPayload(payload string) {
   130  	o.Payload = payload
   131  }
   132  
   133  // WriteResponse to the client
   134  func (o *GetSilenceInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   135  
   136  	rw.WriteHeader(500)
   137  	payload := o.Payload
   138  	if err := producer.Produce(rw, payload); err != nil {
   139  		panic(err) // let the recovery middleware deal with this
   140  	}
   141  }
   142  

View as plain text