github.com/cilium/cilium@v1.16.2/api/v1/client/daemon/patch_config_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 daemon 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 // PatchConfigReader is a Reader for the PatchConfig structure. 22 type PatchConfigReader struct { 23 formats strfmt.Registry 24 } 25 26 // ReadResponse reads a server response into the received o. 27 func (o *PatchConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 28 switch response.Code() { 29 case 200: 30 result := NewPatchConfigOK() 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 := NewPatchConfigBadRequest() 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 := NewPatchConfigForbidden() 43 if err := result.readResponse(response, consumer, o.formats); err != nil { 44 return nil, err 45 } 46 return nil, result 47 case 500: 48 result := NewPatchConfigFailure() 49 if err := result.readResponse(response, consumer, o.formats); err != nil { 50 return nil, err 51 } 52 return nil, result 53 default: 54 return nil, runtime.NewAPIError("[PATCH /config] PatchConfig", response, response.Code()) 55 } 56 } 57 58 // NewPatchConfigOK creates a PatchConfigOK with default headers values 59 func NewPatchConfigOK() *PatchConfigOK { 60 return &PatchConfigOK{} 61 } 62 63 /* 64 PatchConfigOK describes a response with status code 200, with default header values. 65 66 Success 67 */ 68 type PatchConfigOK struct { 69 } 70 71 // IsSuccess returns true when this patch config o k response has a 2xx status code 72 func (o *PatchConfigOK) IsSuccess() bool { 73 return true 74 } 75 76 // IsRedirect returns true when this patch config o k response has a 3xx status code 77 func (o *PatchConfigOK) IsRedirect() bool { 78 return false 79 } 80 81 // IsClientError returns true when this patch config o k response has a 4xx status code 82 func (o *PatchConfigOK) IsClientError() bool { 83 return false 84 } 85 86 // IsServerError returns true when this patch config o k response has a 5xx status code 87 func (o *PatchConfigOK) IsServerError() bool { 88 return false 89 } 90 91 // IsCode returns true when this patch config o k response a status code equal to that given 92 func (o *PatchConfigOK) IsCode(code int) bool { 93 return code == 200 94 } 95 96 // Code gets the status code for the patch config o k response 97 func (o *PatchConfigOK) Code() int { 98 return 200 99 } 100 101 func (o *PatchConfigOK) Error() string { 102 return fmt.Sprintf("[PATCH /config][%d] patchConfigOK ", 200) 103 } 104 105 func (o *PatchConfigOK) String() string { 106 return fmt.Sprintf("[PATCH /config][%d] patchConfigOK ", 200) 107 } 108 109 func (o *PatchConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 110 111 return nil 112 } 113 114 // NewPatchConfigBadRequest creates a PatchConfigBadRequest with default headers values 115 func NewPatchConfigBadRequest() *PatchConfigBadRequest { 116 return &PatchConfigBadRequest{} 117 } 118 119 /* 120 PatchConfigBadRequest describes a response with status code 400, with default header values. 121 122 Bad configuration parameters 123 */ 124 type PatchConfigBadRequest struct { 125 Payload models.Error 126 } 127 128 // IsSuccess returns true when this patch config bad request response has a 2xx status code 129 func (o *PatchConfigBadRequest) IsSuccess() bool { 130 return false 131 } 132 133 // IsRedirect returns true when this patch config bad request response has a 3xx status code 134 func (o *PatchConfigBadRequest) IsRedirect() bool { 135 return false 136 } 137 138 // IsClientError returns true when this patch config bad request response has a 4xx status code 139 func (o *PatchConfigBadRequest) IsClientError() bool { 140 return true 141 } 142 143 // IsServerError returns true when this patch config bad request response has a 5xx status code 144 func (o *PatchConfigBadRequest) IsServerError() bool { 145 return false 146 } 147 148 // IsCode returns true when this patch config bad request response a status code equal to that given 149 func (o *PatchConfigBadRequest) IsCode(code int) bool { 150 return code == 400 151 } 152 153 // Code gets the status code for the patch config bad request response 154 func (o *PatchConfigBadRequest) Code() int { 155 return 400 156 } 157 158 func (o *PatchConfigBadRequest) Error() string { 159 return fmt.Sprintf("[PATCH /config][%d] patchConfigBadRequest %+v", 400, o.Payload) 160 } 161 162 func (o *PatchConfigBadRequest) String() string { 163 return fmt.Sprintf("[PATCH /config][%d] patchConfigBadRequest %+v", 400, o.Payload) 164 } 165 166 func (o *PatchConfigBadRequest) GetPayload() models.Error { 167 return o.Payload 168 } 169 170 func (o *PatchConfigBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 171 172 // response payload 173 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 174 return err 175 } 176 177 return nil 178 } 179 180 // NewPatchConfigForbidden creates a PatchConfigForbidden with default headers values 181 func NewPatchConfigForbidden() *PatchConfigForbidden { 182 return &PatchConfigForbidden{} 183 } 184 185 /* 186 PatchConfigForbidden describes a response with status code 403, with default header values. 187 188 Forbidden 189 */ 190 type PatchConfigForbidden struct { 191 } 192 193 // IsSuccess returns true when this patch config forbidden response has a 2xx status code 194 func (o *PatchConfigForbidden) IsSuccess() bool { 195 return false 196 } 197 198 // IsRedirect returns true when this patch config forbidden response has a 3xx status code 199 func (o *PatchConfigForbidden) IsRedirect() bool { 200 return false 201 } 202 203 // IsClientError returns true when this patch config forbidden response has a 4xx status code 204 func (o *PatchConfigForbidden) IsClientError() bool { 205 return true 206 } 207 208 // IsServerError returns true when this patch config forbidden response has a 5xx status code 209 func (o *PatchConfigForbidden) IsServerError() bool { 210 return false 211 } 212 213 // IsCode returns true when this patch config forbidden response a status code equal to that given 214 func (o *PatchConfigForbidden) IsCode(code int) bool { 215 return code == 403 216 } 217 218 // Code gets the status code for the patch config forbidden response 219 func (o *PatchConfigForbidden) Code() int { 220 return 403 221 } 222 223 func (o *PatchConfigForbidden) Error() string { 224 return fmt.Sprintf("[PATCH /config][%d] patchConfigForbidden ", 403) 225 } 226 227 func (o *PatchConfigForbidden) String() string { 228 return fmt.Sprintf("[PATCH /config][%d] patchConfigForbidden ", 403) 229 } 230 231 func (o *PatchConfigForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 232 233 return nil 234 } 235 236 // NewPatchConfigFailure creates a PatchConfigFailure with default headers values 237 func NewPatchConfigFailure() *PatchConfigFailure { 238 return &PatchConfigFailure{} 239 } 240 241 /* 242 PatchConfigFailure describes a response with status code 500, with default header values. 243 244 Recompilation failed 245 */ 246 type PatchConfigFailure struct { 247 Payload models.Error 248 } 249 250 // IsSuccess returns true when this patch config failure response has a 2xx status code 251 func (o *PatchConfigFailure) IsSuccess() bool { 252 return false 253 } 254 255 // IsRedirect returns true when this patch config failure response has a 3xx status code 256 func (o *PatchConfigFailure) IsRedirect() bool { 257 return false 258 } 259 260 // IsClientError returns true when this patch config failure response has a 4xx status code 261 func (o *PatchConfigFailure) IsClientError() bool { 262 return false 263 } 264 265 // IsServerError returns true when this patch config failure response has a 5xx status code 266 func (o *PatchConfigFailure) IsServerError() bool { 267 return true 268 } 269 270 // IsCode returns true when this patch config failure response a status code equal to that given 271 func (o *PatchConfigFailure) IsCode(code int) bool { 272 return code == 500 273 } 274 275 // Code gets the status code for the patch config failure response 276 func (o *PatchConfigFailure) Code() int { 277 return 500 278 } 279 280 func (o *PatchConfigFailure) Error() string { 281 return fmt.Sprintf("[PATCH /config][%d] patchConfigFailure %+v", 500, o.Payload) 282 } 283 284 func (o *PatchConfigFailure) String() string { 285 return fmt.Sprintf("[PATCH /config][%d] patchConfigFailure %+v", 500, o.Payload) 286 } 287 288 func (o *PatchConfigFailure) GetPayload() models.Error { 289 return o.Payload 290 } 291 292 func (o *PatchConfigFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 293 294 // response payload 295 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 296 return err 297 } 298 299 return nil 300 }