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