...

Source file src/github.com/prometheus/alertmanager/api/v2/restapi/operations/silence/post_silences_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  
    28  // PostSilencesOKCode is the HTTP code returned for type PostSilencesOK
    29  const PostSilencesOKCode int = 200
    30  
    31  /*
    32  PostSilencesOK Create / update silence response
    33  
    34  swagger:response postSilencesOK
    35  */
    36  type PostSilencesOK struct {
    37  
    38  	/*
    39  	  In: Body
    40  	*/
    41  	Payload *PostSilencesOKBody `json:"body,omitempty"`
    42  }
    43  
    44  // NewPostSilencesOK creates PostSilencesOK with default headers values
    45  func NewPostSilencesOK() *PostSilencesOK {
    46  
    47  	return &PostSilencesOK{}
    48  }
    49  
    50  // WithPayload adds the payload to the post silences o k response
    51  func (o *PostSilencesOK) WithPayload(payload *PostSilencesOKBody) *PostSilencesOK {
    52  	o.Payload = payload
    53  	return o
    54  }
    55  
    56  // SetPayload sets the payload to the post silences o k response
    57  func (o *PostSilencesOK) SetPayload(payload *PostSilencesOKBody) {
    58  	o.Payload = payload
    59  }
    60  
    61  // WriteResponse to the client
    62  func (o *PostSilencesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    63  
    64  	rw.WriteHeader(200)
    65  	if o.Payload != nil {
    66  		payload := o.Payload
    67  		if err := producer.Produce(rw, payload); err != nil {
    68  			panic(err) // let the recovery middleware deal with this
    69  		}
    70  	}
    71  }
    72  
    73  // PostSilencesBadRequestCode is the HTTP code returned for type PostSilencesBadRequest
    74  const PostSilencesBadRequestCode int = 400
    75  
    76  /*
    77  PostSilencesBadRequest Bad request
    78  
    79  swagger:response postSilencesBadRequest
    80  */
    81  type PostSilencesBadRequest struct {
    82  
    83  	/*
    84  	  In: Body
    85  	*/
    86  	Payload string `json:"body,omitempty"`
    87  }
    88  
    89  // NewPostSilencesBadRequest creates PostSilencesBadRequest with default headers values
    90  func NewPostSilencesBadRequest() *PostSilencesBadRequest {
    91  
    92  	return &PostSilencesBadRequest{}
    93  }
    94  
    95  // WithPayload adds the payload to the post silences bad request response
    96  func (o *PostSilencesBadRequest) WithPayload(payload string) *PostSilencesBadRequest {
    97  	o.Payload = payload
    98  	return o
    99  }
   100  
   101  // SetPayload sets the payload to the post silences bad request response
   102  func (o *PostSilencesBadRequest) SetPayload(payload string) {
   103  	o.Payload = payload
   104  }
   105  
   106  // WriteResponse to the client
   107  func (o *PostSilencesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   108  
   109  	rw.WriteHeader(400)
   110  	payload := o.Payload
   111  	if err := producer.Produce(rw, payload); err != nil {
   112  		panic(err) // let the recovery middleware deal with this
   113  	}
   114  }
   115  
   116  // PostSilencesNotFoundCode is the HTTP code returned for type PostSilencesNotFound
   117  const PostSilencesNotFoundCode int = 404
   118  
   119  /*
   120  PostSilencesNotFound A silence with the specified ID was not found
   121  
   122  swagger:response postSilencesNotFound
   123  */
   124  type PostSilencesNotFound struct {
   125  
   126  	/*
   127  	  In: Body
   128  	*/
   129  	Payload string `json:"body,omitempty"`
   130  }
   131  
   132  // NewPostSilencesNotFound creates PostSilencesNotFound with default headers values
   133  func NewPostSilencesNotFound() *PostSilencesNotFound {
   134  
   135  	return &PostSilencesNotFound{}
   136  }
   137  
   138  // WithPayload adds the payload to the post silences not found response
   139  func (o *PostSilencesNotFound) WithPayload(payload string) *PostSilencesNotFound {
   140  	o.Payload = payload
   141  	return o
   142  }
   143  
   144  // SetPayload sets the payload to the post silences not found response
   145  func (o *PostSilencesNotFound) SetPayload(payload string) {
   146  	o.Payload = payload
   147  }
   148  
   149  // WriteResponse to the client
   150  func (o *PostSilencesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   151  
   152  	rw.WriteHeader(404)
   153  	payload := o.Payload
   154  	if err := producer.Produce(rw, payload); err != nil {
   155  		panic(err) // let the recovery middleware deal with this
   156  	}
   157  }
   158  

View as plain text