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