github.com/cilium/cilium@v1.16.2/api/v1/client/policy/get_identity_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 // GetIdentityReader is a Reader for the GetIdentity structure. 22 type GetIdentityReader struct { 23 formats strfmt.Registry 24 } 25 26 // ReadResponse reads a server response into the received o. 27 func (o *GetIdentityReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 28 switch response.Code() { 29 case 200: 30 result := NewGetIdentityOK() 31 if err := result.readResponse(response, consumer, o.formats); err != nil { 32 return nil, err 33 } 34 return result, nil 35 case 404: 36 result := NewGetIdentityNotFound() 37 if err := result.readResponse(response, consumer, o.formats); err != nil { 38 return nil, err 39 } 40 return nil, result 41 case 520: 42 result := NewGetIdentityUnreachable() 43 if err := result.readResponse(response, consumer, o.formats); err != nil { 44 return nil, err 45 } 46 return nil, result 47 case 521: 48 result := NewGetIdentityInvalidStorageFormat() 49 if err := result.readResponse(response, consumer, o.formats); err != nil { 50 return nil, err 51 } 52 return nil, result 53 default: 54 return nil, runtime.NewAPIError("[GET /identity] GetIdentity", response, response.Code()) 55 } 56 } 57 58 // NewGetIdentityOK creates a GetIdentityOK with default headers values 59 func NewGetIdentityOK() *GetIdentityOK { 60 return &GetIdentityOK{} 61 } 62 63 /* 64 GetIdentityOK describes a response with status code 200, with default header values. 65 66 Success 67 */ 68 type GetIdentityOK struct { 69 Payload []*models.Identity 70 } 71 72 // IsSuccess returns true when this get identity o k response has a 2xx status code 73 func (o *GetIdentityOK) IsSuccess() bool { 74 return true 75 } 76 77 // IsRedirect returns true when this get identity o k response has a 3xx status code 78 func (o *GetIdentityOK) IsRedirect() bool { 79 return false 80 } 81 82 // IsClientError returns true when this get identity o k response has a 4xx status code 83 func (o *GetIdentityOK) IsClientError() bool { 84 return false 85 } 86 87 // IsServerError returns true when this get identity o k response has a 5xx status code 88 func (o *GetIdentityOK) IsServerError() bool { 89 return false 90 } 91 92 // IsCode returns true when this get identity o k response a status code equal to that given 93 func (o *GetIdentityOK) IsCode(code int) bool { 94 return code == 200 95 } 96 97 // Code gets the status code for the get identity o k response 98 func (o *GetIdentityOK) Code() int { 99 return 200 100 } 101 102 func (o *GetIdentityOK) Error() string { 103 return fmt.Sprintf("[GET /identity][%d] getIdentityOK %+v", 200, o.Payload) 104 } 105 106 func (o *GetIdentityOK) String() string { 107 return fmt.Sprintf("[GET /identity][%d] getIdentityOK %+v", 200, o.Payload) 108 } 109 110 func (o *GetIdentityOK) GetPayload() []*models.Identity { 111 return o.Payload 112 } 113 114 func (o *GetIdentityOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 115 116 // response payload 117 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 118 return err 119 } 120 121 return nil 122 } 123 124 // NewGetIdentityNotFound creates a GetIdentityNotFound with default headers values 125 func NewGetIdentityNotFound() *GetIdentityNotFound { 126 return &GetIdentityNotFound{} 127 } 128 129 /* 130 GetIdentityNotFound describes a response with status code 404, with default header values. 131 132 Identities with provided parameters not found 133 */ 134 type GetIdentityNotFound struct { 135 } 136 137 // IsSuccess returns true when this get identity not found response has a 2xx status code 138 func (o *GetIdentityNotFound) IsSuccess() bool { 139 return false 140 } 141 142 // IsRedirect returns true when this get identity not found response has a 3xx status code 143 func (o *GetIdentityNotFound) IsRedirect() bool { 144 return false 145 } 146 147 // IsClientError returns true when this get identity not found response has a 4xx status code 148 func (o *GetIdentityNotFound) IsClientError() bool { 149 return true 150 } 151 152 // IsServerError returns true when this get identity not found response has a 5xx status code 153 func (o *GetIdentityNotFound) IsServerError() bool { 154 return false 155 } 156 157 // IsCode returns true when this get identity not found response a status code equal to that given 158 func (o *GetIdentityNotFound) IsCode(code int) bool { 159 return code == 404 160 } 161 162 // Code gets the status code for the get identity not found response 163 func (o *GetIdentityNotFound) Code() int { 164 return 404 165 } 166 167 func (o *GetIdentityNotFound) Error() string { 168 return fmt.Sprintf("[GET /identity][%d] getIdentityNotFound ", 404) 169 } 170 171 func (o *GetIdentityNotFound) String() string { 172 return fmt.Sprintf("[GET /identity][%d] getIdentityNotFound ", 404) 173 } 174 175 func (o *GetIdentityNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 176 177 return nil 178 } 179 180 // NewGetIdentityUnreachable creates a GetIdentityUnreachable with default headers values 181 func NewGetIdentityUnreachable() *GetIdentityUnreachable { 182 return &GetIdentityUnreachable{} 183 } 184 185 /* 186 GetIdentityUnreachable describes a response with status code 520, with default header values. 187 188 Identity storage unreachable. Likely a network problem. 189 */ 190 type GetIdentityUnreachable struct { 191 Payload models.Error 192 } 193 194 // IsSuccess returns true when this get identity unreachable response has a 2xx status code 195 func (o *GetIdentityUnreachable) IsSuccess() bool { 196 return false 197 } 198 199 // IsRedirect returns true when this get identity unreachable response has a 3xx status code 200 func (o *GetIdentityUnreachable) IsRedirect() bool { 201 return false 202 } 203 204 // IsClientError returns true when this get identity unreachable response has a 4xx status code 205 func (o *GetIdentityUnreachable) IsClientError() bool { 206 return false 207 } 208 209 // IsServerError returns true when this get identity unreachable response has a 5xx status code 210 func (o *GetIdentityUnreachable) IsServerError() bool { 211 return true 212 } 213 214 // IsCode returns true when this get identity unreachable response a status code equal to that given 215 func (o *GetIdentityUnreachable) IsCode(code int) bool { 216 return code == 520 217 } 218 219 // Code gets the status code for the get identity unreachable response 220 func (o *GetIdentityUnreachable) Code() int { 221 return 520 222 } 223 224 func (o *GetIdentityUnreachable) Error() string { 225 return fmt.Sprintf("[GET /identity][%d] getIdentityUnreachable %+v", 520, o.Payload) 226 } 227 228 func (o *GetIdentityUnreachable) String() string { 229 return fmt.Sprintf("[GET /identity][%d] getIdentityUnreachable %+v", 520, o.Payload) 230 } 231 232 func (o *GetIdentityUnreachable) GetPayload() models.Error { 233 return o.Payload 234 } 235 236 func (o *GetIdentityUnreachable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 237 238 // response payload 239 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 240 return err 241 } 242 243 return nil 244 } 245 246 // NewGetIdentityInvalidStorageFormat creates a GetIdentityInvalidStorageFormat with default headers values 247 func NewGetIdentityInvalidStorageFormat() *GetIdentityInvalidStorageFormat { 248 return &GetIdentityInvalidStorageFormat{} 249 } 250 251 /* 252 GetIdentityInvalidStorageFormat describes a response with status code 521, with default header values. 253 254 Invalid identity format in storage 255 */ 256 type GetIdentityInvalidStorageFormat struct { 257 Payload models.Error 258 } 259 260 // IsSuccess returns true when this get identity invalid storage format response has a 2xx status code 261 func (o *GetIdentityInvalidStorageFormat) IsSuccess() bool { 262 return false 263 } 264 265 // IsRedirect returns true when this get identity invalid storage format response has a 3xx status code 266 func (o *GetIdentityInvalidStorageFormat) IsRedirect() bool { 267 return false 268 } 269 270 // IsClientError returns true when this get identity invalid storage format response has a 4xx status code 271 func (o *GetIdentityInvalidStorageFormat) IsClientError() bool { 272 return false 273 } 274 275 // IsServerError returns true when this get identity invalid storage format response has a 5xx status code 276 func (o *GetIdentityInvalidStorageFormat) IsServerError() bool { 277 return true 278 } 279 280 // IsCode returns true when this get identity invalid storage format response a status code equal to that given 281 func (o *GetIdentityInvalidStorageFormat) IsCode(code int) bool { 282 return code == 521 283 } 284 285 // Code gets the status code for the get identity invalid storage format response 286 func (o *GetIdentityInvalidStorageFormat) Code() int { 287 return 521 288 } 289 290 func (o *GetIdentityInvalidStorageFormat) Error() string { 291 return fmt.Sprintf("[GET /identity][%d] getIdentityInvalidStorageFormat %+v", 521, o.Payload) 292 } 293 294 func (o *GetIdentityInvalidStorageFormat) String() string { 295 return fmt.Sprintf("[GET /identity][%d] getIdentityInvalidStorageFormat %+v", 521, o.Payload) 296 } 297 298 func (o *GetIdentityInvalidStorageFormat) GetPayload() models.Error { 299 return o.Payload 300 } 301 302 func (o *GetIdentityInvalidStorageFormat) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 303 304 // response payload 305 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 306 return err 307 } 308 309 return nil 310 }