github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/oidc/ping_oidc_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package oidc 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 "fmt" 11 "io" 12 13 "github.com/go-openapi/runtime" 14 "github.com/go-openapi/strfmt" 15 "github.com/go-openapi/swag" 16 17 "github.com/goharbor/go-client/pkg/sdk/v2.0/models" 18 ) 19 20 // PingOIDCReader is a Reader for the PingOIDC structure. 21 type PingOIDCReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *PingOIDCReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewPingOIDCOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 case 400: 35 result := NewPingOIDCBadRequest() 36 if err := result.readResponse(response, consumer, o.formats); err != nil { 37 return nil, err 38 } 39 return nil, result 40 case 401: 41 result := NewPingOIDCUnauthorized() 42 if err := result.readResponse(response, consumer, o.formats); err != nil { 43 return nil, err 44 } 45 return nil, result 46 case 403: 47 result := NewPingOIDCForbidden() 48 if err := result.readResponse(response, consumer, o.formats); err != nil { 49 return nil, err 50 } 51 return nil, result 52 default: 53 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 54 } 55 } 56 57 // NewPingOIDCOK creates a PingOIDCOK with default headers values 58 func NewPingOIDCOK() *PingOIDCOK { 59 return &PingOIDCOK{} 60 } 61 62 /* 63 PingOIDCOK describes a response with status code 200, with default header values. 64 65 Success 66 */ 67 type PingOIDCOK struct { 68 69 /* The ID of the corresponding request for the response 70 */ 71 XRequestID string 72 } 73 74 // IsSuccess returns true when this ping Oidc o k response has a 2xx status code 75 func (o *PingOIDCOK) IsSuccess() bool { 76 return true 77 } 78 79 // IsRedirect returns true when this ping Oidc o k response has a 3xx status code 80 func (o *PingOIDCOK) IsRedirect() bool { 81 return false 82 } 83 84 // IsClientError returns true when this ping Oidc o k response has a 4xx status code 85 func (o *PingOIDCOK) IsClientError() bool { 86 return false 87 } 88 89 // IsServerError returns true when this ping Oidc o k response has a 5xx status code 90 func (o *PingOIDCOK) IsServerError() bool { 91 return false 92 } 93 94 // IsCode returns true when this ping Oidc o k response a status code equal to that given 95 func (o *PingOIDCOK) IsCode(code int) bool { 96 return code == 200 97 } 98 99 func (o *PingOIDCOK) Error() string { 100 return fmt.Sprintf("[POST /system/oidc/ping][%d] pingOidcOK ", 200) 101 } 102 103 func (o *PingOIDCOK) String() string { 104 return fmt.Sprintf("[POST /system/oidc/ping][%d] pingOidcOK ", 200) 105 } 106 107 func (o *PingOIDCOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 108 109 // hydrates response header X-Request-Id 110 hdrXRequestID := response.GetHeader("X-Request-Id") 111 112 if hdrXRequestID != "" { 113 o.XRequestID = hdrXRequestID 114 } 115 116 return nil 117 } 118 119 // NewPingOIDCBadRequest creates a PingOIDCBadRequest with default headers values 120 func NewPingOIDCBadRequest() *PingOIDCBadRequest { 121 return &PingOIDCBadRequest{} 122 } 123 124 /* 125 PingOIDCBadRequest describes a response with status code 400, with default header values. 126 127 Bad request 128 */ 129 type PingOIDCBadRequest struct { 130 131 /* The ID of the corresponding request for the response 132 */ 133 XRequestID string 134 135 Payload *models.Errors 136 } 137 138 // IsSuccess returns true when this ping Oidc bad request response has a 2xx status code 139 func (o *PingOIDCBadRequest) IsSuccess() bool { 140 return false 141 } 142 143 // IsRedirect returns true when this ping Oidc bad request response has a 3xx status code 144 func (o *PingOIDCBadRequest) IsRedirect() bool { 145 return false 146 } 147 148 // IsClientError returns true when this ping Oidc bad request response has a 4xx status code 149 func (o *PingOIDCBadRequest) IsClientError() bool { 150 return true 151 } 152 153 // IsServerError returns true when this ping Oidc bad request response has a 5xx status code 154 func (o *PingOIDCBadRequest) IsServerError() bool { 155 return false 156 } 157 158 // IsCode returns true when this ping Oidc bad request response a status code equal to that given 159 func (o *PingOIDCBadRequest) IsCode(code int) bool { 160 return code == 400 161 } 162 163 func (o *PingOIDCBadRequest) Error() string { 164 return fmt.Sprintf("[POST /system/oidc/ping][%d] pingOidcBadRequest %+v", 400, o.Payload) 165 } 166 167 func (o *PingOIDCBadRequest) String() string { 168 return fmt.Sprintf("[POST /system/oidc/ping][%d] pingOidcBadRequest %+v", 400, o.Payload) 169 } 170 171 func (o *PingOIDCBadRequest) GetPayload() *models.Errors { 172 return o.Payload 173 } 174 175 func (o *PingOIDCBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 176 177 // hydrates response header X-Request-Id 178 hdrXRequestID := response.GetHeader("X-Request-Id") 179 180 if hdrXRequestID != "" { 181 o.XRequestID = hdrXRequestID 182 } 183 184 o.Payload = new(models.Errors) 185 186 // response payload 187 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 188 return err 189 } 190 191 return nil 192 } 193 194 // NewPingOIDCUnauthorized creates a PingOIDCUnauthorized with default headers values 195 func NewPingOIDCUnauthorized() *PingOIDCUnauthorized { 196 return &PingOIDCUnauthorized{} 197 } 198 199 /* 200 PingOIDCUnauthorized describes a response with status code 401, with default header values. 201 202 Unauthorized 203 */ 204 type PingOIDCUnauthorized struct { 205 206 /* The ID of the corresponding request for the response 207 */ 208 XRequestID string 209 210 Payload *models.Errors 211 } 212 213 // IsSuccess returns true when this ping Oidc unauthorized response has a 2xx status code 214 func (o *PingOIDCUnauthorized) IsSuccess() bool { 215 return false 216 } 217 218 // IsRedirect returns true when this ping Oidc unauthorized response has a 3xx status code 219 func (o *PingOIDCUnauthorized) IsRedirect() bool { 220 return false 221 } 222 223 // IsClientError returns true when this ping Oidc unauthorized response has a 4xx status code 224 func (o *PingOIDCUnauthorized) IsClientError() bool { 225 return true 226 } 227 228 // IsServerError returns true when this ping Oidc unauthorized response has a 5xx status code 229 func (o *PingOIDCUnauthorized) IsServerError() bool { 230 return false 231 } 232 233 // IsCode returns true when this ping Oidc unauthorized response a status code equal to that given 234 func (o *PingOIDCUnauthorized) IsCode(code int) bool { 235 return code == 401 236 } 237 238 func (o *PingOIDCUnauthorized) Error() string { 239 return fmt.Sprintf("[POST /system/oidc/ping][%d] pingOidcUnauthorized %+v", 401, o.Payload) 240 } 241 242 func (o *PingOIDCUnauthorized) String() string { 243 return fmt.Sprintf("[POST /system/oidc/ping][%d] pingOidcUnauthorized %+v", 401, o.Payload) 244 } 245 246 func (o *PingOIDCUnauthorized) GetPayload() *models.Errors { 247 return o.Payload 248 } 249 250 func (o *PingOIDCUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 251 252 // hydrates response header X-Request-Id 253 hdrXRequestID := response.GetHeader("X-Request-Id") 254 255 if hdrXRequestID != "" { 256 o.XRequestID = hdrXRequestID 257 } 258 259 o.Payload = new(models.Errors) 260 261 // response payload 262 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 263 return err 264 } 265 266 return nil 267 } 268 269 // NewPingOIDCForbidden creates a PingOIDCForbidden with default headers values 270 func NewPingOIDCForbidden() *PingOIDCForbidden { 271 return &PingOIDCForbidden{} 272 } 273 274 /* 275 PingOIDCForbidden describes a response with status code 403, with default header values. 276 277 Forbidden 278 */ 279 type PingOIDCForbidden struct { 280 281 /* The ID of the corresponding request for the response 282 */ 283 XRequestID string 284 285 Payload *models.Errors 286 } 287 288 // IsSuccess returns true when this ping Oidc forbidden response has a 2xx status code 289 func (o *PingOIDCForbidden) IsSuccess() bool { 290 return false 291 } 292 293 // IsRedirect returns true when this ping Oidc forbidden response has a 3xx status code 294 func (o *PingOIDCForbidden) IsRedirect() bool { 295 return false 296 } 297 298 // IsClientError returns true when this ping Oidc forbidden response has a 4xx status code 299 func (o *PingOIDCForbidden) IsClientError() bool { 300 return true 301 } 302 303 // IsServerError returns true when this ping Oidc forbidden response has a 5xx status code 304 func (o *PingOIDCForbidden) IsServerError() bool { 305 return false 306 } 307 308 // IsCode returns true when this ping Oidc forbidden response a status code equal to that given 309 func (o *PingOIDCForbidden) IsCode(code int) bool { 310 return code == 403 311 } 312 313 func (o *PingOIDCForbidden) Error() string { 314 return fmt.Sprintf("[POST /system/oidc/ping][%d] pingOidcForbidden %+v", 403, o.Payload) 315 } 316 317 func (o *PingOIDCForbidden) String() string { 318 return fmt.Sprintf("[POST /system/oidc/ping][%d] pingOidcForbidden %+v", 403, o.Payload) 319 } 320 321 func (o *PingOIDCForbidden) GetPayload() *models.Errors { 322 return o.Payload 323 } 324 325 func (o *PingOIDCForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 326 327 // hydrates response header X-Request-Id 328 hdrXRequestID := response.GetHeader("X-Request-Id") 329 330 if hdrXRequestID != "" { 331 o.XRequestID = hdrXRequestID 332 } 333 334 o.Payload = new(models.Errors) 335 336 // response payload 337 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 338 return err 339 } 340 341 return nil 342 } 343 344 /* 345 PingOIDCBody ping OIDC body 346 swagger:model PingOIDCBody 347 */ 348 type PingOIDCBody struct { 349 350 // The URL of OIDC endpoint to be tested. 351 URL string `json:"url,omitempty"` 352 353 // Whether the certificate should be verified 354 VerifyCert bool `json:"verify_cert,omitempty"` 355 } 356 357 // Validate validates this ping OIDC body 358 func (o *PingOIDCBody) Validate(formats strfmt.Registry) error { 359 return nil 360 } 361 362 // ContextValidate validates this ping OIDC body based on context it is used 363 func (o *PingOIDCBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 364 return nil 365 } 366 367 // MarshalBinary interface implementation 368 func (o *PingOIDCBody) MarshalBinary() ([]byte, error) { 369 if o == nil { 370 return nil, nil 371 } 372 return swag.WriteJSON(o) 373 } 374 375 // UnmarshalBinary interface implementation 376 func (o *PingOIDCBody) UnmarshalBinary(b []byte) error { 377 var res PingOIDCBody 378 if err := swag.ReadJSON(b, &res); err != nil { 379 return err 380 } 381 *o = res 382 return nil 383 }