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