github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/gc/create_gc_schedule_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package gc 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 "github.com/go-openapi/strfmt" 14 15 "github.com/goharbor/go-client/pkg/sdk/v2.0/models" 16 ) 17 18 // CreateGCScheduleReader is a Reader for the CreateGCSchedule structure. 19 type CreateGCScheduleReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *CreateGCScheduleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 201: 27 result := NewCreateGCScheduleCreated() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 case 400: 33 result := NewCreateGCScheduleBadRequest() 34 if err := result.readResponse(response, consumer, o.formats); err != nil { 35 return nil, err 36 } 37 return nil, result 38 case 401: 39 result := NewCreateGCScheduleUnauthorized() 40 if err := result.readResponse(response, consumer, o.formats); err != nil { 41 return nil, err 42 } 43 return nil, result 44 case 403: 45 result := NewCreateGCScheduleForbidden() 46 if err := result.readResponse(response, consumer, o.formats); err != nil { 47 return nil, err 48 } 49 return nil, result 50 case 409: 51 result := NewCreateGCScheduleConflict() 52 if err := result.readResponse(response, consumer, o.formats); err != nil { 53 return nil, err 54 } 55 return nil, result 56 case 500: 57 result := NewCreateGCScheduleInternalServerError() 58 if err := result.readResponse(response, consumer, o.formats); err != nil { 59 return nil, err 60 } 61 return nil, result 62 default: 63 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 64 } 65 } 66 67 // NewCreateGCScheduleCreated creates a CreateGCScheduleCreated with default headers values 68 func NewCreateGCScheduleCreated() *CreateGCScheduleCreated { 69 return &CreateGCScheduleCreated{} 70 } 71 72 /* 73 CreateGCScheduleCreated describes a response with status code 201, with default header values. 74 75 Created 76 */ 77 type CreateGCScheduleCreated struct { 78 79 /* The location of the resource 80 */ 81 Location string 82 83 /* The ID of the corresponding request for the response 84 */ 85 XRequestID string 86 } 87 88 // IsSuccess returns true when this create Gc schedule created response has a 2xx status code 89 func (o *CreateGCScheduleCreated) IsSuccess() bool { 90 return true 91 } 92 93 // IsRedirect returns true when this create Gc schedule created response has a 3xx status code 94 func (o *CreateGCScheduleCreated) IsRedirect() bool { 95 return false 96 } 97 98 // IsClientError returns true when this create Gc schedule created response has a 4xx status code 99 func (o *CreateGCScheduleCreated) IsClientError() bool { 100 return false 101 } 102 103 // IsServerError returns true when this create Gc schedule created response has a 5xx status code 104 func (o *CreateGCScheduleCreated) IsServerError() bool { 105 return false 106 } 107 108 // IsCode returns true when this create Gc schedule created response a status code equal to that given 109 func (o *CreateGCScheduleCreated) IsCode(code int) bool { 110 return code == 201 111 } 112 113 func (o *CreateGCScheduleCreated) Error() string { 114 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleCreated ", 201) 115 } 116 117 func (o *CreateGCScheduleCreated) String() string { 118 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleCreated ", 201) 119 } 120 121 func (o *CreateGCScheduleCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 122 123 // hydrates response header Location 124 hdrLocation := response.GetHeader("Location") 125 126 if hdrLocation != "" { 127 o.Location = hdrLocation 128 } 129 130 // hydrates response header X-Request-Id 131 hdrXRequestID := response.GetHeader("X-Request-Id") 132 133 if hdrXRequestID != "" { 134 o.XRequestID = hdrXRequestID 135 } 136 137 return nil 138 } 139 140 // NewCreateGCScheduleBadRequest creates a CreateGCScheduleBadRequest with default headers values 141 func NewCreateGCScheduleBadRequest() *CreateGCScheduleBadRequest { 142 return &CreateGCScheduleBadRequest{} 143 } 144 145 /* 146 CreateGCScheduleBadRequest describes a response with status code 400, with default header values. 147 148 Bad request 149 */ 150 type CreateGCScheduleBadRequest struct { 151 152 /* The ID of the corresponding request for the response 153 */ 154 XRequestID string 155 156 Payload *models.Errors 157 } 158 159 // IsSuccess returns true when this create Gc schedule bad request response has a 2xx status code 160 func (o *CreateGCScheduleBadRequest) IsSuccess() bool { 161 return false 162 } 163 164 // IsRedirect returns true when this create Gc schedule bad request response has a 3xx status code 165 func (o *CreateGCScheduleBadRequest) IsRedirect() bool { 166 return false 167 } 168 169 // IsClientError returns true when this create Gc schedule bad request response has a 4xx status code 170 func (o *CreateGCScheduleBadRequest) IsClientError() bool { 171 return true 172 } 173 174 // IsServerError returns true when this create Gc schedule bad request response has a 5xx status code 175 func (o *CreateGCScheduleBadRequest) IsServerError() bool { 176 return false 177 } 178 179 // IsCode returns true when this create Gc schedule bad request response a status code equal to that given 180 func (o *CreateGCScheduleBadRequest) IsCode(code int) bool { 181 return code == 400 182 } 183 184 func (o *CreateGCScheduleBadRequest) Error() string { 185 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleBadRequest %+v", 400, o.Payload) 186 } 187 188 func (o *CreateGCScheduleBadRequest) String() string { 189 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleBadRequest %+v", 400, o.Payload) 190 } 191 192 func (o *CreateGCScheduleBadRequest) GetPayload() *models.Errors { 193 return o.Payload 194 } 195 196 func (o *CreateGCScheduleBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 197 198 // hydrates response header X-Request-Id 199 hdrXRequestID := response.GetHeader("X-Request-Id") 200 201 if hdrXRequestID != "" { 202 o.XRequestID = hdrXRequestID 203 } 204 205 o.Payload = new(models.Errors) 206 207 // response payload 208 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 209 return err 210 } 211 212 return nil 213 } 214 215 // NewCreateGCScheduleUnauthorized creates a CreateGCScheduleUnauthorized with default headers values 216 func NewCreateGCScheduleUnauthorized() *CreateGCScheduleUnauthorized { 217 return &CreateGCScheduleUnauthorized{} 218 } 219 220 /* 221 CreateGCScheduleUnauthorized describes a response with status code 401, with default header values. 222 223 Unauthorized 224 */ 225 type CreateGCScheduleUnauthorized struct { 226 227 /* The ID of the corresponding request for the response 228 */ 229 XRequestID string 230 231 Payload *models.Errors 232 } 233 234 // IsSuccess returns true when this create Gc schedule unauthorized response has a 2xx status code 235 func (o *CreateGCScheduleUnauthorized) IsSuccess() bool { 236 return false 237 } 238 239 // IsRedirect returns true when this create Gc schedule unauthorized response has a 3xx status code 240 func (o *CreateGCScheduleUnauthorized) IsRedirect() bool { 241 return false 242 } 243 244 // IsClientError returns true when this create Gc schedule unauthorized response has a 4xx status code 245 func (o *CreateGCScheduleUnauthorized) IsClientError() bool { 246 return true 247 } 248 249 // IsServerError returns true when this create Gc schedule unauthorized response has a 5xx status code 250 func (o *CreateGCScheduleUnauthorized) IsServerError() bool { 251 return false 252 } 253 254 // IsCode returns true when this create Gc schedule unauthorized response a status code equal to that given 255 func (o *CreateGCScheduleUnauthorized) IsCode(code int) bool { 256 return code == 401 257 } 258 259 func (o *CreateGCScheduleUnauthorized) Error() string { 260 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleUnauthorized %+v", 401, o.Payload) 261 } 262 263 func (o *CreateGCScheduleUnauthorized) String() string { 264 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleUnauthorized %+v", 401, o.Payload) 265 } 266 267 func (o *CreateGCScheduleUnauthorized) GetPayload() *models.Errors { 268 return o.Payload 269 } 270 271 func (o *CreateGCScheduleUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 272 273 // hydrates response header X-Request-Id 274 hdrXRequestID := response.GetHeader("X-Request-Id") 275 276 if hdrXRequestID != "" { 277 o.XRequestID = hdrXRequestID 278 } 279 280 o.Payload = new(models.Errors) 281 282 // response payload 283 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 284 return err 285 } 286 287 return nil 288 } 289 290 // NewCreateGCScheduleForbidden creates a CreateGCScheduleForbidden with default headers values 291 func NewCreateGCScheduleForbidden() *CreateGCScheduleForbidden { 292 return &CreateGCScheduleForbidden{} 293 } 294 295 /* 296 CreateGCScheduleForbidden describes a response with status code 403, with default header values. 297 298 Forbidden 299 */ 300 type CreateGCScheduleForbidden struct { 301 302 /* The ID of the corresponding request for the response 303 */ 304 XRequestID string 305 306 Payload *models.Errors 307 } 308 309 // IsSuccess returns true when this create Gc schedule forbidden response has a 2xx status code 310 func (o *CreateGCScheduleForbidden) IsSuccess() bool { 311 return false 312 } 313 314 // IsRedirect returns true when this create Gc schedule forbidden response has a 3xx status code 315 func (o *CreateGCScheduleForbidden) IsRedirect() bool { 316 return false 317 } 318 319 // IsClientError returns true when this create Gc schedule forbidden response has a 4xx status code 320 func (o *CreateGCScheduleForbidden) IsClientError() bool { 321 return true 322 } 323 324 // IsServerError returns true when this create Gc schedule forbidden response has a 5xx status code 325 func (o *CreateGCScheduleForbidden) IsServerError() bool { 326 return false 327 } 328 329 // IsCode returns true when this create Gc schedule forbidden response a status code equal to that given 330 func (o *CreateGCScheduleForbidden) IsCode(code int) bool { 331 return code == 403 332 } 333 334 func (o *CreateGCScheduleForbidden) Error() string { 335 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleForbidden %+v", 403, o.Payload) 336 } 337 338 func (o *CreateGCScheduleForbidden) String() string { 339 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleForbidden %+v", 403, o.Payload) 340 } 341 342 func (o *CreateGCScheduleForbidden) GetPayload() *models.Errors { 343 return o.Payload 344 } 345 346 func (o *CreateGCScheduleForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 347 348 // hydrates response header X-Request-Id 349 hdrXRequestID := response.GetHeader("X-Request-Id") 350 351 if hdrXRequestID != "" { 352 o.XRequestID = hdrXRequestID 353 } 354 355 o.Payload = new(models.Errors) 356 357 // response payload 358 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 359 return err 360 } 361 362 return nil 363 } 364 365 // NewCreateGCScheduleConflict creates a CreateGCScheduleConflict with default headers values 366 func NewCreateGCScheduleConflict() *CreateGCScheduleConflict { 367 return &CreateGCScheduleConflict{} 368 } 369 370 /* 371 CreateGCScheduleConflict describes a response with status code 409, with default header values. 372 373 Conflict 374 */ 375 type CreateGCScheduleConflict struct { 376 377 /* The ID of the corresponding request for the response 378 */ 379 XRequestID string 380 381 Payload *models.Errors 382 } 383 384 // IsSuccess returns true when this create Gc schedule conflict response has a 2xx status code 385 func (o *CreateGCScheduleConflict) IsSuccess() bool { 386 return false 387 } 388 389 // IsRedirect returns true when this create Gc schedule conflict response has a 3xx status code 390 func (o *CreateGCScheduleConflict) IsRedirect() bool { 391 return false 392 } 393 394 // IsClientError returns true when this create Gc schedule conflict response has a 4xx status code 395 func (o *CreateGCScheduleConflict) IsClientError() bool { 396 return true 397 } 398 399 // IsServerError returns true when this create Gc schedule conflict response has a 5xx status code 400 func (o *CreateGCScheduleConflict) IsServerError() bool { 401 return false 402 } 403 404 // IsCode returns true when this create Gc schedule conflict response a status code equal to that given 405 func (o *CreateGCScheduleConflict) IsCode(code int) bool { 406 return code == 409 407 } 408 409 func (o *CreateGCScheduleConflict) Error() string { 410 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleConflict %+v", 409, o.Payload) 411 } 412 413 func (o *CreateGCScheduleConflict) String() string { 414 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleConflict %+v", 409, o.Payload) 415 } 416 417 func (o *CreateGCScheduleConflict) GetPayload() *models.Errors { 418 return o.Payload 419 } 420 421 func (o *CreateGCScheduleConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 422 423 // hydrates response header X-Request-Id 424 hdrXRequestID := response.GetHeader("X-Request-Id") 425 426 if hdrXRequestID != "" { 427 o.XRequestID = hdrXRequestID 428 } 429 430 o.Payload = new(models.Errors) 431 432 // response payload 433 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 434 return err 435 } 436 437 return nil 438 } 439 440 // NewCreateGCScheduleInternalServerError creates a CreateGCScheduleInternalServerError with default headers values 441 func NewCreateGCScheduleInternalServerError() *CreateGCScheduleInternalServerError { 442 return &CreateGCScheduleInternalServerError{} 443 } 444 445 /* 446 CreateGCScheduleInternalServerError describes a response with status code 500, with default header values. 447 448 Internal server error 449 */ 450 type CreateGCScheduleInternalServerError struct { 451 452 /* The ID of the corresponding request for the response 453 */ 454 XRequestID string 455 456 Payload *models.Errors 457 } 458 459 // IsSuccess returns true when this create Gc schedule internal server error response has a 2xx status code 460 func (o *CreateGCScheduleInternalServerError) IsSuccess() bool { 461 return false 462 } 463 464 // IsRedirect returns true when this create Gc schedule internal server error response has a 3xx status code 465 func (o *CreateGCScheduleInternalServerError) IsRedirect() bool { 466 return false 467 } 468 469 // IsClientError returns true when this create Gc schedule internal server error response has a 4xx status code 470 func (o *CreateGCScheduleInternalServerError) IsClientError() bool { 471 return false 472 } 473 474 // IsServerError returns true when this create Gc schedule internal server error response has a 5xx status code 475 func (o *CreateGCScheduleInternalServerError) IsServerError() bool { 476 return true 477 } 478 479 // IsCode returns true when this create Gc schedule internal server error response a status code equal to that given 480 func (o *CreateGCScheduleInternalServerError) IsCode(code int) bool { 481 return code == 500 482 } 483 484 func (o *CreateGCScheduleInternalServerError) Error() string { 485 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleInternalServerError %+v", 500, o.Payload) 486 } 487 488 func (o *CreateGCScheduleInternalServerError) String() string { 489 return fmt.Sprintf("[POST /system/gc/schedule][%d] createGcScheduleInternalServerError %+v", 500, o.Payload) 490 } 491 492 func (o *CreateGCScheduleInternalServerError) GetPayload() *models.Errors { 493 return o.Payload 494 } 495 496 func (o *CreateGCScheduleInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 497 498 // hydrates response header X-Request-Id 499 hdrXRequestID := response.GetHeader("X-Request-Id") 500 501 if hdrXRequestID != "" { 502 o.XRequestID = hdrXRequestID 503 } 504 505 o.Payload = new(models.Errors) 506 507 // response payload 508 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 509 return err 510 } 511 512 return nil 513 }