github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/securityhub/list_vulnerabilities_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package securityhub 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 // ListVulnerabilitiesReader is a Reader for the ListVulnerabilities structure. 21 type ListVulnerabilitiesReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *ListVulnerabilitiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewListVulnerabilitiesOK() 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 := NewListVulnerabilitiesBadRequest() 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 := NewListVulnerabilitiesUnauthorized() 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 := NewListVulnerabilitiesInternalServerError() 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 // NewListVulnerabilitiesOK creates a ListVulnerabilitiesOK with default headers values 58 func NewListVulnerabilitiesOK() *ListVulnerabilitiesOK { 59 return &ListVulnerabilitiesOK{} 60 } 61 62 /* 63 ListVulnerabilitiesOK describes a response with status code 200, with default header values. 64 65 The vulnerability list. 66 */ 67 type ListVulnerabilitiesOK struct { 68 69 /* Link refers to the previous page and next page 70 */ 71 Link string 72 73 /* The total count of vulnerabilities 74 */ 75 XTotalCount int64 76 77 Payload []*models.VulnerabilityItem 78 } 79 80 // IsSuccess returns true when this list vulnerabilities o k response has a 2xx status code 81 func (o *ListVulnerabilitiesOK) IsSuccess() bool { 82 return true 83 } 84 85 // IsRedirect returns true when this list vulnerabilities o k response has a 3xx status code 86 func (o *ListVulnerabilitiesOK) IsRedirect() bool { 87 return false 88 } 89 90 // IsClientError returns true when this list vulnerabilities o k response has a 4xx status code 91 func (o *ListVulnerabilitiesOK) IsClientError() bool { 92 return false 93 } 94 95 // IsServerError returns true when this list vulnerabilities o k response has a 5xx status code 96 func (o *ListVulnerabilitiesOK) IsServerError() bool { 97 return false 98 } 99 100 // IsCode returns true when this list vulnerabilities o k response a status code equal to that given 101 func (o *ListVulnerabilitiesOK) IsCode(code int) bool { 102 return code == 200 103 } 104 105 func (o *ListVulnerabilitiesOK) Error() string { 106 return fmt.Sprintf("[GET /security/vul][%d] listVulnerabilitiesOK %+v", 200, o.Payload) 107 } 108 109 func (o *ListVulnerabilitiesOK) String() string { 110 return fmt.Sprintf("[GET /security/vul][%d] listVulnerabilitiesOK %+v", 200, o.Payload) 111 } 112 113 func (o *ListVulnerabilitiesOK) GetPayload() []*models.VulnerabilityItem { 114 return o.Payload 115 } 116 117 func (o *ListVulnerabilitiesOK) 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 // NewListVulnerabilitiesBadRequest creates a ListVulnerabilitiesBadRequest with default headers values 146 func NewListVulnerabilitiesBadRequest() *ListVulnerabilitiesBadRequest { 147 return &ListVulnerabilitiesBadRequest{} 148 } 149 150 /* 151 ListVulnerabilitiesBadRequest describes a response with status code 400, with default header values. 152 153 Bad request 154 */ 155 type ListVulnerabilitiesBadRequest 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 vulnerabilities bad request response has a 2xx status code 165 func (o *ListVulnerabilitiesBadRequest) IsSuccess() bool { 166 return false 167 } 168 169 // IsRedirect returns true when this list vulnerabilities bad request response has a 3xx status code 170 func (o *ListVulnerabilitiesBadRequest) IsRedirect() bool { 171 return false 172 } 173 174 // IsClientError returns true when this list vulnerabilities bad request response has a 4xx status code 175 func (o *ListVulnerabilitiesBadRequest) IsClientError() bool { 176 return true 177 } 178 179 // IsServerError returns true when this list vulnerabilities bad request response has a 5xx status code 180 func (o *ListVulnerabilitiesBadRequest) IsServerError() bool { 181 return false 182 } 183 184 // IsCode returns true when this list vulnerabilities bad request response a status code equal to that given 185 func (o *ListVulnerabilitiesBadRequest) IsCode(code int) bool { 186 return code == 400 187 } 188 189 func (o *ListVulnerabilitiesBadRequest) Error() string { 190 return fmt.Sprintf("[GET /security/vul][%d] listVulnerabilitiesBadRequest %+v", 400, o.Payload) 191 } 192 193 func (o *ListVulnerabilitiesBadRequest) String() string { 194 return fmt.Sprintf("[GET /security/vul][%d] listVulnerabilitiesBadRequest %+v", 400, o.Payload) 195 } 196 197 func (o *ListVulnerabilitiesBadRequest) GetPayload() *models.Errors { 198 return o.Payload 199 } 200 201 func (o *ListVulnerabilitiesBadRequest) 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 // NewListVulnerabilitiesUnauthorized creates a ListVulnerabilitiesUnauthorized with default headers values 221 func NewListVulnerabilitiesUnauthorized() *ListVulnerabilitiesUnauthorized { 222 return &ListVulnerabilitiesUnauthorized{} 223 } 224 225 /* 226 ListVulnerabilitiesUnauthorized describes a response with status code 401, with default header values. 227 228 Unauthorized 229 */ 230 type ListVulnerabilitiesUnauthorized 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 vulnerabilities unauthorized response has a 2xx status code 240 func (o *ListVulnerabilitiesUnauthorized) IsSuccess() bool { 241 return false 242 } 243 244 // IsRedirect returns true when this list vulnerabilities unauthorized response has a 3xx status code 245 func (o *ListVulnerabilitiesUnauthorized) IsRedirect() bool { 246 return false 247 } 248 249 // IsClientError returns true when this list vulnerabilities unauthorized response has a 4xx status code 250 func (o *ListVulnerabilitiesUnauthorized) IsClientError() bool { 251 return true 252 } 253 254 // IsServerError returns true when this list vulnerabilities unauthorized response has a 5xx status code 255 func (o *ListVulnerabilitiesUnauthorized) IsServerError() bool { 256 return false 257 } 258 259 // IsCode returns true when this list vulnerabilities unauthorized response a status code equal to that given 260 func (o *ListVulnerabilitiesUnauthorized) IsCode(code int) bool { 261 return code == 401 262 } 263 264 func (o *ListVulnerabilitiesUnauthorized) Error() string { 265 return fmt.Sprintf("[GET /security/vul][%d] listVulnerabilitiesUnauthorized %+v", 401, o.Payload) 266 } 267 268 func (o *ListVulnerabilitiesUnauthorized) String() string { 269 return fmt.Sprintf("[GET /security/vul][%d] listVulnerabilitiesUnauthorized %+v", 401, o.Payload) 270 } 271 272 func (o *ListVulnerabilitiesUnauthorized) GetPayload() *models.Errors { 273 return o.Payload 274 } 275 276 func (o *ListVulnerabilitiesUnauthorized) 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 // NewListVulnerabilitiesInternalServerError creates a ListVulnerabilitiesInternalServerError with default headers values 296 func NewListVulnerabilitiesInternalServerError() *ListVulnerabilitiesInternalServerError { 297 return &ListVulnerabilitiesInternalServerError{} 298 } 299 300 /* 301 ListVulnerabilitiesInternalServerError describes a response with status code 500, with default header values. 302 303 Internal server error 304 */ 305 type ListVulnerabilitiesInternalServerError 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 vulnerabilities internal server error response has a 2xx status code 315 func (o *ListVulnerabilitiesInternalServerError) IsSuccess() bool { 316 return false 317 } 318 319 // IsRedirect returns true when this list vulnerabilities internal server error response has a 3xx status code 320 func (o *ListVulnerabilitiesInternalServerError) IsRedirect() bool { 321 return false 322 } 323 324 // IsClientError returns true when this list vulnerabilities internal server error response has a 4xx status code 325 func (o *ListVulnerabilitiesInternalServerError) IsClientError() bool { 326 return false 327 } 328 329 // IsServerError returns true when this list vulnerabilities internal server error response has a 5xx status code 330 func (o *ListVulnerabilitiesInternalServerError) IsServerError() bool { 331 return true 332 } 333 334 // IsCode returns true when this list vulnerabilities internal server error response a status code equal to that given 335 func (o *ListVulnerabilitiesInternalServerError) IsCode(code int) bool { 336 return code == 500 337 } 338 339 func (o *ListVulnerabilitiesInternalServerError) Error() string { 340 return fmt.Sprintf("[GET /security/vul][%d] listVulnerabilitiesInternalServerError %+v", 500, o.Payload) 341 } 342 343 func (o *ListVulnerabilitiesInternalServerError) String() string { 344 return fmt.Sprintf("[GET /security/vul][%d] listVulnerabilitiesInternalServerError %+v", 500, o.Payload) 345 } 346 347 func (o *ListVulnerabilitiesInternalServerError) GetPayload() *models.Errors { 348 return o.Payload 349 } 350 351 func (o *ListVulnerabilitiesInternalServerError) 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 }