...

Source file src/github.com/prometheus/alertmanager/api/v2/client/general/get_status_responses.go

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

     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 general
    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  // GetStatusReader is a Reader for the GetStatus structure.
    33  type GetStatusReader struct {
    34  	formats strfmt.Registry
    35  }
    36  
    37  // ReadResponse reads a server response into the received o.
    38  func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    39  	switch response.Code() {
    40  	case 200:
    41  		result := NewGetStatusOK()
    42  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    43  			return nil, err
    44  		}
    45  		return result, nil
    46  	default:
    47  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    48  	}
    49  }
    50  
    51  // NewGetStatusOK creates a GetStatusOK with default headers values
    52  func NewGetStatusOK() *GetStatusOK {
    53  	return &GetStatusOK{}
    54  }
    55  
    56  /*
    57  GetStatusOK describes a response with status code 200, with default header values.
    58  
    59  Get status response
    60  */
    61  type GetStatusOK struct {
    62  	Payload *models.AlertmanagerStatus
    63  }
    64  
    65  // IsSuccess returns true when this get status o k response has a 2xx status code
    66  func (o *GetStatusOK) IsSuccess() bool {
    67  	return true
    68  }
    69  
    70  // IsRedirect returns true when this get status o k response has a 3xx status code
    71  func (o *GetStatusOK) IsRedirect() bool {
    72  	return false
    73  }
    74  
    75  // IsClientError returns true when this get status o k response has a 4xx status code
    76  func (o *GetStatusOK) IsClientError() bool {
    77  	return false
    78  }
    79  
    80  // IsServerError returns true when this get status o k response has a 5xx status code
    81  func (o *GetStatusOK) IsServerError() bool {
    82  	return false
    83  }
    84  
    85  // IsCode returns true when this get status o k response a status code equal to that given
    86  func (o *GetStatusOK) IsCode(code int) bool {
    87  	return code == 200
    88  }
    89  
    90  func (o *GetStatusOK) Error() string {
    91  	return fmt.Sprintf("[GET /status][%d] getStatusOK  %+v", 200, o.Payload)
    92  }
    93  
    94  func (o *GetStatusOK) String() string {
    95  	return fmt.Sprintf("[GET /status][%d] getStatusOK  %+v", 200, o.Payload)
    96  }
    97  
    98  func (o *GetStatusOK) GetPayload() *models.AlertmanagerStatus {
    99  	return o.Payload
   100  }
   101  
   102  func (o *GetStatusOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   103  
   104  	o.Payload = new(models.AlertmanagerStatus)
   105  
   106  	// response payload
   107  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   108  		return err
   109  	}
   110  
   111  	return nil
   112  }
   113  

View as plain text