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