github.com/cilium/cilium@v1.16.2/api/v1/client/bgp/get_bgp_route_policies_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 // GetBgpRoutePoliciesReader is a Reader for the GetBgpRoutePolicies structure. 22 type GetBgpRoutePoliciesReader struct { 23 formats strfmt.Registry 24 } 25 26 // ReadResponse reads a server response into the received o. 27 func (o *GetBgpRoutePoliciesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 28 switch response.Code() { 29 case 200: 30 result := NewGetBgpRoutePoliciesOK() 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 := NewGetBgpRoutePoliciesInternalServerError() 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 := NewGetBgpRoutePoliciesDisabled() 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/route-policies] GetBgpRoutePolicies", response, response.Code()) 49 } 50 } 51 52 // NewGetBgpRoutePoliciesOK creates a GetBgpRoutePoliciesOK with default headers values 53 func NewGetBgpRoutePoliciesOK() *GetBgpRoutePoliciesOK { 54 return &GetBgpRoutePoliciesOK{} 55 } 56 57 /* 58 GetBgpRoutePoliciesOK describes a response with status code 200, with default header values. 59 60 Success 61 */ 62 type GetBgpRoutePoliciesOK struct { 63 Payload []*models.BgpRoutePolicy 64 } 65 66 // IsSuccess returns true when this get bgp route policies o k response has a 2xx status code 67 func (o *GetBgpRoutePoliciesOK) IsSuccess() bool { 68 return true 69 } 70 71 // IsRedirect returns true when this get bgp route policies o k response has a 3xx status code 72 func (o *GetBgpRoutePoliciesOK) IsRedirect() bool { 73 return false 74 } 75 76 // IsClientError returns true when this get bgp route policies o k response has a 4xx status code 77 func (o *GetBgpRoutePoliciesOK) IsClientError() bool { 78 return false 79 } 80 81 // IsServerError returns true when this get bgp route policies o k response has a 5xx status code 82 func (o *GetBgpRoutePoliciesOK) IsServerError() bool { 83 return false 84 } 85 86 // IsCode returns true when this get bgp route policies o k response a status code equal to that given 87 func (o *GetBgpRoutePoliciesOK) IsCode(code int) bool { 88 return code == 200 89 } 90 91 // Code gets the status code for the get bgp route policies o k response 92 func (o *GetBgpRoutePoliciesOK) Code() int { 93 return 200 94 } 95 96 func (o *GetBgpRoutePoliciesOK) Error() string { 97 return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesOK %+v", 200, o.Payload) 98 } 99 100 func (o *GetBgpRoutePoliciesOK) String() string { 101 return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesOK %+v", 200, o.Payload) 102 } 103 104 func (o *GetBgpRoutePoliciesOK) GetPayload() []*models.BgpRoutePolicy { 105 return o.Payload 106 } 107 108 func (o *GetBgpRoutePoliciesOK) 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 // NewGetBgpRoutePoliciesInternalServerError creates a GetBgpRoutePoliciesInternalServerError with default headers values 119 func NewGetBgpRoutePoliciesInternalServerError() *GetBgpRoutePoliciesInternalServerError { 120 return &GetBgpRoutePoliciesInternalServerError{} 121 } 122 123 /* 124 GetBgpRoutePoliciesInternalServerError describes a response with status code 500, with default header values. 125 126 Internal Server Error 127 */ 128 type GetBgpRoutePoliciesInternalServerError struct { 129 Payload models.Error 130 } 131 132 // IsSuccess returns true when this get bgp route policies internal server error response has a 2xx status code 133 func (o *GetBgpRoutePoliciesInternalServerError) IsSuccess() bool { 134 return false 135 } 136 137 // IsRedirect returns true when this get bgp route policies internal server error response has a 3xx status code 138 func (o *GetBgpRoutePoliciesInternalServerError) IsRedirect() bool { 139 return false 140 } 141 142 // IsClientError returns true when this get bgp route policies internal server error response has a 4xx status code 143 func (o *GetBgpRoutePoliciesInternalServerError) IsClientError() bool { 144 return false 145 } 146 147 // IsServerError returns true when this get bgp route policies internal server error response has a 5xx status code 148 func (o *GetBgpRoutePoliciesInternalServerError) IsServerError() bool { 149 return true 150 } 151 152 // IsCode returns true when this get bgp route policies internal server error response a status code equal to that given 153 func (o *GetBgpRoutePoliciesInternalServerError) IsCode(code int) bool { 154 return code == 500 155 } 156 157 // Code gets the status code for the get bgp route policies internal server error response 158 func (o *GetBgpRoutePoliciesInternalServerError) Code() int { 159 return 500 160 } 161 162 func (o *GetBgpRoutePoliciesInternalServerError) Error() string { 163 return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesInternalServerError %+v", 500, o.Payload) 164 } 165 166 func (o *GetBgpRoutePoliciesInternalServerError) String() string { 167 return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesInternalServerError %+v", 500, o.Payload) 168 } 169 170 func (o *GetBgpRoutePoliciesInternalServerError) GetPayload() models.Error { 171 return o.Payload 172 } 173 174 func (o *GetBgpRoutePoliciesInternalServerError) 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 // NewGetBgpRoutePoliciesDisabled creates a GetBgpRoutePoliciesDisabled with default headers values 185 func NewGetBgpRoutePoliciesDisabled() *GetBgpRoutePoliciesDisabled { 186 return &GetBgpRoutePoliciesDisabled{} 187 } 188 189 /* 190 GetBgpRoutePoliciesDisabled describes a response with status code 501, with default header values. 191 192 BGP Control Plane disabled 193 */ 194 type GetBgpRoutePoliciesDisabled struct { 195 Payload models.Error 196 } 197 198 // IsSuccess returns true when this get bgp route policies disabled response has a 2xx status code 199 func (o *GetBgpRoutePoliciesDisabled) IsSuccess() bool { 200 return false 201 } 202 203 // IsRedirect returns true when this get bgp route policies disabled response has a 3xx status code 204 func (o *GetBgpRoutePoliciesDisabled) IsRedirect() bool { 205 return false 206 } 207 208 // IsClientError returns true when this get bgp route policies disabled response has a 4xx status code 209 func (o *GetBgpRoutePoliciesDisabled) IsClientError() bool { 210 return false 211 } 212 213 // IsServerError returns true when this get bgp route policies disabled response has a 5xx status code 214 func (o *GetBgpRoutePoliciesDisabled) IsServerError() bool { 215 return true 216 } 217 218 // IsCode returns true when this get bgp route policies disabled response a status code equal to that given 219 func (o *GetBgpRoutePoliciesDisabled) IsCode(code int) bool { 220 return code == 501 221 } 222 223 // Code gets the status code for the get bgp route policies disabled response 224 func (o *GetBgpRoutePoliciesDisabled) Code() int { 225 return 501 226 } 227 228 func (o *GetBgpRoutePoliciesDisabled) Error() string { 229 return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesDisabled %+v", 501, o.Payload) 230 } 231 232 func (o *GetBgpRoutePoliciesDisabled) String() string { 233 return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesDisabled %+v", 501, o.Payload) 234 } 235 236 func (o *GetBgpRoutePoliciesDisabled) GetPayload() models.Error { 237 return o.Payload 238 } 239 240 func (o *GetBgpRoutePoliciesDisabled) 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 }