github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/ldap/import_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  // ImportLdapUserReader is a Reader for the ImportLdapUser structure.
    19  type ImportLdapUserReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *ImportLdapUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewImportLdapUserOK()
    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 := NewImportLdapUserBadRequest()
    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 := NewImportLdapUserUnauthorized()
    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 := NewImportLdapUserForbidden()
    46  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    47  			return nil, err
    48  		}
    49  		return nil, result
    50  	case 404:
    51  		result := NewImportLdapUserNotFound()
    52  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    53  			return nil, err
    54  		}
    55  		return nil, result
    56  	case 500:
    57  		result := NewImportLdapUserInternalServerError()
    58  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    59  			return nil, err
    60  		}
    61  		return nil, result
    62  	default:
    63  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    64  	}
    65  }
    66  
    67  // NewImportLdapUserOK creates a ImportLdapUserOK with default headers values
    68  func NewImportLdapUserOK() *ImportLdapUserOK {
    69  	return &ImportLdapUserOK{}
    70  }
    71  
    72  /*
    73  ImportLdapUserOK describes a response with status code 200, with default header values.
    74  
    75  Add ldap users successfully.
    76  */
    77  type ImportLdapUserOK struct {
    78  }
    79  
    80  // IsSuccess returns true when this import ldap user o k response has a 2xx status code
    81  func (o *ImportLdapUserOK) IsSuccess() bool {
    82  	return true
    83  }
    84  
    85  // IsRedirect returns true when this import ldap user o k response has a 3xx status code
    86  func (o *ImportLdapUserOK) IsRedirect() bool {
    87  	return false
    88  }
    89  
    90  // IsClientError returns true when this import ldap user o k response has a 4xx status code
    91  func (o *ImportLdapUserOK) IsClientError() bool {
    92  	return false
    93  }
    94  
    95  // IsServerError returns true when this import ldap user o k response has a 5xx status code
    96  func (o *ImportLdapUserOK) IsServerError() bool {
    97  	return false
    98  }
    99  
   100  // IsCode returns true when this import ldap user o k response a status code equal to that given
   101  func (o *ImportLdapUserOK) IsCode(code int) bool {
   102  	return code == 200
   103  }
   104  
   105  func (o *ImportLdapUserOK) Error() string {
   106  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserOK ", 200)
   107  }
   108  
   109  func (o *ImportLdapUserOK) String() string {
   110  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserOK ", 200)
   111  }
   112  
   113  func (o *ImportLdapUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   114  
   115  	return nil
   116  }
   117  
   118  // NewImportLdapUserBadRequest creates a ImportLdapUserBadRequest with default headers values
   119  func NewImportLdapUserBadRequest() *ImportLdapUserBadRequest {
   120  	return &ImportLdapUserBadRequest{}
   121  }
   122  
   123  /*
   124  ImportLdapUserBadRequest describes a response with status code 400, with default header values.
   125  
   126  Bad request
   127  */
   128  type ImportLdapUserBadRequest struct {
   129  
   130  	/* The ID of the corresponding request for the response
   131  	 */
   132  	XRequestID string
   133  
   134  	Payload *models.Errors
   135  }
   136  
   137  // IsSuccess returns true when this import ldap user bad request response has a 2xx status code
   138  func (o *ImportLdapUserBadRequest) IsSuccess() bool {
   139  	return false
   140  }
   141  
   142  // IsRedirect returns true when this import ldap user bad request response has a 3xx status code
   143  func (o *ImportLdapUserBadRequest) IsRedirect() bool {
   144  	return false
   145  }
   146  
   147  // IsClientError returns true when this import ldap user bad request response has a 4xx status code
   148  func (o *ImportLdapUserBadRequest) IsClientError() bool {
   149  	return true
   150  }
   151  
   152  // IsServerError returns true when this import ldap user bad request response has a 5xx status code
   153  func (o *ImportLdapUserBadRequest) IsServerError() bool {
   154  	return false
   155  }
   156  
   157  // IsCode returns true when this import ldap user bad request response a status code equal to that given
   158  func (o *ImportLdapUserBadRequest) IsCode(code int) bool {
   159  	return code == 400
   160  }
   161  
   162  func (o *ImportLdapUserBadRequest) Error() string {
   163  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserBadRequest  %+v", 400, o.Payload)
   164  }
   165  
   166  func (o *ImportLdapUserBadRequest) String() string {
   167  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserBadRequest  %+v", 400, o.Payload)
   168  }
   169  
   170  func (o *ImportLdapUserBadRequest) GetPayload() *models.Errors {
   171  	return o.Payload
   172  }
   173  
   174  func (o *ImportLdapUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   175  
   176  	// hydrates response header X-Request-Id
   177  	hdrXRequestID := response.GetHeader("X-Request-Id")
   178  
   179  	if hdrXRequestID != "" {
   180  		o.XRequestID = hdrXRequestID
   181  	}
   182  
   183  	o.Payload = new(models.Errors)
   184  
   185  	// response payload
   186  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   187  		return err
   188  	}
   189  
   190  	return nil
   191  }
   192  
   193  // NewImportLdapUserUnauthorized creates a ImportLdapUserUnauthorized with default headers values
   194  func NewImportLdapUserUnauthorized() *ImportLdapUserUnauthorized {
   195  	return &ImportLdapUserUnauthorized{}
   196  }
   197  
   198  /*
   199  ImportLdapUserUnauthorized describes a response with status code 401, with default header values.
   200  
   201  Unauthorized
   202  */
   203  type ImportLdapUserUnauthorized struct {
   204  
   205  	/* The ID of the corresponding request for the response
   206  	 */
   207  	XRequestID string
   208  
   209  	Payload *models.Errors
   210  }
   211  
   212  // IsSuccess returns true when this import ldap user unauthorized response has a 2xx status code
   213  func (o *ImportLdapUserUnauthorized) IsSuccess() bool {
   214  	return false
   215  }
   216  
   217  // IsRedirect returns true when this import ldap user unauthorized response has a 3xx status code
   218  func (o *ImportLdapUserUnauthorized) IsRedirect() bool {
   219  	return false
   220  }
   221  
   222  // IsClientError returns true when this import ldap user unauthorized response has a 4xx status code
   223  func (o *ImportLdapUserUnauthorized) IsClientError() bool {
   224  	return true
   225  }
   226  
   227  // IsServerError returns true when this import ldap user unauthorized response has a 5xx status code
   228  func (o *ImportLdapUserUnauthorized) IsServerError() bool {
   229  	return false
   230  }
   231  
   232  // IsCode returns true when this import ldap user unauthorized response a status code equal to that given
   233  func (o *ImportLdapUserUnauthorized) IsCode(code int) bool {
   234  	return code == 401
   235  }
   236  
   237  func (o *ImportLdapUserUnauthorized) Error() string {
   238  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserUnauthorized  %+v", 401, o.Payload)
   239  }
   240  
   241  func (o *ImportLdapUserUnauthorized) String() string {
   242  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserUnauthorized  %+v", 401, o.Payload)
   243  }
   244  
   245  func (o *ImportLdapUserUnauthorized) GetPayload() *models.Errors {
   246  	return o.Payload
   247  }
   248  
   249  func (o *ImportLdapUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   250  
   251  	// hydrates response header X-Request-Id
   252  	hdrXRequestID := response.GetHeader("X-Request-Id")
   253  
   254  	if hdrXRequestID != "" {
   255  		o.XRequestID = hdrXRequestID
   256  	}
   257  
   258  	o.Payload = new(models.Errors)
   259  
   260  	// response payload
   261  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   262  		return err
   263  	}
   264  
   265  	return nil
   266  }
   267  
   268  // NewImportLdapUserForbidden creates a ImportLdapUserForbidden with default headers values
   269  func NewImportLdapUserForbidden() *ImportLdapUserForbidden {
   270  	return &ImportLdapUserForbidden{}
   271  }
   272  
   273  /*
   274  ImportLdapUserForbidden describes a response with status code 403, with default header values.
   275  
   276  Forbidden
   277  */
   278  type ImportLdapUserForbidden struct {
   279  
   280  	/* The ID of the corresponding request for the response
   281  	 */
   282  	XRequestID string
   283  
   284  	Payload *models.Errors
   285  }
   286  
   287  // IsSuccess returns true when this import ldap user forbidden response has a 2xx status code
   288  func (o *ImportLdapUserForbidden) IsSuccess() bool {
   289  	return false
   290  }
   291  
   292  // IsRedirect returns true when this import ldap user forbidden response has a 3xx status code
   293  func (o *ImportLdapUserForbidden) IsRedirect() bool {
   294  	return false
   295  }
   296  
   297  // IsClientError returns true when this import ldap user forbidden response has a 4xx status code
   298  func (o *ImportLdapUserForbidden) IsClientError() bool {
   299  	return true
   300  }
   301  
   302  // IsServerError returns true when this import ldap user forbidden response has a 5xx status code
   303  func (o *ImportLdapUserForbidden) IsServerError() bool {
   304  	return false
   305  }
   306  
   307  // IsCode returns true when this import ldap user forbidden response a status code equal to that given
   308  func (o *ImportLdapUserForbidden) IsCode(code int) bool {
   309  	return code == 403
   310  }
   311  
   312  func (o *ImportLdapUserForbidden) Error() string {
   313  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserForbidden  %+v", 403, o.Payload)
   314  }
   315  
   316  func (o *ImportLdapUserForbidden) String() string {
   317  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserForbidden  %+v", 403, o.Payload)
   318  }
   319  
   320  func (o *ImportLdapUserForbidden) GetPayload() *models.Errors {
   321  	return o.Payload
   322  }
   323  
   324  func (o *ImportLdapUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   325  
   326  	// hydrates response header X-Request-Id
   327  	hdrXRequestID := response.GetHeader("X-Request-Id")
   328  
   329  	if hdrXRequestID != "" {
   330  		o.XRequestID = hdrXRequestID
   331  	}
   332  
   333  	o.Payload = new(models.Errors)
   334  
   335  	// response payload
   336  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   337  		return err
   338  	}
   339  
   340  	return nil
   341  }
   342  
   343  // NewImportLdapUserNotFound creates a ImportLdapUserNotFound with default headers values
   344  func NewImportLdapUserNotFound() *ImportLdapUserNotFound {
   345  	return &ImportLdapUserNotFound{}
   346  }
   347  
   348  /*
   349  ImportLdapUserNotFound describes a response with status code 404, with default header values.
   350  
   351  Failed import some users.
   352  */
   353  type ImportLdapUserNotFound struct {
   354  	Payload []*models.LdapFailedImportUser
   355  }
   356  
   357  // IsSuccess returns true when this import ldap user not found response has a 2xx status code
   358  func (o *ImportLdapUserNotFound) IsSuccess() bool {
   359  	return false
   360  }
   361  
   362  // IsRedirect returns true when this import ldap user not found response has a 3xx status code
   363  func (o *ImportLdapUserNotFound) IsRedirect() bool {
   364  	return false
   365  }
   366  
   367  // IsClientError returns true when this import ldap user not found response has a 4xx status code
   368  func (o *ImportLdapUserNotFound) IsClientError() bool {
   369  	return true
   370  }
   371  
   372  // IsServerError returns true when this import ldap user not found response has a 5xx status code
   373  func (o *ImportLdapUserNotFound) IsServerError() bool {
   374  	return false
   375  }
   376  
   377  // IsCode returns true when this import ldap user not found response a status code equal to that given
   378  func (o *ImportLdapUserNotFound) IsCode(code int) bool {
   379  	return code == 404
   380  }
   381  
   382  func (o *ImportLdapUserNotFound) Error() string {
   383  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserNotFound  %+v", 404, o.Payload)
   384  }
   385  
   386  func (o *ImportLdapUserNotFound) String() string {
   387  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserNotFound  %+v", 404, o.Payload)
   388  }
   389  
   390  func (o *ImportLdapUserNotFound) GetPayload() []*models.LdapFailedImportUser {
   391  	return o.Payload
   392  }
   393  
   394  func (o *ImportLdapUserNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   395  
   396  	// response payload
   397  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   398  		return err
   399  	}
   400  
   401  	return nil
   402  }
   403  
   404  // NewImportLdapUserInternalServerError creates a ImportLdapUserInternalServerError with default headers values
   405  func NewImportLdapUserInternalServerError() *ImportLdapUserInternalServerError {
   406  	return &ImportLdapUserInternalServerError{}
   407  }
   408  
   409  /*
   410  ImportLdapUserInternalServerError describes a response with status code 500, with default header values.
   411  
   412  Internal server error
   413  */
   414  type ImportLdapUserInternalServerError struct {
   415  
   416  	/* The ID of the corresponding request for the response
   417  	 */
   418  	XRequestID string
   419  
   420  	Payload *models.Errors
   421  }
   422  
   423  // IsSuccess returns true when this import ldap user internal server error response has a 2xx status code
   424  func (o *ImportLdapUserInternalServerError) IsSuccess() bool {
   425  	return false
   426  }
   427  
   428  // IsRedirect returns true when this import ldap user internal server error response has a 3xx status code
   429  func (o *ImportLdapUserInternalServerError) IsRedirect() bool {
   430  	return false
   431  }
   432  
   433  // IsClientError returns true when this import ldap user internal server error response has a 4xx status code
   434  func (o *ImportLdapUserInternalServerError) IsClientError() bool {
   435  	return false
   436  }
   437  
   438  // IsServerError returns true when this import ldap user internal server error response has a 5xx status code
   439  func (o *ImportLdapUserInternalServerError) IsServerError() bool {
   440  	return true
   441  }
   442  
   443  // IsCode returns true when this import ldap user internal server error response a status code equal to that given
   444  func (o *ImportLdapUserInternalServerError) IsCode(code int) bool {
   445  	return code == 500
   446  }
   447  
   448  func (o *ImportLdapUserInternalServerError) Error() string {
   449  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserInternalServerError  %+v", 500, o.Payload)
   450  }
   451  
   452  func (o *ImportLdapUserInternalServerError) String() string {
   453  	return fmt.Sprintf("[POST /ldap/users/import][%d] importLdapUserInternalServerError  %+v", 500, o.Payload)
   454  }
   455  
   456  func (o *ImportLdapUserInternalServerError) GetPayload() *models.Errors {
   457  	return o.Payload
   458  }
   459  
   460  func (o *ImportLdapUserInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   461  
   462  	// hydrates response header X-Request-Id
   463  	hdrXRequestID := response.GetHeader("X-Request-Id")
   464  
   465  	if hdrXRequestID != "" {
   466  		o.XRequestID = hdrXRequestID
   467  	}
   468  
   469  	o.Payload = new(models.Errors)
   470  
   471  	// response payload
   472  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   473  		return err
   474  	}
   475  
   476  	return nil
   477  }