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