...

Source file src/github.com/prometheus/alertmanager/api/v2/client/alertgroup/get_alert_groups_responses.go

Documentation: github.com/prometheus/alertmanager/api/v2/client/alertgroup

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

View as plain text