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