github.com/cilium/cilium@v1.16.2/api/v1/client/policy/delete_policy_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 policy
     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  // DeletePolicyReader is a Reader for the DeletePolicy structure.
    22  type DeletePolicyReader struct {
    23  	formats strfmt.Registry
    24  }
    25  
    26  // ReadResponse reads a server response into the received o.
    27  func (o *DeletePolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    28  	switch response.Code() {
    29  	case 200:
    30  		result := NewDeletePolicyOK()
    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 := NewDeletePolicyInvalid()
    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 := NewDeletePolicyForbidden()
    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 := NewDeletePolicyNotFound()
    49  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    50  			return nil, err
    51  		}
    52  		return nil, result
    53  	case 500:
    54  		result := NewDeletePolicyFailure()
    55  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    56  			return nil, err
    57  		}
    58  		return nil, result
    59  	default:
    60  		return nil, runtime.NewAPIError("[DELETE /policy] DeletePolicy", response, response.Code())
    61  	}
    62  }
    63  
    64  // NewDeletePolicyOK creates a DeletePolicyOK with default headers values
    65  func NewDeletePolicyOK() *DeletePolicyOK {
    66  	return &DeletePolicyOK{}
    67  }
    68  
    69  /*
    70  DeletePolicyOK describes a response with status code 200, with default header values.
    71  
    72  Success
    73  */
    74  type DeletePolicyOK struct {
    75  	Payload *models.Policy
    76  }
    77  
    78  // IsSuccess returns true when this delete policy o k response has a 2xx status code
    79  func (o *DeletePolicyOK) IsSuccess() bool {
    80  	return true
    81  }
    82  
    83  // IsRedirect returns true when this delete policy o k response has a 3xx status code
    84  func (o *DeletePolicyOK) IsRedirect() bool {
    85  	return false
    86  }
    87  
    88  // IsClientError returns true when this delete policy o k response has a 4xx status code
    89  func (o *DeletePolicyOK) IsClientError() bool {
    90  	return false
    91  }
    92  
    93  // IsServerError returns true when this delete policy o k response has a 5xx status code
    94  func (o *DeletePolicyOK) IsServerError() bool {
    95  	return false
    96  }
    97  
    98  // IsCode returns true when this delete policy o k response a status code equal to that given
    99  func (o *DeletePolicyOK) IsCode(code int) bool {
   100  	return code == 200
   101  }
   102  
   103  // Code gets the status code for the delete policy o k response
   104  func (o *DeletePolicyOK) Code() int {
   105  	return 200
   106  }
   107  
   108  func (o *DeletePolicyOK) Error() string {
   109  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyOK  %+v", 200, o.Payload)
   110  }
   111  
   112  func (o *DeletePolicyOK) String() string {
   113  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyOK  %+v", 200, o.Payload)
   114  }
   115  
   116  func (o *DeletePolicyOK) GetPayload() *models.Policy {
   117  	return o.Payload
   118  }
   119  
   120  func (o *DeletePolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   121  
   122  	o.Payload = new(models.Policy)
   123  
   124  	// response payload
   125  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   126  		return err
   127  	}
   128  
   129  	return nil
   130  }
   131  
   132  // NewDeletePolicyInvalid creates a DeletePolicyInvalid with default headers values
   133  func NewDeletePolicyInvalid() *DeletePolicyInvalid {
   134  	return &DeletePolicyInvalid{}
   135  }
   136  
   137  /*
   138  DeletePolicyInvalid describes a response with status code 400, with default header values.
   139  
   140  Invalid request
   141  */
   142  type DeletePolicyInvalid struct {
   143  	Payload models.Error
   144  }
   145  
   146  // IsSuccess returns true when this delete policy invalid response has a 2xx status code
   147  func (o *DeletePolicyInvalid) IsSuccess() bool {
   148  	return false
   149  }
   150  
   151  // IsRedirect returns true when this delete policy invalid response has a 3xx status code
   152  func (o *DeletePolicyInvalid) IsRedirect() bool {
   153  	return false
   154  }
   155  
   156  // IsClientError returns true when this delete policy invalid response has a 4xx status code
   157  func (o *DeletePolicyInvalid) IsClientError() bool {
   158  	return true
   159  }
   160  
   161  // IsServerError returns true when this delete policy invalid response has a 5xx status code
   162  func (o *DeletePolicyInvalid) IsServerError() bool {
   163  	return false
   164  }
   165  
   166  // IsCode returns true when this delete policy invalid response a status code equal to that given
   167  func (o *DeletePolicyInvalid) IsCode(code int) bool {
   168  	return code == 400
   169  }
   170  
   171  // Code gets the status code for the delete policy invalid response
   172  func (o *DeletePolicyInvalid) Code() int {
   173  	return 400
   174  }
   175  
   176  func (o *DeletePolicyInvalid) Error() string {
   177  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyInvalid  %+v", 400, o.Payload)
   178  }
   179  
   180  func (o *DeletePolicyInvalid) String() string {
   181  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyInvalid  %+v", 400, o.Payload)
   182  }
   183  
   184  func (o *DeletePolicyInvalid) GetPayload() models.Error {
   185  	return o.Payload
   186  }
   187  
   188  func (o *DeletePolicyInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   189  
   190  	// response payload
   191  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   192  		return err
   193  	}
   194  
   195  	return nil
   196  }
   197  
   198  // NewDeletePolicyForbidden creates a DeletePolicyForbidden with default headers values
   199  func NewDeletePolicyForbidden() *DeletePolicyForbidden {
   200  	return &DeletePolicyForbidden{}
   201  }
   202  
   203  /*
   204  DeletePolicyForbidden describes a response with status code 403, with default header values.
   205  
   206  Forbidden
   207  */
   208  type DeletePolicyForbidden struct {
   209  }
   210  
   211  // IsSuccess returns true when this delete policy forbidden response has a 2xx status code
   212  func (o *DeletePolicyForbidden) IsSuccess() bool {
   213  	return false
   214  }
   215  
   216  // IsRedirect returns true when this delete policy forbidden response has a 3xx status code
   217  func (o *DeletePolicyForbidden) IsRedirect() bool {
   218  	return false
   219  }
   220  
   221  // IsClientError returns true when this delete policy forbidden response has a 4xx status code
   222  func (o *DeletePolicyForbidden) IsClientError() bool {
   223  	return true
   224  }
   225  
   226  // IsServerError returns true when this delete policy forbidden response has a 5xx status code
   227  func (o *DeletePolicyForbidden) IsServerError() bool {
   228  	return false
   229  }
   230  
   231  // IsCode returns true when this delete policy forbidden response a status code equal to that given
   232  func (o *DeletePolicyForbidden) IsCode(code int) bool {
   233  	return code == 403
   234  }
   235  
   236  // Code gets the status code for the delete policy forbidden response
   237  func (o *DeletePolicyForbidden) Code() int {
   238  	return 403
   239  }
   240  
   241  func (o *DeletePolicyForbidden) Error() string {
   242  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyForbidden ", 403)
   243  }
   244  
   245  func (o *DeletePolicyForbidden) String() string {
   246  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyForbidden ", 403)
   247  }
   248  
   249  func (o *DeletePolicyForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   250  
   251  	return nil
   252  }
   253  
   254  // NewDeletePolicyNotFound creates a DeletePolicyNotFound with default headers values
   255  func NewDeletePolicyNotFound() *DeletePolicyNotFound {
   256  	return &DeletePolicyNotFound{}
   257  }
   258  
   259  /*
   260  DeletePolicyNotFound describes a response with status code 404, with default header values.
   261  
   262  Policy not found
   263  */
   264  type DeletePolicyNotFound struct {
   265  }
   266  
   267  // IsSuccess returns true when this delete policy not found response has a 2xx status code
   268  func (o *DeletePolicyNotFound) IsSuccess() bool {
   269  	return false
   270  }
   271  
   272  // IsRedirect returns true when this delete policy not found response has a 3xx status code
   273  func (o *DeletePolicyNotFound) IsRedirect() bool {
   274  	return false
   275  }
   276  
   277  // IsClientError returns true when this delete policy not found response has a 4xx status code
   278  func (o *DeletePolicyNotFound) IsClientError() bool {
   279  	return true
   280  }
   281  
   282  // IsServerError returns true when this delete policy not found response has a 5xx status code
   283  func (o *DeletePolicyNotFound) IsServerError() bool {
   284  	return false
   285  }
   286  
   287  // IsCode returns true when this delete policy not found response a status code equal to that given
   288  func (o *DeletePolicyNotFound) IsCode(code int) bool {
   289  	return code == 404
   290  }
   291  
   292  // Code gets the status code for the delete policy not found response
   293  func (o *DeletePolicyNotFound) Code() int {
   294  	return 404
   295  }
   296  
   297  func (o *DeletePolicyNotFound) Error() string {
   298  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyNotFound ", 404)
   299  }
   300  
   301  func (o *DeletePolicyNotFound) String() string {
   302  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyNotFound ", 404)
   303  }
   304  
   305  func (o *DeletePolicyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   306  
   307  	return nil
   308  }
   309  
   310  // NewDeletePolicyFailure creates a DeletePolicyFailure with default headers values
   311  func NewDeletePolicyFailure() *DeletePolicyFailure {
   312  	return &DeletePolicyFailure{}
   313  }
   314  
   315  /*
   316  DeletePolicyFailure describes a response with status code 500, with default header values.
   317  
   318  Error while deleting policy
   319  */
   320  type DeletePolicyFailure struct {
   321  	Payload models.Error
   322  }
   323  
   324  // IsSuccess returns true when this delete policy failure response has a 2xx status code
   325  func (o *DeletePolicyFailure) IsSuccess() bool {
   326  	return false
   327  }
   328  
   329  // IsRedirect returns true when this delete policy failure response has a 3xx status code
   330  func (o *DeletePolicyFailure) IsRedirect() bool {
   331  	return false
   332  }
   333  
   334  // IsClientError returns true when this delete policy failure response has a 4xx status code
   335  func (o *DeletePolicyFailure) IsClientError() bool {
   336  	return false
   337  }
   338  
   339  // IsServerError returns true when this delete policy failure response has a 5xx status code
   340  func (o *DeletePolicyFailure) IsServerError() bool {
   341  	return true
   342  }
   343  
   344  // IsCode returns true when this delete policy failure response a status code equal to that given
   345  func (o *DeletePolicyFailure) IsCode(code int) bool {
   346  	return code == 500
   347  }
   348  
   349  // Code gets the status code for the delete policy failure response
   350  func (o *DeletePolicyFailure) Code() int {
   351  	return 500
   352  }
   353  
   354  func (o *DeletePolicyFailure) Error() string {
   355  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyFailure  %+v", 500, o.Payload)
   356  }
   357  
   358  func (o *DeletePolicyFailure) String() string {
   359  	return fmt.Sprintf("[DELETE /policy][%d] deletePolicyFailure  %+v", 500, o.Payload)
   360  }
   361  
   362  func (o *DeletePolicyFailure) GetPayload() models.Error {
   363  	return o.Payload
   364  }
   365  
   366  func (o *DeletePolicyFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   367  
   368  	// response payload
   369  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   370  		return err
   371  	}
   372  
   373  	return nil
   374  }