github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/registry/list_registries_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/errors" 13 "github.com/go-openapi/runtime" 14 "github.com/go-openapi/strfmt" 15 "github.com/go-openapi/swag" 16 17 "github.com/goharbor/go-client/pkg/sdk/v2.0/models" 18 ) 19 20 // ListRegistriesReader is a Reader for the ListRegistries structure. 21 type ListRegistriesReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *ListRegistriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewListRegistriesOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 case 401: 35 result := NewListRegistriesUnauthorized() 36 if err := result.readResponse(response, consumer, o.formats); err != nil { 37 return nil, err 38 } 39 return nil, result 40 case 403: 41 result := NewListRegistriesForbidden() 42 if err := result.readResponse(response, consumer, o.formats); err != nil { 43 return nil, err 44 } 45 return nil, result 46 case 500: 47 result := NewListRegistriesInternalServerError() 48 if err := result.readResponse(response, consumer, o.formats); err != nil { 49 return nil, err 50 } 51 return nil, result 52 default: 53 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 54 } 55 } 56 57 // NewListRegistriesOK creates a ListRegistriesOK with default headers values 58 func NewListRegistriesOK() *ListRegistriesOK { 59 return &ListRegistriesOK{} 60 } 61 62 /* 63 ListRegistriesOK describes a response with status code 200, with default header values. 64 65 Success 66 */ 67 type ListRegistriesOK struct { 68 69 /* Link refers to the previous page and next page 70 */ 71 Link string 72 73 /* The total count of the resources 74 */ 75 XTotalCount int64 76 77 Payload []*models.Registry 78 } 79 80 // IsSuccess returns true when this list registries o k response has a 2xx status code 81 func (o *ListRegistriesOK) IsSuccess() bool { 82 return true 83 } 84 85 // IsRedirect returns true when this list registries o k response has a 3xx status code 86 func (o *ListRegistriesOK) IsRedirect() bool { 87 return false 88 } 89 90 // IsClientError returns true when this list registries o k response has a 4xx status code 91 func (o *ListRegistriesOK) IsClientError() bool { 92 return false 93 } 94 95 // IsServerError returns true when this list registries o k response has a 5xx status code 96 func (o *ListRegistriesOK) IsServerError() bool { 97 return false 98 } 99 100 // IsCode returns true when this list registries o k response a status code equal to that given 101 func (o *ListRegistriesOK) IsCode(code int) bool { 102 return code == 200 103 } 104 105 func (o *ListRegistriesOK) Error() string { 106 return fmt.Sprintf("[GET /registries][%d] listRegistriesOK %+v", 200, o.Payload) 107 } 108 109 func (o *ListRegistriesOK) String() string { 110 return fmt.Sprintf("[GET /registries][%d] listRegistriesOK %+v", 200, o.Payload) 111 } 112 113 func (o *ListRegistriesOK) GetPayload() []*models.Registry { 114 return o.Payload 115 } 116 117 func (o *ListRegistriesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 118 119 // hydrates response header Link 120 hdrLink := response.GetHeader("Link") 121 122 if hdrLink != "" { 123 o.Link = hdrLink 124 } 125 126 // hydrates response header X-Total-Count 127 hdrXTotalCount := response.GetHeader("X-Total-Count") 128 129 if hdrXTotalCount != "" { 130 valxTotalCount, err := swag.ConvertInt64(hdrXTotalCount) 131 if err != nil { 132 return errors.InvalidType("X-Total-Count", "header", "int64", hdrXTotalCount) 133 } 134 o.XTotalCount = valxTotalCount 135 } 136 137 // response payload 138 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 139 return err 140 } 141 142 return nil 143 } 144 145 // NewListRegistriesUnauthorized creates a ListRegistriesUnauthorized with default headers values 146 func NewListRegistriesUnauthorized() *ListRegistriesUnauthorized { 147 return &ListRegistriesUnauthorized{} 148 } 149 150 /* 151 ListRegistriesUnauthorized describes a response with status code 401, with default header values. 152 153 Unauthorized 154 */ 155 type ListRegistriesUnauthorized struct { 156 157 /* The ID of the corresponding request for the response 158 */ 159 XRequestID string 160 161 Payload *models.Errors 162 } 163 164 // IsSuccess returns true when this list registries unauthorized response has a 2xx status code 165 func (o *ListRegistriesUnauthorized) IsSuccess() bool { 166 return false 167 } 168 169 // IsRedirect returns true when this list registries unauthorized response has a 3xx status code 170 func (o *ListRegistriesUnauthorized) IsRedirect() bool { 171 return false 172 } 173 174 // IsClientError returns true when this list registries unauthorized response has a 4xx status code 175 func (o *ListRegistriesUnauthorized) IsClientError() bool { 176 return true 177 } 178 179 // IsServerError returns true when this list registries unauthorized response has a 5xx status code 180 func (o *ListRegistriesUnauthorized) IsServerError() bool { 181 return false 182 } 183 184 // IsCode returns true when this list registries unauthorized response a status code equal to that given 185 func (o *ListRegistriesUnauthorized) IsCode(code int) bool { 186 return code == 401 187 } 188 189 func (o *ListRegistriesUnauthorized) Error() string { 190 return fmt.Sprintf("[GET /registries][%d] listRegistriesUnauthorized %+v", 401, o.Payload) 191 } 192 193 func (o *ListRegistriesUnauthorized) String() string { 194 return fmt.Sprintf("[GET /registries][%d] listRegistriesUnauthorized %+v", 401, o.Payload) 195 } 196 197 func (o *ListRegistriesUnauthorized) GetPayload() *models.Errors { 198 return o.Payload 199 } 200 201 func (o *ListRegistriesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 202 203 // hydrates response header X-Request-Id 204 hdrXRequestID := response.GetHeader("X-Request-Id") 205 206 if hdrXRequestID != "" { 207 o.XRequestID = hdrXRequestID 208 } 209 210 o.Payload = new(models.Errors) 211 212 // response payload 213 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 214 return err 215 } 216 217 return nil 218 } 219 220 // NewListRegistriesForbidden creates a ListRegistriesForbidden with default headers values 221 func NewListRegistriesForbidden() *ListRegistriesForbidden { 222 return &ListRegistriesForbidden{} 223 } 224 225 /* 226 ListRegistriesForbidden describes a response with status code 403, with default header values. 227 228 Forbidden 229 */ 230 type ListRegistriesForbidden struct { 231 232 /* The ID of the corresponding request for the response 233 */ 234 XRequestID string 235 236 Payload *models.Errors 237 } 238 239 // IsSuccess returns true when this list registries forbidden response has a 2xx status code 240 func (o *ListRegistriesForbidden) IsSuccess() bool { 241 return false 242 } 243 244 // IsRedirect returns true when this list registries forbidden response has a 3xx status code 245 func (o *ListRegistriesForbidden) IsRedirect() bool { 246 return false 247 } 248 249 // IsClientError returns true when this list registries forbidden response has a 4xx status code 250 func (o *ListRegistriesForbidden) IsClientError() bool { 251 return true 252 } 253 254 // IsServerError returns true when this list registries forbidden response has a 5xx status code 255 func (o *ListRegistriesForbidden) IsServerError() bool { 256 return false 257 } 258 259 // IsCode returns true when this list registries forbidden response a status code equal to that given 260 func (o *ListRegistriesForbidden) IsCode(code int) bool { 261 return code == 403 262 } 263 264 func (o *ListRegistriesForbidden) Error() string { 265 return fmt.Sprintf("[GET /registries][%d] listRegistriesForbidden %+v", 403, o.Payload) 266 } 267 268 func (o *ListRegistriesForbidden) String() string { 269 return fmt.Sprintf("[GET /registries][%d] listRegistriesForbidden %+v", 403, o.Payload) 270 } 271 272 func (o *ListRegistriesForbidden) GetPayload() *models.Errors { 273 return o.Payload 274 } 275 276 func (o *ListRegistriesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 277 278 // hydrates response header X-Request-Id 279 hdrXRequestID := response.GetHeader("X-Request-Id") 280 281 if hdrXRequestID != "" { 282 o.XRequestID = hdrXRequestID 283 } 284 285 o.Payload = new(models.Errors) 286 287 // response payload 288 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 289 return err 290 } 291 292 return nil 293 } 294 295 // NewListRegistriesInternalServerError creates a ListRegistriesInternalServerError with default headers values 296 func NewListRegistriesInternalServerError() *ListRegistriesInternalServerError { 297 return &ListRegistriesInternalServerError{} 298 } 299 300 /* 301 ListRegistriesInternalServerError describes a response with status code 500, with default header values. 302 303 Internal server error 304 */ 305 type ListRegistriesInternalServerError struct { 306 307 /* The ID of the corresponding request for the response 308 */ 309 XRequestID string 310 311 Payload *models.Errors 312 } 313 314 // IsSuccess returns true when this list registries internal server error response has a 2xx status code 315 func (o *ListRegistriesInternalServerError) IsSuccess() bool { 316 return false 317 } 318 319 // IsRedirect returns true when this list registries internal server error response has a 3xx status code 320 func (o *ListRegistriesInternalServerError) IsRedirect() bool { 321 return false 322 } 323 324 // IsClientError returns true when this list registries internal server error response has a 4xx status code 325 func (o *ListRegistriesInternalServerError) IsClientError() bool { 326 return false 327 } 328 329 // IsServerError returns true when this list registries internal server error response has a 5xx status code 330 func (o *ListRegistriesInternalServerError) IsServerError() bool { 331 return true 332 } 333 334 // IsCode returns true when this list registries internal server error response a status code equal to that given 335 func (o *ListRegistriesInternalServerError) IsCode(code int) bool { 336 return code == 500 337 } 338 339 func (o *ListRegistriesInternalServerError) Error() string { 340 return fmt.Sprintf("[GET /registries][%d] listRegistriesInternalServerError %+v", 500, o.Payload) 341 } 342 343 func (o *ListRegistriesInternalServerError) String() string { 344 return fmt.Sprintf("[GET /registries][%d] listRegistriesInternalServerError %+v", 500, o.Payload) 345 } 346 347 func (o *ListRegistriesInternalServerError) GetPayload() *models.Errors { 348 return o.Payload 349 } 350 351 func (o *ListRegistriesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 352 353 // hydrates response header X-Request-Id 354 hdrXRequestID := response.GetHeader("X-Request-Id") 355 356 if hdrXRequestID != "" { 357 o.XRequestID = hdrXRequestID 358 } 359 360 o.Payload = new(models.Errors) 361 362 // response payload 363 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 364 return err 365 } 366 367 return nil 368 }