github.com/cilium/cilium@v1.16.2/api/v1/client/bgp/get_bgp_peers_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 bgp
     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  // GetBgpPeersReader is a Reader for the GetBgpPeers structure.
    22  type GetBgpPeersReader struct {
    23  	formats strfmt.Registry
    24  }
    25  
    26  // ReadResponse reads a server response into the received o.
    27  func (o *GetBgpPeersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    28  	switch response.Code() {
    29  	case 200:
    30  		result := NewGetBgpPeersOK()
    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 := NewGetBgpPeersInternalServerError()
    37  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    38  			return nil, err
    39  		}
    40  		return nil, result
    41  	case 501:
    42  		result := NewGetBgpPeersDisabled()
    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 /bgp/peers] GetBgpPeers", response, response.Code())
    49  	}
    50  }
    51  
    52  // NewGetBgpPeersOK creates a GetBgpPeersOK with default headers values
    53  func NewGetBgpPeersOK() *GetBgpPeersOK {
    54  	return &GetBgpPeersOK{}
    55  }
    56  
    57  /*
    58  GetBgpPeersOK describes a response with status code 200, with default header values.
    59  
    60  Success
    61  */
    62  type GetBgpPeersOK struct {
    63  	Payload []*models.BgpPeer
    64  }
    65  
    66  // IsSuccess returns true when this get bgp peers o k response has a 2xx status code
    67  func (o *GetBgpPeersOK) IsSuccess() bool {
    68  	return true
    69  }
    70  
    71  // IsRedirect returns true when this get bgp peers o k response has a 3xx status code
    72  func (o *GetBgpPeersOK) IsRedirect() bool {
    73  	return false
    74  }
    75  
    76  // IsClientError returns true when this get bgp peers o k response has a 4xx status code
    77  func (o *GetBgpPeersOK) IsClientError() bool {
    78  	return false
    79  }
    80  
    81  // IsServerError returns true when this get bgp peers o k response has a 5xx status code
    82  func (o *GetBgpPeersOK) IsServerError() bool {
    83  	return false
    84  }
    85  
    86  // IsCode returns true when this get bgp peers o k response a status code equal to that given
    87  func (o *GetBgpPeersOK) IsCode(code int) bool {
    88  	return code == 200
    89  }
    90  
    91  // Code gets the status code for the get bgp peers o k response
    92  func (o *GetBgpPeersOK) Code() int {
    93  	return 200
    94  }
    95  
    96  func (o *GetBgpPeersOK) Error() string {
    97  	return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersOK  %+v", 200, o.Payload)
    98  }
    99  
   100  func (o *GetBgpPeersOK) String() string {
   101  	return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersOK  %+v", 200, o.Payload)
   102  }
   103  
   104  func (o *GetBgpPeersOK) GetPayload() []*models.BgpPeer {
   105  	return o.Payload
   106  }
   107  
   108  func (o *GetBgpPeersOK) 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  // NewGetBgpPeersInternalServerError creates a GetBgpPeersInternalServerError with default headers values
   119  func NewGetBgpPeersInternalServerError() *GetBgpPeersInternalServerError {
   120  	return &GetBgpPeersInternalServerError{}
   121  }
   122  
   123  /*
   124  GetBgpPeersInternalServerError describes a response with status code 500, with default header values.
   125  
   126  Internal Server Error
   127  */
   128  type GetBgpPeersInternalServerError struct {
   129  	Payload models.Error
   130  }
   131  
   132  // IsSuccess returns true when this get bgp peers internal server error response has a 2xx status code
   133  func (o *GetBgpPeersInternalServerError) IsSuccess() bool {
   134  	return false
   135  }
   136  
   137  // IsRedirect returns true when this get bgp peers internal server error response has a 3xx status code
   138  func (o *GetBgpPeersInternalServerError) IsRedirect() bool {
   139  	return false
   140  }
   141  
   142  // IsClientError returns true when this get bgp peers internal server error response has a 4xx status code
   143  func (o *GetBgpPeersInternalServerError) IsClientError() bool {
   144  	return false
   145  }
   146  
   147  // IsServerError returns true when this get bgp peers internal server error response has a 5xx status code
   148  func (o *GetBgpPeersInternalServerError) IsServerError() bool {
   149  	return true
   150  }
   151  
   152  // IsCode returns true when this get bgp peers internal server error response a status code equal to that given
   153  func (o *GetBgpPeersInternalServerError) IsCode(code int) bool {
   154  	return code == 500
   155  }
   156  
   157  // Code gets the status code for the get bgp peers internal server error response
   158  func (o *GetBgpPeersInternalServerError) Code() int {
   159  	return 500
   160  }
   161  
   162  func (o *GetBgpPeersInternalServerError) Error() string {
   163  	return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersInternalServerError  %+v", 500, o.Payload)
   164  }
   165  
   166  func (o *GetBgpPeersInternalServerError) String() string {
   167  	return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersInternalServerError  %+v", 500, o.Payload)
   168  }
   169  
   170  func (o *GetBgpPeersInternalServerError) GetPayload() models.Error {
   171  	return o.Payload
   172  }
   173  
   174  func (o *GetBgpPeersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   175  
   176  	// response payload
   177  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   178  		return err
   179  	}
   180  
   181  	return nil
   182  }
   183  
   184  // NewGetBgpPeersDisabled creates a GetBgpPeersDisabled with default headers values
   185  func NewGetBgpPeersDisabled() *GetBgpPeersDisabled {
   186  	return &GetBgpPeersDisabled{}
   187  }
   188  
   189  /*
   190  GetBgpPeersDisabled describes a response with status code 501, with default header values.
   191  
   192  BGP Control Plane disabled
   193  */
   194  type GetBgpPeersDisabled struct {
   195  	Payload models.Error
   196  }
   197  
   198  // IsSuccess returns true when this get bgp peers disabled response has a 2xx status code
   199  func (o *GetBgpPeersDisabled) IsSuccess() bool {
   200  	return false
   201  }
   202  
   203  // IsRedirect returns true when this get bgp peers disabled response has a 3xx status code
   204  func (o *GetBgpPeersDisabled) IsRedirect() bool {
   205  	return false
   206  }
   207  
   208  // IsClientError returns true when this get bgp peers disabled response has a 4xx status code
   209  func (o *GetBgpPeersDisabled) IsClientError() bool {
   210  	return false
   211  }
   212  
   213  // IsServerError returns true when this get bgp peers disabled response has a 5xx status code
   214  func (o *GetBgpPeersDisabled) IsServerError() bool {
   215  	return true
   216  }
   217  
   218  // IsCode returns true when this get bgp peers disabled response a status code equal to that given
   219  func (o *GetBgpPeersDisabled) IsCode(code int) bool {
   220  	return code == 501
   221  }
   222  
   223  // Code gets the status code for the get bgp peers disabled response
   224  func (o *GetBgpPeersDisabled) Code() int {
   225  	return 501
   226  }
   227  
   228  func (o *GetBgpPeersDisabled) Error() string {
   229  	return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersDisabled  %+v", 501, o.Payload)
   230  }
   231  
   232  func (o *GetBgpPeersDisabled) String() string {
   233  	return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersDisabled  %+v", 501, o.Payload)
   234  }
   235  
   236  func (o *GetBgpPeersDisabled) GetPayload() models.Error {
   237  	return o.Payload
   238  }
   239  
   240  func (o *GetBgpPeersDisabled) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   241  
   242  	// response payload
   243  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   244  		return err
   245  	}
   246  
   247  	return nil
   248  }