github.com/cilium/cilium@v1.16.2/api/v1/client/metrics/get_metrics_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright Authors of Cilium
     4  // SPDX-License-Identifier: Apache-2.0
     5  
     6  package metrics
     7  
     8  // This file was generated by the swagger tool.
     9  // Editing this file might prove futile when you re-run the swagger generate command
    10  
    11  import (
    12  	"fmt"
    13  	"io"
    14  
    15  	"github.com/go-openapi/runtime"
    16  	"github.com/go-openapi/strfmt"
    17  
    18  	"github.com/cilium/cilium/api/v1/models"
    19  )
    20  
    21  // GetMetricsReader is a Reader for the GetMetrics structure.
    22  type GetMetricsReader struct {
    23  	formats strfmt.Registry
    24  }
    25  
    26  // ReadResponse reads a server response into the received o.
    27  func (o *GetMetricsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    28  	switch response.Code() {
    29  	case 200:
    30  		result := NewGetMetricsOK()
    31  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    32  			return nil, err
    33  		}
    34  		return result, nil
    35  	case 500:
    36  		result := NewGetMetricsInternalServerError()
    37  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    38  			return nil, err
    39  		}
    40  		return nil, result
    41  	default:
    42  		return nil, runtime.NewAPIError("[GET /metrics/] GetMetrics", response, response.Code())
    43  	}
    44  }
    45  
    46  // NewGetMetricsOK creates a GetMetricsOK with default headers values
    47  func NewGetMetricsOK() *GetMetricsOK {
    48  	return &GetMetricsOK{}
    49  }
    50  
    51  /*
    52  GetMetricsOK describes a response with status code 200, with default header values.
    53  
    54  Success
    55  */
    56  type GetMetricsOK struct {
    57  	Payload []*models.Metric
    58  }
    59  
    60  // IsSuccess returns true when this get metrics o k response has a 2xx status code
    61  func (o *GetMetricsOK) IsSuccess() bool {
    62  	return true
    63  }
    64  
    65  // IsRedirect returns true when this get metrics o k response has a 3xx status code
    66  func (o *GetMetricsOK) IsRedirect() bool {
    67  	return false
    68  }
    69  
    70  // IsClientError returns true when this get metrics o k response has a 4xx status code
    71  func (o *GetMetricsOK) IsClientError() bool {
    72  	return false
    73  }
    74  
    75  // IsServerError returns true when this get metrics o k response has a 5xx status code
    76  func (o *GetMetricsOK) IsServerError() bool {
    77  	return false
    78  }
    79  
    80  // IsCode returns true when this get metrics o k response a status code equal to that given
    81  func (o *GetMetricsOK) IsCode(code int) bool {
    82  	return code == 200
    83  }
    84  
    85  // Code gets the status code for the get metrics o k response
    86  func (o *GetMetricsOK) Code() int {
    87  	return 200
    88  }
    89  
    90  func (o *GetMetricsOK) Error() string {
    91  	return fmt.Sprintf("[GET /metrics/][%d] getMetricsOK  %+v", 200, o.Payload)
    92  }
    93  
    94  func (o *GetMetricsOK) String() string {
    95  	return fmt.Sprintf("[GET /metrics/][%d] getMetricsOK  %+v", 200, o.Payload)
    96  }
    97  
    98  func (o *GetMetricsOK) GetPayload() []*models.Metric {
    99  	return o.Payload
   100  }
   101  
   102  func (o *GetMetricsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   103  
   104  	// response payload
   105  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   106  		return err
   107  	}
   108  
   109  	return nil
   110  }
   111  
   112  // NewGetMetricsInternalServerError creates a GetMetricsInternalServerError with default headers values
   113  func NewGetMetricsInternalServerError() *GetMetricsInternalServerError {
   114  	return &GetMetricsInternalServerError{}
   115  }
   116  
   117  /*
   118  GetMetricsInternalServerError describes a response with status code 500, with default header values.
   119  
   120  Metrics cannot be retrieved
   121  */
   122  type GetMetricsInternalServerError struct {
   123  }
   124  
   125  // IsSuccess returns true when this get metrics internal server error response has a 2xx status code
   126  func (o *GetMetricsInternalServerError) IsSuccess() bool {
   127  	return false
   128  }
   129  
   130  // IsRedirect returns true when this get metrics internal server error response has a 3xx status code
   131  func (o *GetMetricsInternalServerError) IsRedirect() bool {
   132  	return false
   133  }
   134  
   135  // IsClientError returns true when this get metrics internal server error response has a 4xx status code
   136  func (o *GetMetricsInternalServerError) IsClientError() bool {
   137  	return false
   138  }
   139  
   140  // IsServerError returns true when this get metrics internal server error response has a 5xx status code
   141  func (o *GetMetricsInternalServerError) IsServerError() bool {
   142  	return true
   143  }
   144  
   145  // IsCode returns true when this get metrics internal server error response a status code equal to that given
   146  func (o *GetMetricsInternalServerError) IsCode(code int) bool {
   147  	return code == 500
   148  }
   149  
   150  // Code gets the status code for the get metrics internal server error response
   151  func (o *GetMetricsInternalServerError) Code() int {
   152  	return 500
   153  }
   154  
   155  func (o *GetMetricsInternalServerError) Error() string {
   156  	return fmt.Sprintf("[GET /metrics/][%d] getMetricsInternalServerError ", 500)
   157  }
   158  
   159  func (o *GetMetricsInternalServerError) String() string {
   160  	return fmt.Sprintf("[GET /metrics/][%d] getMetricsInternalServerError ", 500)
   161  }
   162  
   163  func (o *GetMetricsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   164  
   165  	return nil
   166  }