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