github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/ldap/search_ldap_user_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package ldap 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 "fmt" 10 "io" 11 12 "github.com/go-openapi/runtime" 13 "github.com/go-openapi/strfmt" 14 15 "github.com/goharbor/go-client/pkg/sdk/v2.0/models" 16 ) 17 18 // SearchLdapUserReader is a Reader for the SearchLdapUser structure. 19 type SearchLdapUserReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *SearchLdapUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 200: 27 result := NewSearchLdapUserOK() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 case 400: 33 result := NewSearchLdapUserBadRequest() 34 if err := result.readResponse(response, consumer, o.formats); err != nil { 35 return nil, err 36 } 37 return nil, result 38 case 401: 39 result := NewSearchLdapUserUnauthorized() 40 if err := result.readResponse(response, consumer, o.formats); err != nil { 41 return nil, err 42 } 43 return nil, result 44 case 403: 45 result := NewSearchLdapUserForbidden() 46 if err := result.readResponse(response, consumer, o.formats); err != nil { 47 return nil, err 48 } 49 return nil, result 50 case 500: 51 result := NewSearchLdapUserInternalServerError() 52 if err := result.readResponse(response, consumer, o.formats); err != nil { 53 return nil, err 54 } 55 return nil, result 56 default: 57 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 58 } 59 } 60 61 // NewSearchLdapUserOK creates a SearchLdapUserOK with default headers values 62 func NewSearchLdapUserOK() *SearchLdapUserOK { 63 return &SearchLdapUserOK{} 64 } 65 66 /* 67 SearchLdapUserOK describes a response with status code 200, with default header values. 68 69 Search ldap users successfully. 70 */ 71 type SearchLdapUserOK struct { 72 Payload []*models.LdapUser 73 } 74 75 // IsSuccess returns true when this search ldap user o k response has a 2xx status code 76 func (o *SearchLdapUserOK) IsSuccess() bool { 77 return true 78 } 79 80 // IsRedirect returns true when this search ldap user o k response has a 3xx status code 81 func (o *SearchLdapUserOK) IsRedirect() bool { 82 return false 83 } 84 85 // IsClientError returns true when this search ldap user o k response has a 4xx status code 86 func (o *SearchLdapUserOK) IsClientError() bool { 87 return false 88 } 89 90 // IsServerError returns true when this search ldap user o k response has a 5xx status code 91 func (o *SearchLdapUserOK) IsServerError() bool { 92 return false 93 } 94 95 // IsCode returns true when this search ldap user o k response a status code equal to that given 96 func (o *SearchLdapUserOK) IsCode(code int) bool { 97 return code == 200 98 } 99 100 func (o *SearchLdapUserOK) Error() string { 101 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserOK %+v", 200, o.Payload) 102 } 103 104 func (o *SearchLdapUserOK) String() string { 105 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserOK %+v", 200, o.Payload) 106 } 107 108 func (o *SearchLdapUserOK) GetPayload() []*models.LdapUser { 109 return o.Payload 110 } 111 112 func (o *SearchLdapUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 113 114 // response payload 115 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 116 return err 117 } 118 119 return nil 120 } 121 122 // NewSearchLdapUserBadRequest creates a SearchLdapUserBadRequest with default headers values 123 func NewSearchLdapUserBadRequest() *SearchLdapUserBadRequest { 124 return &SearchLdapUserBadRequest{} 125 } 126 127 /* 128 SearchLdapUserBadRequest describes a response with status code 400, with default header values. 129 130 Bad request 131 */ 132 type SearchLdapUserBadRequest struct { 133 134 /* The ID of the corresponding request for the response 135 */ 136 XRequestID string 137 138 Payload *models.Errors 139 } 140 141 // IsSuccess returns true when this search ldap user bad request response has a 2xx status code 142 func (o *SearchLdapUserBadRequest) IsSuccess() bool { 143 return false 144 } 145 146 // IsRedirect returns true when this search ldap user bad request response has a 3xx status code 147 func (o *SearchLdapUserBadRequest) IsRedirect() bool { 148 return false 149 } 150 151 // IsClientError returns true when this search ldap user bad request response has a 4xx status code 152 func (o *SearchLdapUserBadRequest) IsClientError() bool { 153 return true 154 } 155 156 // IsServerError returns true when this search ldap user bad request response has a 5xx status code 157 func (o *SearchLdapUserBadRequest) IsServerError() bool { 158 return false 159 } 160 161 // IsCode returns true when this search ldap user bad request response a status code equal to that given 162 func (o *SearchLdapUserBadRequest) IsCode(code int) bool { 163 return code == 400 164 } 165 166 func (o *SearchLdapUserBadRequest) Error() string { 167 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserBadRequest %+v", 400, o.Payload) 168 } 169 170 func (o *SearchLdapUserBadRequest) String() string { 171 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserBadRequest %+v", 400, o.Payload) 172 } 173 174 func (o *SearchLdapUserBadRequest) GetPayload() *models.Errors { 175 return o.Payload 176 } 177 178 func (o *SearchLdapUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 179 180 // hydrates response header X-Request-Id 181 hdrXRequestID := response.GetHeader("X-Request-Id") 182 183 if hdrXRequestID != "" { 184 o.XRequestID = hdrXRequestID 185 } 186 187 o.Payload = new(models.Errors) 188 189 // response payload 190 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 191 return err 192 } 193 194 return nil 195 } 196 197 // NewSearchLdapUserUnauthorized creates a SearchLdapUserUnauthorized with default headers values 198 func NewSearchLdapUserUnauthorized() *SearchLdapUserUnauthorized { 199 return &SearchLdapUserUnauthorized{} 200 } 201 202 /* 203 SearchLdapUserUnauthorized describes a response with status code 401, with default header values. 204 205 Unauthorized 206 */ 207 type SearchLdapUserUnauthorized struct { 208 209 /* The ID of the corresponding request for the response 210 */ 211 XRequestID string 212 213 Payload *models.Errors 214 } 215 216 // IsSuccess returns true when this search ldap user unauthorized response has a 2xx status code 217 func (o *SearchLdapUserUnauthorized) IsSuccess() bool { 218 return false 219 } 220 221 // IsRedirect returns true when this search ldap user unauthorized response has a 3xx status code 222 func (o *SearchLdapUserUnauthorized) IsRedirect() bool { 223 return false 224 } 225 226 // IsClientError returns true when this search ldap user unauthorized response has a 4xx status code 227 func (o *SearchLdapUserUnauthorized) IsClientError() bool { 228 return true 229 } 230 231 // IsServerError returns true when this search ldap user unauthorized response has a 5xx status code 232 func (o *SearchLdapUserUnauthorized) IsServerError() bool { 233 return false 234 } 235 236 // IsCode returns true when this search ldap user unauthorized response a status code equal to that given 237 func (o *SearchLdapUserUnauthorized) IsCode(code int) bool { 238 return code == 401 239 } 240 241 func (o *SearchLdapUserUnauthorized) Error() string { 242 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserUnauthorized %+v", 401, o.Payload) 243 } 244 245 func (o *SearchLdapUserUnauthorized) String() string { 246 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserUnauthorized %+v", 401, o.Payload) 247 } 248 249 func (o *SearchLdapUserUnauthorized) GetPayload() *models.Errors { 250 return o.Payload 251 } 252 253 func (o *SearchLdapUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 254 255 // hydrates response header X-Request-Id 256 hdrXRequestID := response.GetHeader("X-Request-Id") 257 258 if hdrXRequestID != "" { 259 o.XRequestID = hdrXRequestID 260 } 261 262 o.Payload = new(models.Errors) 263 264 // response payload 265 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 266 return err 267 } 268 269 return nil 270 } 271 272 // NewSearchLdapUserForbidden creates a SearchLdapUserForbidden with default headers values 273 func NewSearchLdapUserForbidden() *SearchLdapUserForbidden { 274 return &SearchLdapUserForbidden{} 275 } 276 277 /* 278 SearchLdapUserForbidden describes a response with status code 403, with default header values. 279 280 Forbidden 281 */ 282 type SearchLdapUserForbidden struct { 283 284 /* The ID of the corresponding request for the response 285 */ 286 XRequestID string 287 288 Payload *models.Errors 289 } 290 291 // IsSuccess returns true when this search ldap user forbidden response has a 2xx status code 292 func (o *SearchLdapUserForbidden) IsSuccess() bool { 293 return false 294 } 295 296 // IsRedirect returns true when this search ldap user forbidden response has a 3xx status code 297 func (o *SearchLdapUserForbidden) IsRedirect() bool { 298 return false 299 } 300 301 // IsClientError returns true when this search ldap user forbidden response has a 4xx status code 302 func (o *SearchLdapUserForbidden) IsClientError() bool { 303 return true 304 } 305 306 // IsServerError returns true when this search ldap user forbidden response has a 5xx status code 307 func (o *SearchLdapUserForbidden) IsServerError() bool { 308 return false 309 } 310 311 // IsCode returns true when this search ldap user forbidden response a status code equal to that given 312 func (o *SearchLdapUserForbidden) IsCode(code int) bool { 313 return code == 403 314 } 315 316 func (o *SearchLdapUserForbidden) Error() string { 317 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserForbidden %+v", 403, o.Payload) 318 } 319 320 func (o *SearchLdapUserForbidden) String() string { 321 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserForbidden %+v", 403, o.Payload) 322 } 323 324 func (o *SearchLdapUserForbidden) GetPayload() *models.Errors { 325 return o.Payload 326 } 327 328 func (o *SearchLdapUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 329 330 // hydrates response header X-Request-Id 331 hdrXRequestID := response.GetHeader("X-Request-Id") 332 333 if hdrXRequestID != "" { 334 o.XRequestID = hdrXRequestID 335 } 336 337 o.Payload = new(models.Errors) 338 339 // response payload 340 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 341 return err 342 } 343 344 return nil 345 } 346 347 // NewSearchLdapUserInternalServerError creates a SearchLdapUserInternalServerError with default headers values 348 func NewSearchLdapUserInternalServerError() *SearchLdapUserInternalServerError { 349 return &SearchLdapUserInternalServerError{} 350 } 351 352 /* 353 SearchLdapUserInternalServerError describes a response with status code 500, with default header values. 354 355 Internal server error 356 */ 357 type SearchLdapUserInternalServerError struct { 358 359 /* The ID of the corresponding request for the response 360 */ 361 XRequestID string 362 363 Payload *models.Errors 364 } 365 366 // IsSuccess returns true when this search ldap user internal server error response has a 2xx status code 367 func (o *SearchLdapUserInternalServerError) IsSuccess() bool { 368 return false 369 } 370 371 // IsRedirect returns true when this search ldap user internal server error response has a 3xx status code 372 func (o *SearchLdapUserInternalServerError) IsRedirect() bool { 373 return false 374 } 375 376 // IsClientError returns true when this search ldap user internal server error response has a 4xx status code 377 func (o *SearchLdapUserInternalServerError) IsClientError() bool { 378 return false 379 } 380 381 // IsServerError returns true when this search ldap user internal server error response has a 5xx status code 382 func (o *SearchLdapUserInternalServerError) IsServerError() bool { 383 return true 384 } 385 386 // IsCode returns true when this search ldap user internal server error response a status code equal to that given 387 func (o *SearchLdapUserInternalServerError) IsCode(code int) bool { 388 return code == 500 389 } 390 391 func (o *SearchLdapUserInternalServerError) Error() string { 392 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserInternalServerError %+v", 500, o.Payload) 393 } 394 395 func (o *SearchLdapUserInternalServerError) String() string { 396 return fmt.Sprintf("[GET /ldap/users/search][%d] searchLdapUserInternalServerError %+v", 500, o.Payload) 397 } 398 399 func (o *SearchLdapUserInternalServerError) GetPayload() *models.Errors { 400 return o.Payload 401 } 402 403 func (o *SearchLdapUserInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 404 405 // hydrates response header X-Request-Id 406 hdrXRequestID := response.GetHeader("X-Request-Id") 407 408 if hdrXRequestID != "" { 409 o.XRequestID = hdrXRequestID 410 } 411 412 o.Payload = new(models.Errors) 413 414 // response payload 415 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 416 return err 417 } 418 419 return nil 420 }