github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/retention/operate_retention_execution_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package retention 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 "context" 10 "fmt" 11 "io" 12 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 // OperateRetentionExecutionReader is a Reader for the OperateRetentionExecution structure. 21 type OperateRetentionExecutionReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *OperateRetentionExecutionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewOperateRetentionExecutionOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 case 401: 35 result := NewOperateRetentionExecutionUnauthorized() 36 if err := result.readResponse(response, consumer, o.formats); err != nil { 37 return nil, err 38 } 39 return nil, result 40 case 403: 41 result := NewOperateRetentionExecutionForbidden() 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 := NewOperateRetentionExecutionInternalServerError() 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 // NewOperateRetentionExecutionOK creates a OperateRetentionExecutionOK with default headers values 58 func NewOperateRetentionExecutionOK() *OperateRetentionExecutionOK { 59 return &OperateRetentionExecutionOK{} 60 } 61 62 /* 63 OperateRetentionExecutionOK describes a response with status code 200, with default header values. 64 65 Stop a Retention job successfully. 66 */ 67 type OperateRetentionExecutionOK struct { 68 } 69 70 // IsSuccess returns true when this operate retention execution o k response has a 2xx status code 71 func (o *OperateRetentionExecutionOK) IsSuccess() bool { 72 return true 73 } 74 75 // IsRedirect returns true when this operate retention execution o k response has a 3xx status code 76 func (o *OperateRetentionExecutionOK) IsRedirect() bool { 77 return false 78 } 79 80 // IsClientError returns true when this operate retention execution o k response has a 4xx status code 81 func (o *OperateRetentionExecutionOK) IsClientError() bool { 82 return false 83 } 84 85 // IsServerError returns true when this operate retention execution o k response has a 5xx status code 86 func (o *OperateRetentionExecutionOK) IsServerError() bool { 87 return false 88 } 89 90 // IsCode returns true when this operate retention execution o k response a status code equal to that given 91 func (o *OperateRetentionExecutionOK) IsCode(code int) bool { 92 return code == 200 93 } 94 95 func (o *OperateRetentionExecutionOK) Error() string { 96 return fmt.Sprintf("[PATCH /retentions/{id}/executions/{eid}][%d] operateRetentionExecutionOK ", 200) 97 } 98 99 func (o *OperateRetentionExecutionOK) String() string { 100 return fmt.Sprintf("[PATCH /retentions/{id}/executions/{eid}][%d] operateRetentionExecutionOK ", 200) 101 } 102 103 func (o *OperateRetentionExecutionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 104 105 return nil 106 } 107 108 // NewOperateRetentionExecutionUnauthorized creates a OperateRetentionExecutionUnauthorized with default headers values 109 func NewOperateRetentionExecutionUnauthorized() *OperateRetentionExecutionUnauthorized { 110 return &OperateRetentionExecutionUnauthorized{} 111 } 112 113 /* 114 OperateRetentionExecutionUnauthorized describes a response with status code 401, with default header values. 115 116 Unauthorized 117 */ 118 type OperateRetentionExecutionUnauthorized struct { 119 120 /* The ID of the corresponding request for the response 121 */ 122 XRequestID string 123 124 Payload *models.Errors 125 } 126 127 // IsSuccess returns true when this operate retention execution unauthorized response has a 2xx status code 128 func (o *OperateRetentionExecutionUnauthorized) IsSuccess() bool { 129 return false 130 } 131 132 // IsRedirect returns true when this operate retention execution unauthorized response has a 3xx status code 133 func (o *OperateRetentionExecutionUnauthorized) IsRedirect() bool { 134 return false 135 } 136 137 // IsClientError returns true when this operate retention execution unauthorized response has a 4xx status code 138 func (o *OperateRetentionExecutionUnauthorized) IsClientError() bool { 139 return true 140 } 141 142 // IsServerError returns true when this operate retention execution unauthorized response has a 5xx status code 143 func (o *OperateRetentionExecutionUnauthorized) IsServerError() bool { 144 return false 145 } 146 147 // IsCode returns true when this operate retention execution unauthorized response a status code equal to that given 148 func (o *OperateRetentionExecutionUnauthorized) IsCode(code int) bool { 149 return code == 401 150 } 151 152 func (o *OperateRetentionExecutionUnauthorized) Error() string { 153 return fmt.Sprintf("[PATCH /retentions/{id}/executions/{eid}][%d] operateRetentionExecutionUnauthorized %+v", 401, o.Payload) 154 } 155 156 func (o *OperateRetentionExecutionUnauthorized) String() string { 157 return fmt.Sprintf("[PATCH /retentions/{id}/executions/{eid}][%d] operateRetentionExecutionUnauthorized %+v", 401, o.Payload) 158 } 159 160 func (o *OperateRetentionExecutionUnauthorized) GetPayload() *models.Errors { 161 return o.Payload 162 } 163 164 func (o *OperateRetentionExecutionUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 165 166 // hydrates response header X-Request-Id 167 hdrXRequestID := response.GetHeader("X-Request-Id") 168 169 if hdrXRequestID != "" { 170 o.XRequestID = hdrXRequestID 171 } 172 173 o.Payload = new(models.Errors) 174 175 // response payload 176 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 177 return err 178 } 179 180 return nil 181 } 182 183 // NewOperateRetentionExecutionForbidden creates a OperateRetentionExecutionForbidden with default headers values 184 func NewOperateRetentionExecutionForbidden() *OperateRetentionExecutionForbidden { 185 return &OperateRetentionExecutionForbidden{} 186 } 187 188 /* 189 OperateRetentionExecutionForbidden describes a response with status code 403, with default header values. 190 191 Forbidden 192 */ 193 type OperateRetentionExecutionForbidden struct { 194 195 /* The ID of the corresponding request for the response 196 */ 197 XRequestID string 198 199 Payload *models.Errors 200 } 201 202 // IsSuccess returns true when this operate retention execution forbidden response has a 2xx status code 203 func (o *OperateRetentionExecutionForbidden) IsSuccess() bool { 204 return false 205 } 206 207 // IsRedirect returns true when this operate retention execution forbidden response has a 3xx status code 208 func (o *OperateRetentionExecutionForbidden) IsRedirect() bool { 209 return false 210 } 211 212 // IsClientError returns true when this operate retention execution forbidden response has a 4xx status code 213 func (o *OperateRetentionExecutionForbidden) IsClientError() bool { 214 return true 215 } 216 217 // IsServerError returns true when this operate retention execution forbidden response has a 5xx status code 218 func (o *OperateRetentionExecutionForbidden) IsServerError() bool { 219 return false 220 } 221 222 // IsCode returns true when this operate retention execution forbidden response a status code equal to that given 223 func (o *OperateRetentionExecutionForbidden) IsCode(code int) bool { 224 return code == 403 225 } 226 227 func (o *OperateRetentionExecutionForbidden) Error() string { 228 return fmt.Sprintf("[PATCH /retentions/{id}/executions/{eid}][%d] operateRetentionExecutionForbidden %+v", 403, o.Payload) 229 } 230 231 func (o *OperateRetentionExecutionForbidden) String() string { 232 return fmt.Sprintf("[PATCH /retentions/{id}/executions/{eid}][%d] operateRetentionExecutionForbidden %+v", 403, o.Payload) 233 } 234 235 func (o *OperateRetentionExecutionForbidden) GetPayload() *models.Errors { 236 return o.Payload 237 } 238 239 func (o *OperateRetentionExecutionForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 240 241 // hydrates response header X-Request-Id 242 hdrXRequestID := response.GetHeader("X-Request-Id") 243 244 if hdrXRequestID != "" { 245 o.XRequestID = hdrXRequestID 246 } 247 248 o.Payload = new(models.Errors) 249 250 // response payload 251 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 252 return err 253 } 254 255 return nil 256 } 257 258 // NewOperateRetentionExecutionInternalServerError creates a OperateRetentionExecutionInternalServerError with default headers values 259 func NewOperateRetentionExecutionInternalServerError() *OperateRetentionExecutionInternalServerError { 260 return &OperateRetentionExecutionInternalServerError{} 261 } 262 263 /* 264 OperateRetentionExecutionInternalServerError describes a response with status code 500, with default header values. 265 266 Internal server error 267 */ 268 type OperateRetentionExecutionInternalServerError struct { 269 270 /* The ID of the corresponding request for the response 271 */ 272 XRequestID string 273 274 Payload *models.Errors 275 } 276 277 // IsSuccess returns true when this operate retention execution internal server error response has a 2xx status code 278 func (o *OperateRetentionExecutionInternalServerError) IsSuccess() bool { 279 return false 280 } 281 282 // IsRedirect returns true when this operate retention execution internal server error response has a 3xx status code 283 func (o *OperateRetentionExecutionInternalServerError) IsRedirect() bool { 284 return false 285 } 286 287 // IsClientError returns true when this operate retention execution internal server error response has a 4xx status code 288 func (o *OperateRetentionExecutionInternalServerError) IsClientError() bool { 289 return false 290 } 291 292 // IsServerError returns true when this operate retention execution internal server error response has a 5xx status code 293 func (o *OperateRetentionExecutionInternalServerError) IsServerError() bool { 294 return true 295 } 296 297 // IsCode returns true when this operate retention execution internal server error response a status code equal to that given 298 func (o *OperateRetentionExecutionInternalServerError) IsCode(code int) bool { 299 return code == 500 300 } 301 302 func (o *OperateRetentionExecutionInternalServerError) Error() string { 303 return fmt.Sprintf("[PATCH /retentions/{id}/executions/{eid}][%d] operateRetentionExecutionInternalServerError %+v", 500, o.Payload) 304 } 305 306 func (o *OperateRetentionExecutionInternalServerError) String() string { 307 return fmt.Sprintf("[PATCH /retentions/{id}/executions/{eid}][%d] operateRetentionExecutionInternalServerError %+v", 500, o.Payload) 308 } 309 310 func (o *OperateRetentionExecutionInternalServerError) GetPayload() *models.Errors { 311 return o.Payload 312 } 313 314 func (o *OperateRetentionExecutionInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 315 316 // hydrates response header X-Request-Id 317 hdrXRequestID := response.GetHeader("X-Request-Id") 318 319 if hdrXRequestID != "" { 320 o.XRequestID = hdrXRequestID 321 } 322 323 o.Payload = new(models.Errors) 324 325 // response payload 326 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 327 return err 328 } 329 330 return nil 331 } 332 333 /* 334 OperateRetentionExecutionBody operate retention execution body 335 swagger:model OperateRetentionExecutionBody 336 */ 337 type OperateRetentionExecutionBody struct { 338 339 // action 340 Action string `json:"action,omitempty"` 341 } 342 343 // Validate validates this operate retention execution body 344 func (o *OperateRetentionExecutionBody) Validate(formats strfmt.Registry) error { 345 return nil 346 } 347 348 // ContextValidate validates this operate retention execution body based on context it is used 349 func (o *OperateRetentionExecutionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 350 return nil 351 } 352 353 // MarshalBinary interface implementation 354 func (o *OperateRetentionExecutionBody) MarshalBinary() ([]byte, error) { 355 if o == nil { 356 return nil, nil 357 } 358 return swag.WriteJSON(o) 359 } 360 361 // UnmarshalBinary interface implementation 362 func (o *OperateRetentionExecutionBody) UnmarshalBinary(b []byte) error { 363 var res OperateRetentionExecutionBody 364 if err := swag.ReadJSON(b, &res); err != nil { 365 return err 366 } 367 *o = res 368 return nil 369 }