github.com/cilium/cilium@v1.16.2/api/v1/client/policy/get_identity_id_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Authors of Cilium 4 // SPDX-License-Identifier: Apache-2.0 5 6 package policy 7 8 // This file was generated by the swagger tool. 9 // Editing this file might prove futile when you re-run the swagger generate command 10 11 import ( 12 "fmt" 13 "io" 14 15 "github.com/go-openapi/runtime" 16 "github.com/go-openapi/strfmt" 17 18 "github.com/cilium/cilium/api/v1/models" 19 ) 20 21 // GetIdentityIDReader is a Reader for the GetIdentityID structure. 22 type GetIdentityIDReader struct { 23 formats strfmt.Registry 24 } 25 26 // ReadResponse reads a server response into the received o. 27 func (o *GetIdentityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 28 switch response.Code() { 29 case 200: 30 result := NewGetIdentityIDOK() 31 if err := result.readResponse(response, consumer, o.formats); err != nil { 32 return nil, err 33 } 34 return result, nil 35 case 400: 36 result := NewGetIdentityIDBadRequest() 37 if err := result.readResponse(response, consumer, o.formats); err != nil { 38 return nil, err 39 } 40 return nil, result 41 case 404: 42 result := NewGetIdentityIDNotFound() 43 if err := result.readResponse(response, consumer, o.formats); err != nil { 44 return nil, err 45 } 46 return nil, result 47 case 520: 48 result := NewGetIdentityIDUnreachable() 49 if err := result.readResponse(response, consumer, o.formats); err != nil { 50 return nil, err 51 } 52 return nil, result 53 case 521: 54 result := NewGetIdentityIDInvalidStorageFormat() 55 if err := result.readResponse(response, consumer, o.formats); err != nil { 56 return nil, err 57 } 58 return nil, result 59 default: 60 return nil, runtime.NewAPIError("[GET /identity/{id}] GetIdentityID", response, response.Code()) 61 } 62 } 63 64 // NewGetIdentityIDOK creates a GetIdentityIDOK with default headers values 65 func NewGetIdentityIDOK() *GetIdentityIDOK { 66 return &GetIdentityIDOK{} 67 } 68 69 /* 70 GetIdentityIDOK describes a response with status code 200, with default header values. 71 72 Success 73 */ 74 type GetIdentityIDOK struct { 75 Payload *models.Identity 76 } 77 78 // IsSuccess returns true when this get identity Id o k response has a 2xx status code 79 func (o *GetIdentityIDOK) IsSuccess() bool { 80 return true 81 } 82 83 // IsRedirect returns true when this get identity Id o k response has a 3xx status code 84 func (o *GetIdentityIDOK) IsRedirect() bool { 85 return false 86 } 87 88 // IsClientError returns true when this get identity Id o k response has a 4xx status code 89 func (o *GetIdentityIDOK) IsClientError() bool { 90 return false 91 } 92 93 // IsServerError returns true when this get identity Id o k response has a 5xx status code 94 func (o *GetIdentityIDOK) IsServerError() bool { 95 return false 96 } 97 98 // IsCode returns true when this get identity Id o k response a status code equal to that given 99 func (o *GetIdentityIDOK) IsCode(code int) bool { 100 return code == 200 101 } 102 103 // Code gets the status code for the get identity Id o k response 104 func (o *GetIdentityIDOK) Code() int { 105 return 200 106 } 107 108 func (o *GetIdentityIDOK) Error() string { 109 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdOK %+v", 200, o.Payload) 110 } 111 112 func (o *GetIdentityIDOK) String() string { 113 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdOK %+v", 200, o.Payload) 114 } 115 116 func (o *GetIdentityIDOK) GetPayload() *models.Identity { 117 return o.Payload 118 } 119 120 func (o *GetIdentityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 121 122 o.Payload = new(models.Identity) 123 124 // response payload 125 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 126 return err 127 } 128 129 return nil 130 } 131 132 // NewGetIdentityIDBadRequest creates a GetIdentityIDBadRequest with default headers values 133 func NewGetIdentityIDBadRequest() *GetIdentityIDBadRequest { 134 return &GetIdentityIDBadRequest{} 135 } 136 137 /* 138 GetIdentityIDBadRequest describes a response with status code 400, with default header values. 139 140 Invalid identity provided 141 */ 142 type GetIdentityIDBadRequest struct { 143 } 144 145 // IsSuccess returns true when this get identity Id bad request response has a 2xx status code 146 func (o *GetIdentityIDBadRequest) IsSuccess() bool { 147 return false 148 } 149 150 // IsRedirect returns true when this get identity Id bad request response has a 3xx status code 151 func (o *GetIdentityIDBadRequest) IsRedirect() bool { 152 return false 153 } 154 155 // IsClientError returns true when this get identity Id bad request response has a 4xx status code 156 func (o *GetIdentityIDBadRequest) IsClientError() bool { 157 return true 158 } 159 160 // IsServerError returns true when this get identity Id bad request response has a 5xx status code 161 func (o *GetIdentityIDBadRequest) IsServerError() bool { 162 return false 163 } 164 165 // IsCode returns true when this get identity Id bad request response a status code equal to that given 166 func (o *GetIdentityIDBadRequest) IsCode(code int) bool { 167 return code == 400 168 } 169 170 // Code gets the status code for the get identity Id bad request response 171 func (o *GetIdentityIDBadRequest) Code() int { 172 return 400 173 } 174 175 func (o *GetIdentityIDBadRequest) Error() string { 176 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdBadRequest ", 400) 177 } 178 179 func (o *GetIdentityIDBadRequest) String() string { 180 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdBadRequest ", 400) 181 } 182 183 func (o *GetIdentityIDBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 184 185 return nil 186 } 187 188 // NewGetIdentityIDNotFound creates a GetIdentityIDNotFound with default headers values 189 func NewGetIdentityIDNotFound() *GetIdentityIDNotFound { 190 return &GetIdentityIDNotFound{} 191 } 192 193 /* 194 GetIdentityIDNotFound describes a response with status code 404, with default header values. 195 196 Identity not found 197 */ 198 type GetIdentityIDNotFound struct { 199 } 200 201 // IsSuccess returns true when this get identity Id not found response has a 2xx status code 202 func (o *GetIdentityIDNotFound) IsSuccess() bool { 203 return false 204 } 205 206 // IsRedirect returns true when this get identity Id not found response has a 3xx status code 207 func (o *GetIdentityIDNotFound) IsRedirect() bool { 208 return false 209 } 210 211 // IsClientError returns true when this get identity Id not found response has a 4xx status code 212 func (o *GetIdentityIDNotFound) IsClientError() bool { 213 return true 214 } 215 216 // IsServerError returns true when this get identity Id not found response has a 5xx status code 217 func (o *GetIdentityIDNotFound) IsServerError() bool { 218 return false 219 } 220 221 // IsCode returns true when this get identity Id not found response a status code equal to that given 222 func (o *GetIdentityIDNotFound) IsCode(code int) bool { 223 return code == 404 224 } 225 226 // Code gets the status code for the get identity Id not found response 227 func (o *GetIdentityIDNotFound) Code() int { 228 return 404 229 } 230 231 func (o *GetIdentityIDNotFound) Error() string { 232 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdNotFound ", 404) 233 } 234 235 func (o *GetIdentityIDNotFound) String() string { 236 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdNotFound ", 404) 237 } 238 239 func (o *GetIdentityIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 240 241 return nil 242 } 243 244 // NewGetIdentityIDUnreachable creates a GetIdentityIDUnreachable with default headers values 245 func NewGetIdentityIDUnreachable() *GetIdentityIDUnreachable { 246 return &GetIdentityIDUnreachable{} 247 } 248 249 /* 250 GetIdentityIDUnreachable describes a response with status code 520, with default header values. 251 252 Identity storage unreachable. Likely a network problem. 253 */ 254 type GetIdentityIDUnreachable struct { 255 Payload models.Error 256 } 257 258 // IsSuccess returns true when this get identity Id unreachable response has a 2xx status code 259 func (o *GetIdentityIDUnreachable) IsSuccess() bool { 260 return false 261 } 262 263 // IsRedirect returns true when this get identity Id unreachable response has a 3xx status code 264 func (o *GetIdentityIDUnreachable) IsRedirect() bool { 265 return false 266 } 267 268 // IsClientError returns true when this get identity Id unreachable response has a 4xx status code 269 func (o *GetIdentityIDUnreachable) IsClientError() bool { 270 return false 271 } 272 273 // IsServerError returns true when this get identity Id unreachable response has a 5xx status code 274 func (o *GetIdentityIDUnreachable) IsServerError() bool { 275 return true 276 } 277 278 // IsCode returns true when this get identity Id unreachable response a status code equal to that given 279 func (o *GetIdentityIDUnreachable) IsCode(code int) bool { 280 return code == 520 281 } 282 283 // Code gets the status code for the get identity Id unreachable response 284 func (o *GetIdentityIDUnreachable) Code() int { 285 return 520 286 } 287 288 func (o *GetIdentityIDUnreachable) Error() string { 289 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdUnreachable %+v", 520, o.Payload) 290 } 291 292 func (o *GetIdentityIDUnreachable) String() string { 293 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdUnreachable %+v", 520, o.Payload) 294 } 295 296 func (o *GetIdentityIDUnreachable) GetPayload() models.Error { 297 return o.Payload 298 } 299 300 func (o *GetIdentityIDUnreachable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 301 302 // response payload 303 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 304 return err 305 } 306 307 return nil 308 } 309 310 // NewGetIdentityIDInvalidStorageFormat creates a GetIdentityIDInvalidStorageFormat with default headers values 311 func NewGetIdentityIDInvalidStorageFormat() *GetIdentityIDInvalidStorageFormat { 312 return &GetIdentityIDInvalidStorageFormat{} 313 } 314 315 /* 316 GetIdentityIDInvalidStorageFormat describes a response with status code 521, with default header values. 317 318 Invalid identity format in storage 319 */ 320 type GetIdentityIDInvalidStorageFormat struct { 321 Payload models.Error 322 } 323 324 // IsSuccess returns true when this get identity Id invalid storage format response has a 2xx status code 325 func (o *GetIdentityIDInvalidStorageFormat) IsSuccess() bool { 326 return false 327 } 328 329 // IsRedirect returns true when this get identity Id invalid storage format response has a 3xx status code 330 func (o *GetIdentityIDInvalidStorageFormat) IsRedirect() bool { 331 return false 332 } 333 334 // IsClientError returns true when this get identity Id invalid storage format response has a 4xx status code 335 func (o *GetIdentityIDInvalidStorageFormat) IsClientError() bool { 336 return false 337 } 338 339 // IsServerError returns true when this get identity Id invalid storage format response has a 5xx status code 340 func (o *GetIdentityIDInvalidStorageFormat) IsServerError() bool { 341 return true 342 } 343 344 // IsCode returns true when this get identity Id invalid storage format response a status code equal to that given 345 func (o *GetIdentityIDInvalidStorageFormat) IsCode(code int) bool { 346 return code == 521 347 } 348 349 // Code gets the status code for the get identity Id invalid storage format response 350 func (o *GetIdentityIDInvalidStorageFormat) Code() int { 351 return 521 352 } 353 354 func (o *GetIdentityIDInvalidStorageFormat) Error() string { 355 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdInvalidStorageFormat %+v", 521, o.Payload) 356 } 357 358 func (o *GetIdentityIDInvalidStorageFormat) String() string { 359 return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdInvalidStorageFormat %+v", 521, o.Payload) 360 } 361 362 func (o *GetIdentityIDInvalidStorageFormat) GetPayload() models.Error { 363 return o.Payload 364 } 365 366 func (o *GetIdentityIDInvalidStorageFormat) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 367 368 // response payload 369 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 370 return err 371 } 372 373 return nil 374 }