github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/retention/update_retention_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 "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 // UpdateRetentionReader is a Reader for the UpdateRetention structure. 19 type UpdateRetentionReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *UpdateRetentionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 200: 27 result := NewUpdateRetentionOK() 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 := NewUpdateRetentionUnauthorized() 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 := NewUpdateRetentionForbidden() 40 if err := result.readResponse(response, consumer, o.formats); err != nil { 41 return nil, err 42 } 43 return nil, result 44 case 500: 45 result := NewUpdateRetentionInternalServerError() 46 if err := result.readResponse(response, consumer, o.formats); err != nil { 47 return nil, err 48 } 49 return nil, result 50 default: 51 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 52 } 53 } 54 55 // NewUpdateRetentionOK creates a UpdateRetentionOK with default headers values 56 func NewUpdateRetentionOK() *UpdateRetentionOK { 57 return &UpdateRetentionOK{} 58 } 59 60 /* 61 UpdateRetentionOK describes a response with status code 200, with default header values. 62 63 Update Retention Policy successfully. 64 */ 65 type UpdateRetentionOK struct { 66 } 67 68 // IsSuccess returns true when this update retention o k response has a 2xx status code 69 func (o *UpdateRetentionOK) IsSuccess() bool { 70 return true 71 } 72 73 // IsRedirect returns true when this update retention o k response has a 3xx status code 74 func (o *UpdateRetentionOK) IsRedirect() bool { 75 return false 76 } 77 78 // IsClientError returns true when this update retention o k response has a 4xx status code 79 func (o *UpdateRetentionOK) IsClientError() bool { 80 return false 81 } 82 83 // IsServerError returns true when this update retention o k response has a 5xx status code 84 func (o *UpdateRetentionOK) IsServerError() bool { 85 return false 86 } 87 88 // IsCode returns true when this update retention o k response a status code equal to that given 89 func (o *UpdateRetentionOK) IsCode(code int) bool { 90 return code == 200 91 } 92 93 func (o *UpdateRetentionOK) Error() string { 94 return fmt.Sprintf("[PUT /retentions/{id}][%d] updateRetentionOK ", 200) 95 } 96 97 func (o *UpdateRetentionOK) String() string { 98 return fmt.Sprintf("[PUT /retentions/{id}][%d] updateRetentionOK ", 200) 99 } 100 101 func (o *UpdateRetentionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 102 103 return nil 104 } 105 106 // NewUpdateRetentionUnauthorized creates a UpdateRetentionUnauthorized with default headers values 107 func NewUpdateRetentionUnauthorized() *UpdateRetentionUnauthorized { 108 return &UpdateRetentionUnauthorized{} 109 } 110 111 /* 112 UpdateRetentionUnauthorized describes a response with status code 401, with default header values. 113 114 Unauthorized 115 */ 116 type UpdateRetentionUnauthorized struct { 117 118 /* The ID of the corresponding request for the response 119 */ 120 XRequestID string 121 122 Payload *models.Errors 123 } 124 125 // IsSuccess returns true when this update retention unauthorized response has a 2xx status code 126 func (o *UpdateRetentionUnauthorized) IsSuccess() bool { 127 return false 128 } 129 130 // IsRedirect returns true when this update retention unauthorized response has a 3xx status code 131 func (o *UpdateRetentionUnauthorized) IsRedirect() bool { 132 return false 133 } 134 135 // IsClientError returns true when this update retention unauthorized response has a 4xx status code 136 func (o *UpdateRetentionUnauthorized) IsClientError() bool { 137 return true 138 } 139 140 // IsServerError returns true when this update retention unauthorized response has a 5xx status code 141 func (o *UpdateRetentionUnauthorized) IsServerError() bool { 142 return false 143 } 144 145 // IsCode returns true when this update retention unauthorized response a status code equal to that given 146 func (o *UpdateRetentionUnauthorized) IsCode(code int) bool { 147 return code == 401 148 } 149 150 func (o *UpdateRetentionUnauthorized) Error() string { 151 return fmt.Sprintf("[PUT /retentions/{id}][%d] updateRetentionUnauthorized %+v", 401, o.Payload) 152 } 153 154 func (o *UpdateRetentionUnauthorized) String() string { 155 return fmt.Sprintf("[PUT /retentions/{id}][%d] updateRetentionUnauthorized %+v", 401, o.Payload) 156 } 157 158 func (o *UpdateRetentionUnauthorized) GetPayload() *models.Errors { 159 return o.Payload 160 } 161 162 func (o *UpdateRetentionUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 163 164 // hydrates response header X-Request-Id 165 hdrXRequestID := response.GetHeader("X-Request-Id") 166 167 if hdrXRequestID != "" { 168 o.XRequestID = hdrXRequestID 169 } 170 171 o.Payload = new(models.Errors) 172 173 // response payload 174 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 175 return err 176 } 177 178 return nil 179 } 180 181 // NewUpdateRetentionForbidden creates a UpdateRetentionForbidden with default headers values 182 func NewUpdateRetentionForbidden() *UpdateRetentionForbidden { 183 return &UpdateRetentionForbidden{} 184 } 185 186 /* 187 UpdateRetentionForbidden describes a response with status code 403, with default header values. 188 189 Forbidden 190 */ 191 type UpdateRetentionForbidden struct { 192 193 /* The ID of the corresponding request for the response 194 */ 195 XRequestID string 196 197 Payload *models.Errors 198 } 199 200 // IsSuccess returns true when this update retention forbidden response has a 2xx status code 201 func (o *UpdateRetentionForbidden) IsSuccess() bool { 202 return false 203 } 204 205 // IsRedirect returns true when this update retention forbidden response has a 3xx status code 206 func (o *UpdateRetentionForbidden) IsRedirect() bool { 207 return false 208 } 209 210 // IsClientError returns true when this update retention forbidden response has a 4xx status code 211 func (o *UpdateRetentionForbidden) IsClientError() bool { 212 return true 213 } 214 215 // IsServerError returns true when this update retention forbidden response has a 5xx status code 216 func (o *UpdateRetentionForbidden) IsServerError() bool { 217 return false 218 } 219 220 // IsCode returns true when this update retention forbidden response a status code equal to that given 221 func (o *UpdateRetentionForbidden) IsCode(code int) bool { 222 return code == 403 223 } 224 225 func (o *UpdateRetentionForbidden) Error() string { 226 return fmt.Sprintf("[PUT /retentions/{id}][%d] updateRetentionForbidden %+v", 403, o.Payload) 227 } 228 229 func (o *UpdateRetentionForbidden) String() string { 230 return fmt.Sprintf("[PUT /retentions/{id}][%d] updateRetentionForbidden %+v", 403, o.Payload) 231 } 232 233 func (o *UpdateRetentionForbidden) GetPayload() *models.Errors { 234 return o.Payload 235 } 236 237 func (o *UpdateRetentionForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 238 239 // hydrates response header X-Request-Id 240 hdrXRequestID := response.GetHeader("X-Request-Id") 241 242 if hdrXRequestID != "" { 243 o.XRequestID = hdrXRequestID 244 } 245 246 o.Payload = new(models.Errors) 247 248 // response payload 249 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 250 return err 251 } 252 253 return nil 254 } 255 256 // NewUpdateRetentionInternalServerError creates a UpdateRetentionInternalServerError with default headers values 257 func NewUpdateRetentionInternalServerError() *UpdateRetentionInternalServerError { 258 return &UpdateRetentionInternalServerError{} 259 } 260 261 /* 262 UpdateRetentionInternalServerError describes a response with status code 500, with default header values. 263 264 Internal server error 265 */ 266 type UpdateRetentionInternalServerError struct { 267 268 /* The ID of the corresponding request for the response 269 */ 270 XRequestID string 271 272 Payload *models.Errors 273 } 274 275 // IsSuccess returns true when this update retention internal server error response has a 2xx status code 276 func (o *UpdateRetentionInternalServerError) IsSuccess() bool { 277 return false 278 } 279 280 // IsRedirect returns true when this update retention internal server error response has a 3xx status code 281 func (o *UpdateRetentionInternalServerError) IsRedirect() bool { 282 return false 283 } 284 285 // IsClientError returns true when this update retention internal server error response has a 4xx status code 286 func (o *UpdateRetentionInternalServerError) IsClientError() bool { 287 return false 288 } 289 290 // IsServerError returns true when this update retention internal server error response has a 5xx status code 291 func (o *UpdateRetentionInternalServerError) IsServerError() bool { 292 return true 293 } 294 295 // IsCode returns true when this update retention internal server error response a status code equal to that given 296 func (o *UpdateRetentionInternalServerError) IsCode(code int) bool { 297 return code == 500 298 } 299 300 func (o *UpdateRetentionInternalServerError) Error() string { 301 return fmt.Sprintf("[PUT /retentions/{id}][%d] updateRetentionInternalServerError %+v", 500, o.Payload) 302 } 303 304 func (o *UpdateRetentionInternalServerError) String() string { 305 return fmt.Sprintf("[PUT /retentions/{id}][%d] updateRetentionInternalServerError %+v", 500, o.Payload) 306 } 307 308 func (o *UpdateRetentionInternalServerError) GetPayload() *models.Errors { 309 return o.Payload 310 } 311 312 func (o *UpdateRetentionInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 313 314 // hydrates response header X-Request-Id 315 hdrXRequestID := response.GetHeader("X-Request-Id") 316 317 if hdrXRequestID != "" { 318 o.XRequestID = hdrXRequestID 319 } 320 321 o.Payload = new(models.Errors) 322 323 // response payload 324 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 325 return err 326 } 327 328 return nil 329 }