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