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