github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/registry/get_registry_info_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package registry 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 // GetRegistryInfoReader is a Reader for the GetRegistryInfo structure. 19 type GetRegistryInfoReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *GetRegistryInfoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 200: 27 result := NewGetRegistryInfoOK() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 case 401: 33 result := NewGetRegistryInfoUnauthorized() 34 if err := result.readResponse(response, consumer, o.formats); err != nil { 35 return nil, err 36 } 37 return nil, result 38 case 403: 39 result := NewGetRegistryInfoForbidden() 40 if err := result.readResponse(response, consumer, o.formats); err != nil { 41 return nil, err 42 } 43 return nil, result 44 case 404: 45 result := NewGetRegistryInfoNotFound() 46 if err := result.readResponse(response, consumer, o.formats); err != nil { 47 return nil, err 48 } 49 return nil, result 50 case 500: 51 result := NewGetRegistryInfoInternalServerError() 52 if err := result.readResponse(response, consumer, o.formats); err != nil { 53 return nil, err 54 } 55 return nil, result 56 default: 57 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 58 } 59 } 60 61 // NewGetRegistryInfoOK creates a GetRegistryInfoOK with default headers values 62 func NewGetRegistryInfoOK() *GetRegistryInfoOK { 63 return &GetRegistryInfoOK{} 64 } 65 66 /* 67 GetRegistryInfoOK describes a response with status code 200, with default header values. 68 69 Success 70 */ 71 type GetRegistryInfoOK struct { 72 Payload *models.RegistryInfo 73 } 74 75 // IsSuccess returns true when this get registry info o k response has a 2xx status code 76 func (o *GetRegistryInfoOK) IsSuccess() bool { 77 return true 78 } 79 80 // IsRedirect returns true when this get registry info o k response has a 3xx status code 81 func (o *GetRegistryInfoOK) IsRedirect() bool { 82 return false 83 } 84 85 // IsClientError returns true when this get registry info o k response has a 4xx status code 86 func (o *GetRegistryInfoOK) IsClientError() bool { 87 return false 88 } 89 90 // IsServerError returns true when this get registry info o k response has a 5xx status code 91 func (o *GetRegistryInfoOK) IsServerError() bool { 92 return false 93 } 94 95 // IsCode returns true when this get registry info o k response a status code equal to that given 96 func (o *GetRegistryInfoOK) IsCode(code int) bool { 97 return code == 200 98 } 99 100 func (o *GetRegistryInfoOK) Error() string { 101 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoOK %+v", 200, o.Payload) 102 } 103 104 func (o *GetRegistryInfoOK) String() string { 105 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoOK %+v", 200, o.Payload) 106 } 107 108 func (o *GetRegistryInfoOK) GetPayload() *models.RegistryInfo { 109 return o.Payload 110 } 111 112 func (o *GetRegistryInfoOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 113 114 o.Payload = new(models.RegistryInfo) 115 116 // response payload 117 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 118 return err 119 } 120 121 return nil 122 } 123 124 // NewGetRegistryInfoUnauthorized creates a GetRegistryInfoUnauthorized with default headers values 125 func NewGetRegistryInfoUnauthorized() *GetRegistryInfoUnauthorized { 126 return &GetRegistryInfoUnauthorized{} 127 } 128 129 /* 130 GetRegistryInfoUnauthorized describes a response with status code 401, with default header values. 131 132 Unauthorized 133 */ 134 type GetRegistryInfoUnauthorized struct { 135 136 /* The ID of the corresponding request for the response 137 */ 138 XRequestID string 139 140 Payload *models.Errors 141 } 142 143 // IsSuccess returns true when this get registry info unauthorized response has a 2xx status code 144 func (o *GetRegistryInfoUnauthorized) IsSuccess() bool { 145 return false 146 } 147 148 // IsRedirect returns true when this get registry info unauthorized response has a 3xx status code 149 func (o *GetRegistryInfoUnauthorized) IsRedirect() bool { 150 return false 151 } 152 153 // IsClientError returns true when this get registry info unauthorized response has a 4xx status code 154 func (o *GetRegistryInfoUnauthorized) IsClientError() bool { 155 return true 156 } 157 158 // IsServerError returns true when this get registry info unauthorized response has a 5xx status code 159 func (o *GetRegistryInfoUnauthorized) IsServerError() bool { 160 return false 161 } 162 163 // IsCode returns true when this get registry info unauthorized response a status code equal to that given 164 func (o *GetRegistryInfoUnauthorized) IsCode(code int) bool { 165 return code == 401 166 } 167 168 func (o *GetRegistryInfoUnauthorized) Error() string { 169 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoUnauthorized %+v", 401, o.Payload) 170 } 171 172 func (o *GetRegistryInfoUnauthorized) String() string { 173 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoUnauthorized %+v", 401, o.Payload) 174 } 175 176 func (o *GetRegistryInfoUnauthorized) GetPayload() *models.Errors { 177 return o.Payload 178 } 179 180 func (o *GetRegistryInfoUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 181 182 // hydrates response header X-Request-Id 183 hdrXRequestID := response.GetHeader("X-Request-Id") 184 185 if hdrXRequestID != "" { 186 o.XRequestID = hdrXRequestID 187 } 188 189 o.Payload = new(models.Errors) 190 191 // response payload 192 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 193 return err 194 } 195 196 return nil 197 } 198 199 // NewGetRegistryInfoForbidden creates a GetRegistryInfoForbidden with default headers values 200 func NewGetRegistryInfoForbidden() *GetRegistryInfoForbidden { 201 return &GetRegistryInfoForbidden{} 202 } 203 204 /* 205 GetRegistryInfoForbidden describes a response with status code 403, with default header values. 206 207 Forbidden 208 */ 209 type GetRegistryInfoForbidden struct { 210 211 /* The ID of the corresponding request for the response 212 */ 213 XRequestID string 214 215 Payload *models.Errors 216 } 217 218 // IsSuccess returns true when this get registry info forbidden response has a 2xx status code 219 func (o *GetRegistryInfoForbidden) IsSuccess() bool { 220 return false 221 } 222 223 // IsRedirect returns true when this get registry info forbidden response has a 3xx status code 224 func (o *GetRegistryInfoForbidden) IsRedirect() bool { 225 return false 226 } 227 228 // IsClientError returns true when this get registry info forbidden response has a 4xx status code 229 func (o *GetRegistryInfoForbidden) IsClientError() bool { 230 return true 231 } 232 233 // IsServerError returns true when this get registry info forbidden response has a 5xx status code 234 func (o *GetRegistryInfoForbidden) IsServerError() bool { 235 return false 236 } 237 238 // IsCode returns true when this get registry info forbidden response a status code equal to that given 239 func (o *GetRegistryInfoForbidden) IsCode(code int) bool { 240 return code == 403 241 } 242 243 func (o *GetRegistryInfoForbidden) Error() string { 244 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoForbidden %+v", 403, o.Payload) 245 } 246 247 func (o *GetRegistryInfoForbidden) String() string { 248 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoForbidden %+v", 403, o.Payload) 249 } 250 251 func (o *GetRegistryInfoForbidden) GetPayload() *models.Errors { 252 return o.Payload 253 } 254 255 func (o *GetRegistryInfoForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 256 257 // hydrates response header X-Request-Id 258 hdrXRequestID := response.GetHeader("X-Request-Id") 259 260 if hdrXRequestID != "" { 261 o.XRequestID = hdrXRequestID 262 } 263 264 o.Payload = new(models.Errors) 265 266 // response payload 267 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 268 return err 269 } 270 271 return nil 272 } 273 274 // NewGetRegistryInfoNotFound creates a GetRegistryInfoNotFound with default headers values 275 func NewGetRegistryInfoNotFound() *GetRegistryInfoNotFound { 276 return &GetRegistryInfoNotFound{} 277 } 278 279 /* 280 GetRegistryInfoNotFound describes a response with status code 404, with default header values. 281 282 Not found 283 */ 284 type GetRegistryInfoNotFound struct { 285 286 /* The ID of the corresponding request for the response 287 */ 288 XRequestID string 289 290 Payload *models.Errors 291 } 292 293 // IsSuccess returns true when this get registry info not found response has a 2xx status code 294 func (o *GetRegistryInfoNotFound) IsSuccess() bool { 295 return false 296 } 297 298 // IsRedirect returns true when this get registry info not found response has a 3xx status code 299 func (o *GetRegistryInfoNotFound) IsRedirect() bool { 300 return false 301 } 302 303 // IsClientError returns true when this get registry info not found response has a 4xx status code 304 func (o *GetRegistryInfoNotFound) IsClientError() bool { 305 return true 306 } 307 308 // IsServerError returns true when this get registry info not found response has a 5xx status code 309 func (o *GetRegistryInfoNotFound) IsServerError() bool { 310 return false 311 } 312 313 // IsCode returns true when this get registry info not found response a status code equal to that given 314 func (o *GetRegistryInfoNotFound) IsCode(code int) bool { 315 return code == 404 316 } 317 318 func (o *GetRegistryInfoNotFound) Error() string { 319 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoNotFound %+v", 404, o.Payload) 320 } 321 322 func (o *GetRegistryInfoNotFound) String() string { 323 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoNotFound %+v", 404, o.Payload) 324 } 325 326 func (o *GetRegistryInfoNotFound) GetPayload() *models.Errors { 327 return o.Payload 328 } 329 330 func (o *GetRegistryInfoNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 331 332 // hydrates response header X-Request-Id 333 hdrXRequestID := response.GetHeader("X-Request-Id") 334 335 if hdrXRequestID != "" { 336 o.XRequestID = hdrXRequestID 337 } 338 339 o.Payload = new(models.Errors) 340 341 // response payload 342 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 343 return err 344 } 345 346 return nil 347 } 348 349 // NewGetRegistryInfoInternalServerError creates a GetRegistryInfoInternalServerError with default headers values 350 func NewGetRegistryInfoInternalServerError() *GetRegistryInfoInternalServerError { 351 return &GetRegistryInfoInternalServerError{} 352 } 353 354 /* 355 GetRegistryInfoInternalServerError describes a response with status code 500, with default header values. 356 357 Internal server error 358 */ 359 type GetRegistryInfoInternalServerError struct { 360 361 /* The ID of the corresponding request for the response 362 */ 363 XRequestID string 364 365 Payload *models.Errors 366 } 367 368 // IsSuccess returns true when this get registry info internal server error response has a 2xx status code 369 func (o *GetRegistryInfoInternalServerError) IsSuccess() bool { 370 return false 371 } 372 373 // IsRedirect returns true when this get registry info internal server error response has a 3xx status code 374 func (o *GetRegistryInfoInternalServerError) IsRedirect() bool { 375 return false 376 } 377 378 // IsClientError returns true when this get registry info internal server error response has a 4xx status code 379 func (o *GetRegistryInfoInternalServerError) IsClientError() bool { 380 return false 381 } 382 383 // IsServerError returns true when this get registry info internal server error response has a 5xx status code 384 func (o *GetRegistryInfoInternalServerError) IsServerError() bool { 385 return true 386 } 387 388 // IsCode returns true when this get registry info internal server error response a status code equal to that given 389 func (o *GetRegistryInfoInternalServerError) IsCode(code int) bool { 390 return code == 500 391 } 392 393 func (o *GetRegistryInfoInternalServerError) Error() string { 394 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoInternalServerError %+v", 500, o.Payload) 395 } 396 397 func (o *GetRegistryInfoInternalServerError) String() string { 398 return fmt.Sprintf("[GET /registries/{id}/info][%d] getRegistryInfoInternalServerError %+v", 500, o.Payload) 399 } 400 401 func (o *GetRegistryInfoInternalServerError) GetPayload() *models.Errors { 402 return o.Payload 403 } 404 405 func (o *GetRegistryInfoInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 406 407 // hydrates response header X-Request-Id 408 hdrXRequestID := response.GetHeader("X-Request-Id") 409 410 if hdrXRequestID != "" { 411 o.XRequestID = hdrXRequestID 412 } 413 414 o.Payload = new(models.Errors) 415 416 // response payload 417 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 418 return err 419 } 420 421 return nil 422 }