github.com/cilium/cilium@v1.16.2/api/v1/client/endpoint/patch_endpoint_id_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  // PatchEndpointIDReader is a Reader for the PatchEndpointID structure.
    22  type PatchEndpointIDReader struct {
    23  	formats strfmt.Registry
    24  }
    25  
    26  // ReadResponse reads a server response into the received o.
    27  func (o *PatchEndpointIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    28  	switch response.Code() {
    29  	case 200:
    30  		result := NewPatchEndpointIDOK()
    31  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    32  			return nil, err
    33  		}
    34  		return result, nil
    35  	case 400:
    36  		result := NewPatchEndpointIDInvalid()
    37  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    38  			return nil, err
    39  		}
    40  		return nil, result
    41  	case 403:
    42  		result := NewPatchEndpointIDForbidden()
    43  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    44  			return nil, err
    45  		}
    46  		return nil, result
    47  	case 404:
    48  		result := NewPatchEndpointIDNotFound()
    49  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    50  			return nil, err
    51  		}
    52  		return nil, result
    53  	case 429:
    54  		result := NewPatchEndpointIDTooManyRequests()
    55  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    56  			return nil, err
    57  		}
    58  		return nil, result
    59  	case 500:
    60  		result := NewPatchEndpointIDFailed()
    61  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    62  			return nil, err
    63  		}
    64  		return nil, result
    65  	default:
    66  		return nil, runtime.NewAPIError("[PATCH /endpoint/{id}] PatchEndpointID", response, response.Code())
    67  	}
    68  }
    69  
    70  // NewPatchEndpointIDOK creates a PatchEndpointIDOK with default headers values
    71  func NewPatchEndpointIDOK() *PatchEndpointIDOK {
    72  	return &PatchEndpointIDOK{}
    73  }
    74  
    75  /*
    76  PatchEndpointIDOK describes a response with status code 200, with default header values.
    77  
    78  Success
    79  */
    80  type PatchEndpointIDOK struct {
    81  }
    82  
    83  // IsSuccess returns true when this patch endpoint Id o k response has a 2xx status code
    84  func (o *PatchEndpointIDOK) IsSuccess() bool {
    85  	return true
    86  }
    87  
    88  // IsRedirect returns true when this patch endpoint Id o k response has a 3xx status code
    89  func (o *PatchEndpointIDOK) IsRedirect() bool {
    90  	return false
    91  }
    92  
    93  // IsClientError returns true when this patch endpoint Id o k response has a 4xx status code
    94  func (o *PatchEndpointIDOK) IsClientError() bool {
    95  	return false
    96  }
    97  
    98  // IsServerError returns true when this patch endpoint Id o k response has a 5xx status code
    99  func (o *PatchEndpointIDOK) IsServerError() bool {
   100  	return false
   101  }
   102  
   103  // IsCode returns true when this patch endpoint Id o k response a status code equal to that given
   104  func (o *PatchEndpointIDOK) IsCode(code int) bool {
   105  	return code == 200
   106  }
   107  
   108  // Code gets the status code for the patch endpoint Id o k response
   109  func (o *PatchEndpointIDOK) Code() int {
   110  	return 200
   111  }
   112  
   113  func (o *PatchEndpointIDOK) Error() string {
   114  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdOK ", 200)
   115  }
   116  
   117  func (o *PatchEndpointIDOK) String() string {
   118  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdOK ", 200)
   119  }
   120  
   121  func (o *PatchEndpointIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   122  
   123  	return nil
   124  }
   125  
   126  // NewPatchEndpointIDInvalid creates a PatchEndpointIDInvalid with default headers values
   127  func NewPatchEndpointIDInvalid() *PatchEndpointIDInvalid {
   128  	return &PatchEndpointIDInvalid{}
   129  }
   130  
   131  /*
   132  PatchEndpointIDInvalid describes a response with status code 400, with default header values.
   133  
   134  Invalid modify endpoint request
   135  */
   136  type PatchEndpointIDInvalid struct {
   137  	Payload models.Error
   138  }
   139  
   140  // IsSuccess returns true when this patch endpoint Id invalid response has a 2xx status code
   141  func (o *PatchEndpointIDInvalid) IsSuccess() bool {
   142  	return false
   143  }
   144  
   145  // IsRedirect returns true when this patch endpoint Id invalid response has a 3xx status code
   146  func (o *PatchEndpointIDInvalid) IsRedirect() bool {
   147  	return false
   148  }
   149  
   150  // IsClientError returns true when this patch endpoint Id invalid response has a 4xx status code
   151  func (o *PatchEndpointIDInvalid) IsClientError() bool {
   152  	return true
   153  }
   154  
   155  // IsServerError returns true when this patch endpoint Id invalid response has a 5xx status code
   156  func (o *PatchEndpointIDInvalid) IsServerError() bool {
   157  	return false
   158  }
   159  
   160  // IsCode returns true when this patch endpoint Id invalid response a status code equal to that given
   161  func (o *PatchEndpointIDInvalid) IsCode(code int) bool {
   162  	return code == 400
   163  }
   164  
   165  // Code gets the status code for the patch endpoint Id invalid response
   166  func (o *PatchEndpointIDInvalid) Code() int {
   167  	return 400
   168  }
   169  
   170  func (o *PatchEndpointIDInvalid) Error() string {
   171  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdInvalid  %+v", 400, o.Payload)
   172  }
   173  
   174  func (o *PatchEndpointIDInvalid) String() string {
   175  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdInvalid  %+v", 400, o.Payload)
   176  }
   177  
   178  func (o *PatchEndpointIDInvalid) GetPayload() models.Error {
   179  	return o.Payload
   180  }
   181  
   182  func (o *PatchEndpointIDInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   183  
   184  	// response payload
   185  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   186  		return err
   187  	}
   188  
   189  	return nil
   190  }
   191  
   192  // NewPatchEndpointIDForbidden creates a PatchEndpointIDForbidden with default headers values
   193  func NewPatchEndpointIDForbidden() *PatchEndpointIDForbidden {
   194  	return &PatchEndpointIDForbidden{}
   195  }
   196  
   197  /*
   198  PatchEndpointIDForbidden describes a response with status code 403, with default header values.
   199  
   200  Forbidden
   201  */
   202  type PatchEndpointIDForbidden struct {
   203  }
   204  
   205  // IsSuccess returns true when this patch endpoint Id forbidden response has a 2xx status code
   206  func (o *PatchEndpointIDForbidden) IsSuccess() bool {
   207  	return false
   208  }
   209  
   210  // IsRedirect returns true when this patch endpoint Id forbidden response has a 3xx status code
   211  func (o *PatchEndpointIDForbidden) IsRedirect() bool {
   212  	return false
   213  }
   214  
   215  // IsClientError returns true when this patch endpoint Id forbidden response has a 4xx status code
   216  func (o *PatchEndpointIDForbidden) IsClientError() bool {
   217  	return true
   218  }
   219  
   220  // IsServerError returns true when this patch endpoint Id forbidden response has a 5xx status code
   221  func (o *PatchEndpointIDForbidden) IsServerError() bool {
   222  	return false
   223  }
   224  
   225  // IsCode returns true when this patch endpoint Id forbidden response a status code equal to that given
   226  func (o *PatchEndpointIDForbidden) IsCode(code int) bool {
   227  	return code == 403
   228  }
   229  
   230  // Code gets the status code for the patch endpoint Id forbidden response
   231  func (o *PatchEndpointIDForbidden) Code() int {
   232  	return 403
   233  }
   234  
   235  func (o *PatchEndpointIDForbidden) Error() string {
   236  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdForbidden ", 403)
   237  }
   238  
   239  func (o *PatchEndpointIDForbidden) String() string {
   240  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdForbidden ", 403)
   241  }
   242  
   243  func (o *PatchEndpointIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   244  
   245  	return nil
   246  }
   247  
   248  // NewPatchEndpointIDNotFound creates a PatchEndpointIDNotFound with default headers values
   249  func NewPatchEndpointIDNotFound() *PatchEndpointIDNotFound {
   250  	return &PatchEndpointIDNotFound{}
   251  }
   252  
   253  /*
   254  PatchEndpointIDNotFound describes a response with status code 404, with default header values.
   255  
   256  Endpoint does not exist
   257  */
   258  type PatchEndpointIDNotFound struct {
   259  }
   260  
   261  // IsSuccess returns true when this patch endpoint Id not found response has a 2xx status code
   262  func (o *PatchEndpointIDNotFound) IsSuccess() bool {
   263  	return false
   264  }
   265  
   266  // IsRedirect returns true when this patch endpoint Id not found response has a 3xx status code
   267  func (o *PatchEndpointIDNotFound) IsRedirect() bool {
   268  	return false
   269  }
   270  
   271  // IsClientError returns true when this patch endpoint Id not found response has a 4xx status code
   272  func (o *PatchEndpointIDNotFound) IsClientError() bool {
   273  	return true
   274  }
   275  
   276  // IsServerError returns true when this patch endpoint Id not found response has a 5xx status code
   277  func (o *PatchEndpointIDNotFound) IsServerError() bool {
   278  	return false
   279  }
   280  
   281  // IsCode returns true when this patch endpoint Id not found response a status code equal to that given
   282  func (o *PatchEndpointIDNotFound) IsCode(code int) bool {
   283  	return code == 404
   284  }
   285  
   286  // Code gets the status code for the patch endpoint Id not found response
   287  func (o *PatchEndpointIDNotFound) Code() int {
   288  	return 404
   289  }
   290  
   291  func (o *PatchEndpointIDNotFound) Error() string {
   292  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdNotFound ", 404)
   293  }
   294  
   295  func (o *PatchEndpointIDNotFound) String() string {
   296  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdNotFound ", 404)
   297  }
   298  
   299  func (o *PatchEndpointIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   300  
   301  	return nil
   302  }
   303  
   304  // NewPatchEndpointIDTooManyRequests creates a PatchEndpointIDTooManyRequests with default headers values
   305  func NewPatchEndpointIDTooManyRequests() *PatchEndpointIDTooManyRequests {
   306  	return &PatchEndpointIDTooManyRequests{}
   307  }
   308  
   309  /*
   310  PatchEndpointIDTooManyRequests describes a response with status code 429, with default header values.
   311  
   312  Rate-limiting too many requests in the given time frame
   313  */
   314  type PatchEndpointIDTooManyRequests struct {
   315  }
   316  
   317  // IsSuccess returns true when this patch endpoint Id too many requests response has a 2xx status code
   318  func (o *PatchEndpointIDTooManyRequests) IsSuccess() bool {
   319  	return false
   320  }
   321  
   322  // IsRedirect returns true when this patch endpoint Id too many requests response has a 3xx status code
   323  func (o *PatchEndpointIDTooManyRequests) IsRedirect() bool {
   324  	return false
   325  }
   326  
   327  // IsClientError returns true when this patch endpoint Id too many requests response has a 4xx status code
   328  func (o *PatchEndpointIDTooManyRequests) IsClientError() bool {
   329  	return true
   330  }
   331  
   332  // IsServerError returns true when this patch endpoint Id too many requests response has a 5xx status code
   333  func (o *PatchEndpointIDTooManyRequests) IsServerError() bool {
   334  	return false
   335  }
   336  
   337  // IsCode returns true when this patch endpoint Id too many requests response a status code equal to that given
   338  func (o *PatchEndpointIDTooManyRequests) IsCode(code int) bool {
   339  	return code == 429
   340  }
   341  
   342  // Code gets the status code for the patch endpoint Id too many requests response
   343  func (o *PatchEndpointIDTooManyRequests) Code() int {
   344  	return 429
   345  }
   346  
   347  func (o *PatchEndpointIDTooManyRequests) Error() string {
   348  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdTooManyRequests ", 429)
   349  }
   350  
   351  func (o *PatchEndpointIDTooManyRequests) String() string {
   352  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdTooManyRequests ", 429)
   353  }
   354  
   355  func (o *PatchEndpointIDTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   356  
   357  	return nil
   358  }
   359  
   360  // NewPatchEndpointIDFailed creates a PatchEndpointIDFailed with default headers values
   361  func NewPatchEndpointIDFailed() *PatchEndpointIDFailed {
   362  	return &PatchEndpointIDFailed{}
   363  }
   364  
   365  /*
   366  PatchEndpointIDFailed describes a response with status code 500, with default header values.
   367  
   368  Endpoint update failed
   369  */
   370  type PatchEndpointIDFailed struct {
   371  	Payload models.Error
   372  }
   373  
   374  // IsSuccess returns true when this patch endpoint Id failed response has a 2xx status code
   375  func (o *PatchEndpointIDFailed) IsSuccess() bool {
   376  	return false
   377  }
   378  
   379  // IsRedirect returns true when this patch endpoint Id failed response has a 3xx status code
   380  func (o *PatchEndpointIDFailed) IsRedirect() bool {
   381  	return false
   382  }
   383  
   384  // IsClientError returns true when this patch endpoint Id failed response has a 4xx status code
   385  func (o *PatchEndpointIDFailed) IsClientError() bool {
   386  	return false
   387  }
   388  
   389  // IsServerError returns true when this patch endpoint Id failed response has a 5xx status code
   390  func (o *PatchEndpointIDFailed) IsServerError() bool {
   391  	return true
   392  }
   393  
   394  // IsCode returns true when this patch endpoint Id failed response a status code equal to that given
   395  func (o *PatchEndpointIDFailed) IsCode(code int) bool {
   396  	return code == 500
   397  }
   398  
   399  // Code gets the status code for the patch endpoint Id failed response
   400  func (o *PatchEndpointIDFailed) Code() int {
   401  	return 500
   402  }
   403  
   404  func (o *PatchEndpointIDFailed) Error() string {
   405  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdFailed  %+v", 500, o.Payload)
   406  }
   407  
   408  func (o *PatchEndpointIDFailed) String() string {
   409  	return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdFailed  %+v", 500, o.Payload)
   410  }
   411  
   412  func (o *PatchEndpointIDFailed) GetPayload() models.Error {
   413  	return o.Payload
   414  }
   415  
   416  func (o *PatchEndpointIDFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   417  
   418  	// response payload
   419  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   420  		return err
   421  	}
   422  
   423  	return nil
   424  }