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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package registry
     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  // UpdateRegistryReader is a Reader for the UpdateRegistry structure.
    19  type UpdateRegistryReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *UpdateRegistryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewUpdateRegistryOK()
    28  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    29  			return nil, err
    30  		}
    31  		return result, nil
    32  	case 401:
    33  		result := NewUpdateRegistryUnauthorized()
    34  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    35  			return nil, err
    36  		}
    37  		return nil, result
    38  	case 403:
    39  		result := NewUpdateRegistryForbidden()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return nil, result
    44  	case 404:
    45  		result := NewUpdateRegistryNotFound()
    46  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    47  			return nil, err
    48  		}
    49  		return nil, result
    50  	case 409:
    51  		result := NewUpdateRegistryConflict()
    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 := NewUpdateRegistryInternalServerError()
    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  // NewUpdateRegistryOK creates a UpdateRegistryOK with default headers values
    68  func NewUpdateRegistryOK() *UpdateRegistryOK {
    69  	return &UpdateRegistryOK{}
    70  }
    71  
    72  /*
    73  UpdateRegistryOK describes a response with status code 200, with default header values.
    74  
    75  Success
    76  */
    77  type UpdateRegistryOK struct {
    78  
    79  	/* The ID of the corresponding request for the response
    80  	 */
    81  	XRequestID string
    82  }
    83  
    84  // IsSuccess returns true when this update registry o k response has a 2xx status code
    85  func (o *UpdateRegistryOK) IsSuccess() bool {
    86  	return true
    87  }
    88  
    89  // IsRedirect returns true when this update registry o k response has a 3xx status code
    90  func (o *UpdateRegistryOK) IsRedirect() bool {
    91  	return false
    92  }
    93  
    94  // IsClientError returns true when this update registry o k response has a 4xx status code
    95  func (o *UpdateRegistryOK) IsClientError() bool {
    96  	return false
    97  }
    98  
    99  // IsServerError returns true when this update registry o k response has a 5xx status code
   100  func (o *UpdateRegistryOK) IsServerError() bool {
   101  	return false
   102  }
   103  
   104  // IsCode returns true when this update registry o k response a status code equal to that given
   105  func (o *UpdateRegistryOK) IsCode(code int) bool {
   106  	return code == 200
   107  }
   108  
   109  func (o *UpdateRegistryOK) Error() string {
   110  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryOK ", 200)
   111  }
   112  
   113  func (o *UpdateRegistryOK) String() string {
   114  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryOK ", 200)
   115  }
   116  
   117  func (o *UpdateRegistryOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   118  
   119  	// hydrates response header X-Request-Id
   120  	hdrXRequestID := response.GetHeader("X-Request-Id")
   121  
   122  	if hdrXRequestID != "" {
   123  		o.XRequestID = hdrXRequestID
   124  	}
   125  
   126  	return nil
   127  }
   128  
   129  // NewUpdateRegistryUnauthorized creates a UpdateRegistryUnauthorized with default headers values
   130  func NewUpdateRegistryUnauthorized() *UpdateRegistryUnauthorized {
   131  	return &UpdateRegistryUnauthorized{}
   132  }
   133  
   134  /*
   135  UpdateRegistryUnauthorized describes a response with status code 401, with default header values.
   136  
   137  Unauthorized
   138  */
   139  type UpdateRegistryUnauthorized struct {
   140  
   141  	/* The ID of the corresponding request for the response
   142  	 */
   143  	XRequestID string
   144  
   145  	Payload *models.Errors
   146  }
   147  
   148  // IsSuccess returns true when this update registry unauthorized response has a 2xx status code
   149  func (o *UpdateRegistryUnauthorized) IsSuccess() bool {
   150  	return false
   151  }
   152  
   153  // IsRedirect returns true when this update registry unauthorized response has a 3xx status code
   154  func (o *UpdateRegistryUnauthorized) IsRedirect() bool {
   155  	return false
   156  }
   157  
   158  // IsClientError returns true when this update registry unauthorized response has a 4xx status code
   159  func (o *UpdateRegistryUnauthorized) IsClientError() bool {
   160  	return true
   161  }
   162  
   163  // IsServerError returns true when this update registry unauthorized response has a 5xx status code
   164  func (o *UpdateRegistryUnauthorized) IsServerError() bool {
   165  	return false
   166  }
   167  
   168  // IsCode returns true when this update registry unauthorized response a status code equal to that given
   169  func (o *UpdateRegistryUnauthorized) IsCode(code int) bool {
   170  	return code == 401
   171  }
   172  
   173  func (o *UpdateRegistryUnauthorized) Error() string {
   174  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryUnauthorized  %+v", 401, o.Payload)
   175  }
   176  
   177  func (o *UpdateRegistryUnauthorized) String() string {
   178  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryUnauthorized  %+v", 401, o.Payload)
   179  }
   180  
   181  func (o *UpdateRegistryUnauthorized) GetPayload() *models.Errors {
   182  	return o.Payload
   183  }
   184  
   185  func (o *UpdateRegistryUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   186  
   187  	// hydrates response header X-Request-Id
   188  	hdrXRequestID := response.GetHeader("X-Request-Id")
   189  
   190  	if hdrXRequestID != "" {
   191  		o.XRequestID = hdrXRequestID
   192  	}
   193  
   194  	o.Payload = new(models.Errors)
   195  
   196  	// response payload
   197  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   198  		return err
   199  	}
   200  
   201  	return nil
   202  }
   203  
   204  // NewUpdateRegistryForbidden creates a UpdateRegistryForbidden with default headers values
   205  func NewUpdateRegistryForbidden() *UpdateRegistryForbidden {
   206  	return &UpdateRegistryForbidden{}
   207  }
   208  
   209  /*
   210  UpdateRegistryForbidden describes a response with status code 403, with default header values.
   211  
   212  Forbidden
   213  */
   214  type UpdateRegistryForbidden struct {
   215  
   216  	/* The ID of the corresponding request for the response
   217  	 */
   218  	XRequestID string
   219  
   220  	Payload *models.Errors
   221  }
   222  
   223  // IsSuccess returns true when this update registry forbidden response has a 2xx status code
   224  func (o *UpdateRegistryForbidden) IsSuccess() bool {
   225  	return false
   226  }
   227  
   228  // IsRedirect returns true when this update registry forbidden response has a 3xx status code
   229  func (o *UpdateRegistryForbidden) IsRedirect() bool {
   230  	return false
   231  }
   232  
   233  // IsClientError returns true when this update registry forbidden response has a 4xx status code
   234  func (o *UpdateRegistryForbidden) IsClientError() bool {
   235  	return true
   236  }
   237  
   238  // IsServerError returns true when this update registry forbidden response has a 5xx status code
   239  func (o *UpdateRegistryForbidden) IsServerError() bool {
   240  	return false
   241  }
   242  
   243  // IsCode returns true when this update registry forbidden response a status code equal to that given
   244  func (o *UpdateRegistryForbidden) IsCode(code int) bool {
   245  	return code == 403
   246  }
   247  
   248  func (o *UpdateRegistryForbidden) Error() string {
   249  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryForbidden  %+v", 403, o.Payload)
   250  }
   251  
   252  func (o *UpdateRegistryForbidden) String() string {
   253  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryForbidden  %+v", 403, o.Payload)
   254  }
   255  
   256  func (o *UpdateRegistryForbidden) GetPayload() *models.Errors {
   257  	return o.Payload
   258  }
   259  
   260  func (o *UpdateRegistryForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   261  
   262  	// hydrates response header X-Request-Id
   263  	hdrXRequestID := response.GetHeader("X-Request-Id")
   264  
   265  	if hdrXRequestID != "" {
   266  		o.XRequestID = hdrXRequestID
   267  	}
   268  
   269  	o.Payload = new(models.Errors)
   270  
   271  	// response payload
   272  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   273  		return err
   274  	}
   275  
   276  	return nil
   277  }
   278  
   279  // NewUpdateRegistryNotFound creates a UpdateRegistryNotFound with default headers values
   280  func NewUpdateRegistryNotFound() *UpdateRegistryNotFound {
   281  	return &UpdateRegistryNotFound{}
   282  }
   283  
   284  /*
   285  UpdateRegistryNotFound describes a response with status code 404, with default header values.
   286  
   287  Not found
   288  */
   289  type UpdateRegistryNotFound struct {
   290  
   291  	/* The ID of the corresponding request for the response
   292  	 */
   293  	XRequestID string
   294  
   295  	Payload *models.Errors
   296  }
   297  
   298  // IsSuccess returns true when this update registry not found response has a 2xx status code
   299  func (o *UpdateRegistryNotFound) IsSuccess() bool {
   300  	return false
   301  }
   302  
   303  // IsRedirect returns true when this update registry not found response has a 3xx status code
   304  func (o *UpdateRegistryNotFound) IsRedirect() bool {
   305  	return false
   306  }
   307  
   308  // IsClientError returns true when this update registry not found response has a 4xx status code
   309  func (o *UpdateRegistryNotFound) IsClientError() bool {
   310  	return true
   311  }
   312  
   313  // IsServerError returns true when this update registry not found response has a 5xx status code
   314  func (o *UpdateRegistryNotFound) IsServerError() bool {
   315  	return false
   316  }
   317  
   318  // IsCode returns true when this update registry not found response a status code equal to that given
   319  func (o *UpdateRegistryNotFound) IsCode(code int) bool {
   320  	return code == 404
   321  }
   322  
   323  func (o *UpdateRegistryNotFound) Error() string {
   324  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryNotFound  %+v", 404, o.Payload)
   325  }
   326  
   327  func (o *UpdateRegistryNotFound) String() string {
   328  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryNotFound  %+v", 404, o.Payload)
   329  }
   330  
   331  func (o *UpdateRegistryNotFound) GetPayload() *models.Errors {
   332  	return o.Payload
   333  }
   334  
   335  func (o *UpdateRegistryNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   336  
   337  	// hydrates response header X-Request-Id
   338  	hdrXRequestID := response.GetHeader("X-Request-Id")
   339  
   340  	if hdrXRequestID != "" {
   341  		o.XRequestID = hdrXRequestID
   342  	}
   343  
   344  	o.Payload = new(models.Errors)
   345  
   346  	// response payload
   347  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   348  		return err
   349  	}
   350  
   351  	return nil
   352  }
   353  
   354  // NewUpdateRegistryConflict creates a UpdateRegistryConflict with default headers values
   355  func NewUpdateRegistryConflict() *UpdateRegistryConflict {
   356  	return &UpdateRegistryConflict{}
   357  }
   358  
   359  /*
   360  UpdateRegistryConflict describes a response with status code 409, with default header values.
   361  
   362  Conflict
   363  */
   364  type UpdateRegistryConflict struct {
   365  
   366  	/* The ID of the corresponding request for the response
   367  	 */
   368  	XRequestID string
   369  
   370  	Payload *models.Errors
   371  }
   372  
   373  // IsSuccess returns true when this update registry conflict response has a 2xx status code
   374  func (o *UpdateRegistryConflict) IsSuccess() bool {
   375  	return false
   376  }
   377  
   378  // IsRedirect returns true when this update registry conflict response has a 3xx status code
   379  func (o *UpdateRegistryConflict) IsRedirect() bool {
   380  	return false
   381  }
   382  
   383  // IsClientError returns true when this update registry conflict response has a 4xx status code
   384  func (o *UpdateRegistryConflict) IsClientError() bool {
   385  	return true
   386  }
   387  
   388  // IsServerError returns true when this update registry conflict response has a 5xx status code
   389  func (o *UpdateRegistryConflict) IsServerError() bool {
   390  	return false
   391  }
   392  
   393  // IsCode returns true when this update registry conflict response a status code equal to that given
   394  func (o *UpdateRegistryConflict) IsCode(code int) bool {
   395  	return code == 409
   396  }
   397  
   398  func (o *UpdateRegistryConflict) Error() string {
   399  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryConflict  %+v", 409, o.Payload)
   400  }
   401  
   402  func (o *UpdateRegistryConflict) String() string {
   403  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryConflict  %+v", 409, o.Payload)
   404  }
   405  
   406  func (o *UpdateRegistryConflict) GetPayload() *models.Errors {
   407  	return o.Payload
   408  }
   409  
   410  func (o *UpdateRegistryConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   411  
   412  	// hydrates response header X-Request-Id
   413  	hdrXRequestID := response.GetHeader("X-Request-Id")
   414  
   415  	if hdrXRequestID != "" {
   416  		o.XRequestID = hdrXRequestID
   417  	}
   418  
   419  	o.Payload = new(models.Errors)
   420  
   421  	// response payload
   422  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   423  		return err
   424  	}
   425  
   426  	return nil
   427  }
   428  
   429  // NewUpdateRegistryInternalServerError creates a UpdateRegistryInternalServerError with default headers values
   430  func NewUpdateRegistryInternalServerError() *UpdateRegistryInternalServerError {
   431  	return &UpdateRegistryInternalServerError{}
   432  }
   433  
   434  /*
   435  UpdateRegistryInternalServerError describes a response with status code 500, with default header values.
   436  
   437  Internal server error
   438  */
   439  type UpdateRegistryInternalServerError struct {
   440  
   441  	/* The ID of the corresponding request for the response
   442  	 */
   443  	XRequestID string
   444  
   445  	Payload *models.Errors
   446  }
   447  
   448  // IsSuccess returns true when this update registry internal server error response has a 2xx status code
   449  func (o *UpdateRegistryInternalServerError) IsSuccess() bool {
   450  	return false
   451  }
   452  
   453  // IsRedirect returns true when this update registry internal server error response has a 3xx status code
   454  func (o *UpdateRegistryInternalServerError) IsRedirect() bool {
   455  	return false
   456  }
   457  
   458  // IsClientError returns true when this update registry internal server error response has a 4xx status code
   459  func (o *UpdateRegistryInternalServerError) IsClientError() bool {
   460  	return false
   461  }
   462  
   463  // IsServerError returns true when this update registry internal server error response has a 5xx status code
   464  func (o *UpdateRegistryInternalServerError) IsServerError() bool {
   465  	return true
   466  }
   467  
   468  // IsCode returns true when this update registry internal server error response a status code equal to that given
   469  func (o *UpdateRegistryInternalServerError) IsCode(code int) bool {
   470  	return code == 500
   471  }
   472  
   473  func (o *UpdateRegistryInternalServerError) Error() string {
   474  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryInternalServerError  %+v", 500, o.Payload)
   475  }
   476  
   477  func (o *UpdateRegistryInternalServerError) String() string {
   478  	return fmt.Sprintf("[PUT /registries/{id}][%d] updateRegistryInternalServerError  %+v", 500, o.Payload)
   479  }
   480  
   481  func (o *UpdateRegistryInternalServerError) GetPayload() *models.Errors {
   482  	return o.Payload
   483  }
   484  
   485  func (o *UpdateRegistryInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   486  
   487  	// hydrates response header X-Request-Id
   488  	hdrXRequestID := response.GetHeader("X-Request-Id")
   489  
   490  	if hdrXRequestID != "" {
   491  		o.XRequestID = hdrXRequestID
   492  	}
   493  
   494  	o.Payload = new(models.Errors)
   495  
   496  	// response payload
   497  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   498  		return err
   499  	}
   500  
   501  	return nil
   502  }