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