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