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