github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/user/update_user_password_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package user
     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  // UpdateUserPasswordReader is a Reader for the UpdateUserPassword structure.
    19  type UpdateUserPasswordReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *UpdateUserPasswordReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewUpdateUserPasswordOK()
    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 := NewUpdateUserPasswordBadRequest()
    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 := NewUpdateUserPasswordUnauthorized()
    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 := NewUpdateUserPasswordForbidden()
    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 := NewUpdateUserPasswordInternalServerError()
    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  // NewUpdateUserPasswordOK creates a UpdateUserPasswordOK with default headers values
    62  func NewUpdateUserPasswordOK() *UpdateUserPasswordOK {
    63  	return &UpdateUserPasswordOK{}
    64  }
    65  
    66  /*
    67  UpdateUserPasswordOK describes a response with status code 200, with default header values.
    68  
    69  Success
    70  */
    71  type UpdateUserPasswordOK struct {
    72  
    73  	/* The ID of the corresponding request for the response
    74  	 */
    75  	XRequestID string
    76  }
    77  
    78  // IsSuccess returns true when this update user password o k response has a 2xx status code
    79  func (o *UpdateUserPasswordOK) IsSuccess() bool {
    80  	return true
    81  }
    82  
    83  // IsRedirect returns true when this update user password o k response has a 3xx status code
    84  func (o *UpdateUserPasswordOK) IsRedirect() bool {
    85  	return false
    86  }
    87  
    88  // IsClientError returns true when this update user password o k response has a 4xx status code
    89  func (o *UpdateUserPasswordOK) IsClientError() bool {
    90  	return false
    91  }
    92  
    93  // IsServerError returns true when this update user password o k response has a 5xx status code
    94  func (o *UpdateUserPasswordOK) IsServerError() bool {
    95  	return false
    96  }
    97  
    98  // IsCode returns true when this update user password o k response a status code equal to that given
    99  func (o *UpdateUserPasswordOK) IsCode(code int) bool {
   100  	return code == 200
   101  }
   102  
   103  func (o *UpdateUserPasswordOK) Error() string {
   104  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordOK ", 200)
   105  }
   106  
   107  func (o *UpdateUserPasswordOK) String() string {
   108  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordOK ", 200)
   109  }
   110  
   111  func (o *UpdateUserPasswordOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   112  
   113  	// hydrates response header X-Request-Id
   114  	hdrXRequestID := response.GetHeader("X-Request-Id")
   115  
   116  	if hdrXRequestID != "" {
   117  		o.XRequestID = hdrXRequestID
   118  	}
   119  
   120  	return nil
   121  }
   122  
   123  // NewUpdateUserPasswordBadRequest creates a UpdateUserPasswordBadRequest with default headers values
   124  func NewUpdateUserPasswordBadRequest() *UpdateUserPasswordBadRequest {
   125  	return &UpdateUserPasswordBadRequest{}
   126  }
   127  
   128  /*
   129  UpdateUserPasswordBadRequest describes a response with status code 400, with default header values.
   130  
   131  Invalid user ID; Password does not meet requirement
   132  */
   133  type UpdateUserPasswordBadRequest struct {
   134  }
   135  
   136  // IsSuccess returns true when this update user password bad request response has a 2xx status code
   137  func (o *UpdateUserPasswordBadRequest) IsSuccess() bool {
   138  	return false
   139  }
   140  
   141  // IsRedirect returns true when this update user password bad request response has a 3xx status code
   142  func (o *UpdateUserPasswordBadRequest) IsRedirect() bool {
   143  	return false
   144  }
   145  
   146  // IsClientError returns true when this update user password bad request response has a 4xx status code
   147  func (o *UpdateUserPasswordBadRequest) IsClientError() bool {
   148  	return true
   149  }
   150  
   151  // IsServerError returns true when this update user password bad request response has a 5xx status code
   152  func (o *UpdateUserPasswordBadRequest) IsServerError() bool {
   153  	return false
   154  }
   155  
   156  // IsCode returns true when this update user password bad request response a status code equal to that given
   157  func (o *UpdateUserPasswordBadRequest) IsCode(code int) bool {
   158  	return code == 400
   159  }
   160  
   161  func (o *UpdateUserPasswordBadRequest) Error() string {
   162  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordBadRequest ", 400)
   163  }
   164  
   165  func (o *UpdateUserPasswordBadRequest) String() string {
   166  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordBadRequest ", 400)
   167  }
   168  
   169  func (o *UpdateUserPasswordBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   170  
   171  	return nil
   172  }
   173  
   174  // NewUpdateUserPasswordUnauthorized creates a UpdateUserPasswordUnauthorized with default headers values
   175  func NewUpdateUserPasswordUnauthorized() *UpdateUserPasswordUnauthorized {
   176  	return &UpdateUserPasswordUnauthorized{}
   177  }
   178  
   179  /*
   180  UpdateUserPasswordUnauthorized describes a response with status code 401, with default header values.
   181  
   182  Unauthorized
   183  */
   184  type UpdateUserPasswordUnauthorized struct {
   185  
   186  	/* The ID of the corresponding request for the response
   187  	 */
   188  	XRequestID string
   189  
   190  	Payload *models.Errors
   191  }
   192  
   193  // IsSuccess returns true when this update user password unauthorized response has a 2xx status code
   194  func (o *UpdateUserPasswordUnauthorized) IsSuccess() bool {
   195  	return false
   196  }
   197  
   198  // IsRedirect returns true when this update user password unauthorized response has a 3xx status code
   199  func (o *UpdateUserPasswordUnauthorized) IsRedirect() bool {
   200  	return false
   201  }
   202  
   203  // IsClientError returns true when this update user password unauthorized response has a 4xx status code
   204  func (o *UpdateUserPasswordUnauthorized) IsClientError() bool {
   205  	return true
   206  }
   207  
   208  // IsServerError returns true when this update user password unauthorized response has a 5xx status code
   209  func (o *UpdateUserPasswordUnauthorized) IsServerError() bool {
   210  	return false
   211  }
   212  
   213  // IsCode returns true when this update user password unauthorized response a status code equal to that given
   214  func (o *UpdateUserPasswordUnauthorized) IsCode(code int) bool {
   215  	return code == 401
   216  }
   217  
   218  func (o *UpdateUserPasswordUnauthorized) Error() string {
   219  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordUnauthorized  %+v", 401, o.Payload)
   220  }
   221  
   222  func (o *UpdateUserPasswordUnauthorized) String() string {
   223  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordUnauthorized  %+v", 401, o.Payload)
   224  }
   225  
   226  func (o *UpdateUserPasswordUnauthorized) GetPayload() *models.Errors {
   227  	return o.Payload
   228  }
   229  
   230  func (o *UpdateUserPasswordUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   231  
   232  	// hydrates response header X-Request-Id
   233  	hdrXRequestID := response.GetHeader("X-Request-Id")
   234  
   235  	if hdrXRequestID != "" {
   236  		o.XRequestID = hdrXRequestID
   237  	}
   238  
   239  	o.Payload = new(models.Errors)
   240  
   241  	// response payload
   242  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   243  		return err
   244  	}
   245  
   246  	return nil
   247  }
   248  
   249  // NewUpdateUserPasswordForbidden creates a UpdateUserPasswordForbidden with default headers values
   250  func NewUpdateUserPasswordForbidden() *UpdateUserPasswordForbidden {
   251  	return &UpdateUserPasswordForbidden{}
   252  }
   253  
   254  /*
   255  UpdateUserPasswordForbidden describes a response with status code 403, with default header values.
   256  
   257  The caller does not have permission to update the password of the user with given ID, or the old password in request body is not correct.
   258  */
   259  type UpdateUserPasswordForbidden struct {
   260  }
   261  
   262  // IsSuccess returns true when this update user password forbidden response has a 2xx status code
   263  func (o *UpdateUserPasswordForbidden) IsSuccess() bool {
   264  	return false
   265  }
   266  
   267  // IsRedirect returns true when this update user password forbidden response has a 3xx status code
   268  func (o *UpdateUserPasswordForbidden) IsRedirect() bool {
   269  	return false
   270  }
   271  
   272  // IsClientError returns true when this update user password forbidden response has a 4xx status code
   273  func (o *UpdateUserPasswordForbidden) IsClientError() bool {
   274  	return true
   275  }
   276  
   277  // IsServerError returns true when this update user password forbidden response has a 5xx status code
   278  func (o *UpdateUserPasswordForbidden) IsServerError() bool {
   279  	return false
   280  }
   281  
   282  // IsCode returns true when this update user password forbidden response a status code equal to that given
   283  func (o *UpdateUserPasswordForbidden) IsCode(code int) bool {
   284  	return code == 403
   285  }
   286  
   287  func (o *UpdateUserPasswordForbidden) Error() string {
   288  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordForbidden ", 403)
   289  }
   290  
   291  func (o *UpdateUserPasswordForbidden) String() string {
   292  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordForbidden ", 403)
   293  }
   294  
   295  func (o *UpdateUserPasswordForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   296  
   297  	return nil
   298  }
   299  
   300  // NewUpdateUserPasswordInternalServerError creates a UpdateUserPasswordInternalServerError with default headers values
   301  func NewUpdateUserPasswordInternalServerError() *UpdateUserPasswordInternalServerError {
   302  	return &UpdateUserPasswordInternalServerError{}
   303  }
   304  
   305  /*
   306  UpdateUserPasswordInternalServerError describes a response with status code 500, with default header values.
   307  
   308  Internal server error
   309  */
   310  type UpdateUserPasswordInternalServerError struct {
   311  
   312  	/* The ID of the corresponding request for the response
   313  	 */
   314  	XRequestID string
   315  
   316  	Payload *models.Errors
   317  }
   318  
   319  // IsSuccess returns true when this update user password internal server error response has a 2xx status code
   320  func (o *UpdateUserPasswordInternalServerError) IsSuccess() bool {
   321  	return false
   322  }
   323  
   324  // IsRedirect returns true when this update user password internal server error response has a 3xx status code
   325  func (o *UpdateUserPasswordInternalServerError) IsRedirect() bool {
   326  	return false
   327  }
   328  
   329  // IsClientError returns true when this update user password internal server error response has a 4xx status code
   330  func (o *UpdateUserPasswordInternalServerError) IsClientError() bool {
   331  	return false
   332  }
   333  
   334  // IsServerError returns true when this update user password internal server error response has a 5xx status code
   335  func (o *UpdateUserPasswordInternalServerError) IsServerError() bool {
   336  	return true
   337  }
   338  
   339  // IsCode returns true when this update user password internal server error response a status code equal to that given
   340  func (o *UpdateUserPasswordInternalServerError) IsCode(code int) bool {
   341  	return code == 500
   342  }
   343  
   344  func (o *UpdateUserPasswordInternalServerError) Error() string {
   345  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordInternalServerError  %+v", 500, o.Payload)
   346  }
   347  
   348  func (o *UpdateUserPasswordInternalServerError) String() string {
   349  	return fmt.Sprintf("[PUT /users/{user_id}/password][%d] updateUserPasswordInternalServerError  %+v", 500, o.Payload)
   350  }
   351  
   352  func (o *UpdateUserPasswordInternalServerError) GetPayload() *models.Errors {
   353  	return o.Payload
   354  }
   355  
   356  func (o *UpdateUserPasswordInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   357  
   358  	// hydrates response header X-Request-Id
   359  	hdrXRequestID := response.GetHeader("X-Request-Id")
   360  
   361  	if hdrXRequestID != "" {
   362  		o.XRequestID = hdrXRequestID
   363  	}
   364  
   365  	o.Payload = new(models.Errors)
   366  
   367  	// response payload
   368  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   369  		return err
   370  	}
   371  
   372  	return nil
   373  }