github.com/cilium/cilium@v1.16.2/api/v1/client/bgp/get_bgp_routes_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 bgp 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 // GetBgpRoutesReader is a Reader for the GetBgpRoutes structure. 22 type GetBgpRoutesReader struct { 23 formats strfmt.Registry 24 } 25 26 // ReadResponse reads a server response into the received o. 27 func (o *GetBgpRoutesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 28 switch response.Code() { 29 case 200: 30 result := NewGetBgpRoutesOK() 31 if err := result.readResponse(response, consumer, o.formats); err != nil { 32 return nil, err 33 } 34 return result, nil 35 case 500: 36 result := NewGetBgpRoutesInternalServerError() 37 if err := result.readResponse(response, consumer, o.formats); err != nil { 38 return nil, err 39 } 40 return nil, result 41 case 501: 42 result := NewGetBgpRoutesDisabled() 43 if err := result.readResponse(response, consumer, o.formats); err != nil { 44 return nil, err 45 } 46 return nil, result 47 default: 48 return nil, runtime.NewAPIError("[GET /bgp/routes] GetBgpRoutes", response, response.Code()) 49 } 50 } 51 52 // NewGetBgpRoutesOK creates a GetBgpRoutesOK with default headers values 53 func NewGetBgpRoutesOK() *GetBgpRoutesOK { 54 return &GetBgpRoutesOK{} 55 } 56 57 /* 58 GetBgpRoutesOK describes a response with status code 200, with default header values. 59 60 Success 61 */ 62 type GetBgpRoutesOK struct { 63 Payload []*models.BgpRoute 64 } 65 66 // IsSuccess returns true when this get bgp routes o k response has a 2xx status code 67 func (o *GetBgpRoutesOK) IsSuccess() bool { 68 return true 69 } 70 71 // IsRedirect returns true when this get bgp routes o k response has a 3xx status code 72 func (o *GetBgpRoutesOK) IsRedirect() bool { 73 return false 74 } 75 76 // IsClientError returns true when this get bgp routes o k response has a 4xx status code 77 func (o *GetBgpRoutesOK) IsClientError() bool { 78 return false 79 } 80 81 // IsServerError returns true when this get bgp routes o k response has a 5xx status code 82 func (o *GetBgpRoutesOK) IsServerError() bool { 83 return false 84 } 85 86 // IsCode returns true when this get bgp routes o k response a status code equal to that given 87 func (o *GetBgpRoutesOK) IsCode(code int) bool { 88 return code == 200 89 } 90 91 // Code gets the status code for the get bgp routes o k response 92 func (o *GetBgpRoutesOK) Code() int { 93 return 200 94 } 95 96 func (o *GetBgpRoutesOK) Error() string { 97 return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesOK %+v", 200, o.Payload) 98 } 99 100 func (o *GetBgpRoutesOK) String() string { 101 return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesOK %+v", 200, o.Payload) 102 } 103 104 func (o *GetBgpRoutesOK) GetPayload() []*models.BgpRoute { 105 return o.Payload 106 } 107 108 func (o *GetBgpRoutesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 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 // NewGetBgpRoutesInternalServerError creates a GetBgpRoutesInternalServerError with default headers values 119 func NewGetBgpRoutesInternalServerError() *GetBgpRoutesInternalServerError { 120 return &GetBgpRoutesInternalServerError{} 121 } 122 123 /* 124 GetBgpRoutesInternalServerError describes a response with status code 500, with default header values. 125 126 Internal Server Error 127 */ 128 type GetBgpRoutesInternalServerError struct { 129 Payload models.Error 130 } 131 132 // IsSuccess returns true when this get bgp routes internal server error response has a 2xx status code 133 func (o *GetBgpRoutesInternalServerError) IsSuccess() bool { 134 return false 135 } 136 137 // IsRedirect returns true when this get bgp routes internal server error response has a 3xx status code 138 func (o *GetBgpRoutesInternalServerError) IsRedirect() bool { 139 return false 140 } 141 142 // IsClientError returns true when this get bgp routes internal server error response has a 4xx status code 143 func (o *GetBgpRoutesInternalServerError) IsClientError() bool { 144 return false 145 } 146 147 // IsServerError returns true when this get bgp routes internal server error response has a 5xx status code 148 func (o *GetBgpRoutesInternalServerError) IsServerError() bool { 149 return true 150 } 151 152 // IsCode returns true when this get bgp routes internal server error response a status code equal to that given 153 func (o *GetBgpRoutesInternalServerError) IsCode(code int) bool { 154 return code == 500 155 } 156 157 // Code gets the status code for the get bgp routes internal server error response 158 func (o *GetBgpRoutesInternalServerError) Code() int { 159 return 500 160 } 161 162 func (o *GetBgpRoutesInternalServerError) Error() string { 163 return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesInternalServerError %+v", 500, o.Payload) 164 } 165 166 func (o *GetBgpRoutesInternalServerError) String() string { 167 return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesInternalServerError %+v", 500, o.Payload) 168 } 169 170 func (o *GetBgpRoutesInternalServerError) GetPayload() models.Error { 171 return o.Payload 172 } 173 174 func (o *GetBgpRoutesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 175 176 // response payload 177 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 178 return err 179 } 180 181 return nil 182 } 183 184 // NewGetBgpRoutesDisabled creates a GetBgpRoutesDisabled with default headers values 185 func NewGetBgpRoutesDisabled() *GetBgpRoutesDisabled { 186 return &GetBgpRoutesDisabled{} 187 } 188 189 /* 190 GetBgpRoutesDisabled describes a response with status code 501, with default header values. 191 192 BGP Control Plane disabled 193 */ 194 type GetBgpRoutesDisabled struct { 195 Payload models.Error 196 } 197 198 // IsSuccess returns true when this get bgp routes disabled response has a 2xx status code 199 func (o *GetBgpRoutesDisabled) IsSuccess() bool { 200 return false 201 } 202 203 // IsRedirect returns true when this get bgp routes disabled response has a 3xx status code 204 func (o *GetBgpRoutesDisabled) IsRedirect() bool { 205 return false 206 } 207 208 // IsClientError returns true when this get bgp routes disabled response has a 4xx status code 209 func (o *GetBgpRoutesDisabled) IsClientError() bool { 210 return false 211 } 212 213 // IsServerError returns true when this get bgp routes disabled response has a 5xx status code 214 func (o *GetBgpRoutesDisabled) IsServerError() bool { 215 return true 216 } 217 218 // IsCode returns true when this get bgp routes disabled response a status code equal to that given 219 func (o *GetBgpRoutesDisabled) IsCode(code int) bool { 220 return code == 501 221 } 222 223 // Code gets the status code for the get bgp routes disabled response 224 func (o *GetBgpRoutesDisabled) Code() int { 225 return 501 226 } 227 228 func (o *GetBgpRoutesDisabled) Error() string { 229 return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesDisabled %+v", 501, o.Payload) 230 } 231 232 func (o *GetBgpRoutesDisabled) String() string { 233 return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesDisabled %+v", 501, o.Payload) 234 } 235 236 func (o *GetBgpRoutesDisabled) GetPayload() models.Error { 237 return o.Payload 238 } 239 240 func (o *GetBgpRoutesDisabled) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 241 242 // response payload 243 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 244 return err 245 } 246 247 return nil 248 }