github.com/looshlee/beatles@v0.0.0-20220727174639-742810ab631c/api/v1/client/policy/delete_policy_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package policy 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "fmt" 10 "io" 11 12 "github.com/go-openapi/runtime" 13 14 strfmt "github.com/go-openapi/strfmt" 15 16 models "github.com/cilium/cilium/api/v1/models" 17 ) 18 19 // DeletePolicyReader is a Reader for the DeletePolicy structure. 20 type DeletePolicyReader struct { 21 formats strfmt.Registry 22 } 23 24 // ReadResponse reads a server response into the received o. 25 func (o *DeletePolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 switch response.Code() { 27 28 case 200: 29 result := NewDeletePolicyOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 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 42 case 404: 43 result := NewDeletePolicyNotFound() 44 if err := result.readResponse(response, consumer, o.formats); err != nil { 45 return nil, err 46 } 47 return nil, result 48 49 case 500: 50 result := NewDeletePolicyFailure() 51 if err := result.readResponse(response, consumer, o.formats); err != nil { 52 return nil, err 53 } 54 return nil, result 55 56 default: 57 return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 } 59 } 60 61 // NewDeletePolicyOK creates a DeletePolicyOK with default headers values 62 func NewDeletePolicyOK() *DeletePolicyOK { 63 return &DeletePolicyOK{} 64 } 65 66 /*DeletePolicyOK handles this case with default header values. 67 68 Success 69 */ 70 type DeletePolicyOK struct { 71 Payload *models.Policy 72 } 73 74 func (o *DeletePolicyOK) Error() string { 75 return fmt.Sprintf("[DELETE /policy][%d] deletePolicyOK %+v", 200, o.Payload) 76 } 77 78 func (o *DeletePolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 79 80 o.Payload = new(models.Policy) 81 82 // response payload 83 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 84 return err 85 } 86 87 return nil 88 } 89 90 // NewDeletePolicyInvalid creates a DeletePolicyInvalid with default headers values 91 func NewDeletePolicyInvalid() *DeletePolicyInvalid { 92 return &DeletePolicyInvalid{} 93 } 94 95 /*DeletePolicyInvalid handles this case with default header values. 96 97 Invalid request 98 */ 99 type DeletePolicyInvalid struct { 100 Payload models.Error 101 } 102 103 func (o *DeletePolicyInvalid) Error() string { 104 return fmt.Sprintf("[DELETE /policy][%d] deletePolicyInvalid %+v", 400, o.Payload) 105 } 106 107 func (o *DeletePolicyInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 108 109 // response payload 110 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 111 return err 112 } 113 114 return nil 115 } 116 117 // NewDeletePolicyNotFound creates a DeletePolicyNotFound with default headers values 118 func NewDeletePolicyNotFound() *DeletePolicyNotFound { 119 return &DeletePolicyNotFound{} 120 } 121 122 /*DeletePolicyNotFound handles this case with default header values. 123 124 Policy not found 125 */ 126 type DeletePolicyNotFound struct { 127 } 128 129 func (o *DeletePolicyNotFound) Error() string { 130 return fmt.Sprintf("[DELETE /policy][%d] deletePolicyNotFound ", 404) 131 } 132 133 func (o *DeletePolicyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 134 135 return nil 136 } 137 138 // NewDeletePolicyFailure creates a DeletePolicyFailure with default headers values 139 func NewDeletePolicyFailure() *DeletePolicyFailure { 140 return &DeletePolicyFailure{} 141 } 142 143 /*DeletePolicyFailure handles this case with default header values. 144 145 Error while deleting policy 146 */ 147 type DeletePolicyFailure struct { 148 Payload models.Error 149 } 150 151 func (o *DeletePolicyFailure) Error() string { 152 return fmt.Sprintf("[DELETE /policy][%d] deletePolicyFailure %+v", 500, o.Payload) 153 } 154 155 func (o *DeletePolicyFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 156 157 // response payload 158 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 159 return err 160 } 161 162 return nil 163 }