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