...

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

Documentation: github.com/prometheus/alertmanager/api/v2/client/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  	"fmt"
    24  	"io"
    25  
    26  	"github.com/go-openapi/runtime"
    27  	"github.com/go-openapi/strfmt"
    28  )
    29  
    30  // PostAlertsReader is a Reader for the PostAlerts structure.
    31  type PostAlertsReader struct {
    32  	formats strfmt.Registry
    33  }
    34  
    35  // ReadResponse reads a server response into the received o.
    36  func (o *PostAlertsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    37  	switch response.Code() {
    38  	case 200:
    39  		result := NewPostAlertsOK()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return result, nil
    44  	case 400:
    45  		result := NewPostAlertsBadRequest()
    46  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    47  			return nil, err
    48  		}
    49  		return nil, result
    50  	case 500:
    51  		result := NewPostAlertsInternalServerError()
    52  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    53  			return nil, err
    54  		}
    55  		return nil, result
    56  	default:
    57  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    58  	}
    59  }
    60  
    61  // NewPostAlertsOK creates a PostAlertsOK with default headers values
    62  func NewPostAlertsOK() *PostAlertsOK {
    63  	return &PostAlertsOK{}
    64  }
    65  
    66  /*
    67  PostAlertsOK describes a response with status code 200, with default header values.
    68  
    69  Create alerts response
    70  */
    71  type PostAlertsOK struct {
    72  }
    73  
    74  // IsSuccess returns true when this post alerts o k response has a 2xx status code
    75  func (o *PostAlertsOK) IsSuccess() bool {
    76  	return true
    77  }
    78  
    79  // IsRedirect returns true when this post alerts o k response has a 3xx status code
    80  func (o *PostAlertsOK) IsRedirect() bool {
    81  	return false
    82  }
    83  
    84  // IsClientError returns true when this post alerts o k response has a 4xx status code
    85  func (o *PostAlertsOK) IsClientError() bool {
    86  	return false
    87  }
    88  
    89  // IsServerError returns true when this post alerts o k response has a 5xx status code
    90  func (o *PostAlertsOK) IsServerError() bool {
    91  	return false
    92  }
    93  
    94  // IsCode returns true when this post alerts o k response a status code equal to that given
    95  func (o *PostAlertsOK) IsCode(code int) bool {
    96  	return code == 200
    97  }
    98  
    99  func (o *PostAlertsOK) Error() string {
   100  	return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200)
   101  }
   102  
   103  func (o *PostAlertsOK) String() string {
   104  	return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200)
   105  }
   106  
   107  func (o *PostAlertsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   108  
   109  	return nil
   110  }
   111  
   112  // NewPostAlertsBadRequest creates a PostAlertsBadRequest with default headers values
   113  func NewPostAlertsBadRequest() *PostAlertsBadRequest {
   114  	return &PostAlertsBadRequest{}
   115  }
   116  
   117  /*
   118  PostAlertsBadRequest describes a response with status code 400, with default header values.
   119  
   120  Bad request
   121  */
   122  type PostAlertsBadRequest struct {
   123  	Payload string
   124  }
   125  
   126  // IsSuccess returns true when this post alerts bad request response has a 2xx status code
   127  func (o *PostAlertsBadRequest) IsSuccess() bool {
   128  	return false
   129  }
   130  
   131  // IsRedirect returns true when this post alerts bad request response has a 3xx status code
   132  func (o *PostAlertsBadRequest) IsRedirect() bool {
   133  	return false
   134  }
   135  
   136  // IsClientError returns true when this post alerts bad request response has a 4xx status code
   137  func (o *PostAlertsBadRequest) IsClientError() bool {
   138  	return true
   139  }
   140  
   141  // IsServerError returns true when this post alerts bad request response has a 5xx status code
   142  func (o *PostAlertsBadRequest) IsServerError() bool {
   143  	return false
   144  }
   145  
   146  // IsCode returns true when this post alerts bad request response a status code equal to that given
   147  func (o *PostAlertsBadRequest) IsCode(code int) bool {
   148  	return code == 400
   149  }
   150  
   151  func (o *PostAlertsBadRequest) Error() string {
   152  	return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest  %+v", 400, o.Payload)
   153  }
   154  
   155  func (o *PostAlertsBadRequest) String() string {
   156  	return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest  %+v", 400, o.Payload)
   157  }
   158  
   159  func (o *PostAlertsBadRequest) GetPayload() string {
   160  	return o.Payload
   161  }
   162  
   163  func (o *PostAlertsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   164  
   165  	// response payload
   166  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   167  		return err
   168  	}
   169  
   170  	return nil
   171  }
   172  
   173  // NewPostAlertsInternalServerError creates a PostAlertsInternalServerError with default headers values
   174  func NewPostAlertsInternalServerError() *PostAlertsInternalServerError {
   175  	return &PostAlertsInternalServerError{}
   176  }
   177  
   178  /*
   179  PostAlertsInternalServerError describes a response with status code 500, with default header values.
   180  
   181  Internal server error
   182  */
   183  type PostAlertsInternalServerError struct {
   184  	Payload string
   185  }
   186  
   187  // IsSuccess returns true when this post alerts internal server error response has a 2xx status code
   188  func (o *PostAlertsInternalServerError) IsSuccess() bool {
   189  	return false
   190  }
   191  
   192  // IsRedirect returns true when this post alerts internal server error response has a 3xx status code
   193  func (o *PostAlertsInternalServerError) IsRedirect() bool {
   194  	return false
   195  }
   196  
   197  // IsClientError returns true when this post alerts internal server error response has a 4xx status code
   198  func (o *PostAlertsInternalServerError) IsClientError() bool {
   199  	return false
   200  }
   201  
   202  // IsServerError returns true when this post alerts internal server error response has a 5xx status code
   203  func (o *PostAlertsInternalServerError) IsServerError() bool {
   204  	return true
   205  }
   206  
   207  // IsCode returns true when this post alerts internal server error response a status code equal to that given
   208  func (o *PostAlertsInternalServerError) IsCode(code int) bool {
   209  	return code == 500
   210  }
   211  
   212  func (o *PostAlertsInternalServerError) Error() string {
   213  	return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError  %+v", 500, o.Payload)
   214  }
   215  
   216  func (o *PostAlertsInternalServerError) String() string {
   217  	return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError  %+v", 500, o.Payload)
   218  }
   219  
   220  func (o *PostAlertsInternalServerError) GetPayload() string {
   221  	return o.Payload
   222  }
   223  
   224  func (o *PostAlertsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   225  
   226  	// response payload
   227  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   228  		return err
   229  	}
   230  
   231  	return nil
   232  }
   233  

View as plain text