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