...

Source file src/github.com/prometheus/alertmanager/api/v2/restapi/operations/alert/post_alerts_responses.go

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

     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 alert
    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  // PostAlertsOKCode is the HTTP code returned for type PostAlertsOK
    29  const PostAlertsOKCode int = 200
    30  
    31  /*
    32  PostAlertsOK Create alerts response
    33  
    34  swagger:response postAlertsOK
    35  */
    36  type PostAlertsOK struct {
    37  }
    38  
    39  // NewPostAlertsOK creates PostAlertsOK with default headers values
    40  func NewPostAlertsOK() *PostAlertsOK {
    41  
    42  	return &PostAlertsOK{}
    43  }
    44  
    45  // WriteResponse to the client
    46  func (o *PostAlertsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    47  
    48  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    49  
    50  	rw.WriteHeader(200)
    51  }
    52  
    53  // PostAlertsBadRequestCode is the HTTP code returned for type PostAlertsBadRequest
    54  const PostAlertsBadRequestCode int = 400
    55  
    56  /*
    57  PostAlertsBadRequest Bad request
    58  
    59  swagger:response postAlertsBadRequest
    60  */
    61  type PostAlertsBadRequest struct {
    62  
    63  	/*
    64  	  In: Body
    65  	*/
    66  	Payload string `json:"body,omitempty"`
    67  }
    68  
    69  // NewPostAlertsBadRequest creates PostAlertsBadRequest with default headers values
    70  func NewPostAlertsBadRequest() *PostAlertsBadRequest {
    71  
    72  	return &PostAlertsBadRequest{}
    73  }
    74  
    75  // WithPayload adds the payload to the post alerts bad request response
    76  func (o *PostAlertsBadRequest) WithPayload(payload string) *PostAlertsBadRequest {
    77  	o.Payload = payload
    78  	return o
    79  }
    80  
    81  // SetPayload sets the payload to the post alerts bad request response
    82  func (o *PostAlertsBadRequest) SetPayload(payload string) {
    83  	o.Payload = payload
    84  }
    85  
    86  // WriteResponse to the client
    87  func (o *PostAlertsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    88  
    89  	rw.WriteHeader(400)
    90  	payload := o.Payload
    91  	if err := producer.Produce(rw, payload); err != nil {
    92  		panic(err) // let the recovery middleware deal with this
    93  	}
    94  }
    95  
    96  // PostAlertsInternalServerErrorCode is the HTTP code returned for type PostAlertsInternalServerError
    97  const PostAlertsInternalServerErrorCode int = 500
    98  
    99  /*
   100  PostAlertsInternalServerError Internal server error
   101  
   102  swagger:response postAlertsInternalServerError
   103  */
   104  type PostAlertsInternalServerError struct {
   105  
   106  	/*
   107  	  In: Body
   108  	*/
   109  	Payload string `json:"body,omitempty"`
   110  }
   111  
   112  // NewPostAlertsInternalServerError creates PostAlertsInternalServerError with default headers values
   113  func NewPostAlertsInternalServerError() *PostAlertsInternalServerError {
   114  
   115  	return &PostAlertsInternalServerError{}
   116  }
   117  
   118  // WithPayload adds the payload to the post alerts internal server error response
   119  func (o *PostAlertsInternalServerError) WithPayload(payload string) *PostAlertsInternalServerError {
   120  	o.Payload = payload
   121  	return o
   122  }
   123  
   124  // SetPayload sets the payload to the post alerts internal server error response
   125  func (o *PostAlertsInternalServerError) SetPayload(payload string) {
   126  	o.Payload = payload
   127  }
   128  
   129  // WriteResponse to the client
   130  func (o *PostAlertsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   131  
   132  	rw.WriteHeader(500)
   133  	payload := o.Payload
   134  	if err := producer.Produce(rw, payload); err != nil {
   135  		panic(err) // let the recovery middleware deal with this
   136  	}
   137  }
   138  

View as plain text