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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package project_metadata
     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  // AddProjectMetadatasReader is a Reader for the AddProjectMetadatas structure.
    19  type AddProjectMetadatasReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *AddProjectMetadatasReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewAddProjectMetadatasOK()
    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 := NewAddProjectMetadatasBadRequest()
    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 := NewAddProjectMetadatasUnauthorized()
    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 := NewAddProjectMetadatasForbidden()
    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 := NewAddProjectMetadatasNotFound()
    52  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    53  			return nil, err
    54  		}
    55  		return nil, result
    56  	case 409:
    57  		result := NewAddProjectMetadatasConflict()
    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 := NewAddProjectMetadatasInternalServerError()
    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  // NewAddProjectMetadatasOK creates a AddProjectMetadatasOK with default headers values
    74  func NewAddProjectMetadatasOK() *AddProjectMetadatasOK {
    75  	return &AddProjectMetadatasOK{}
    76  }
    77  
    78  /*
    79  AddProjectMetadatasOK describes a response with status code 200, with default header values.
    80  
    81  Success
    82  */
    83  type AddProjectMetadatasOK struct {
    84  
    85  	/* The ID of the corresponding request for the response
    86  	 */
    87  	XRequestID string
    88  }
    89  
    90  // IsSuccess returns true when this add project metadatas o k response has a 2xx status code
    91  func (o *AddProjectMetadatasOK) IsSuccess() bool {
    92  	return true
    93  }
    94  
    95  // IsRedirect returns true when this add project metadatas o k response has a 3xx status code
    96  func (o *AddProjectMetadatasOK) IsRedirect() bool {
    97  	return false
    98  }
    99  
   100  // IsClientError returns true when this add project metadatas o k response has a 4xx status code
   101  func (o *AddProjectMetadatasOK) IsClientError() bool {
   102  	return false
   103  }
   104  
   105  // IsServerError returns true when this add project metadatas o k response has a 5xx status code
   106  func (o *AddProjectMetadatasOK) IsServerError() bool {
   107  	return false
   108  }
   109  
   110  // IsCode returns true when this add project metadatas o k response a status code equal to that given
   111  func (o *AddProjectMetadatasOK) IsCode(code int) bool {
   112  	return code == 200
   113  }
   114  
   115  func (o *AddProjectMetadatasOK) Error() string {
   116  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasOK ", 200)
   117  }
   118  
   119  func (o *AddProjectMetadatasOK) String() string {
   120  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasOK ", 200)
   121  }
   122  
   123  func (o *AddProjectMetadatasOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   124  
   125  	// hydrates response header X-Request-Id
   126  	hdrXRequestID := response.GetHeader("X-Request-Id")
   127  
   128  	if hdrXRequestID != "" {
   129  		o.XRequestID = hdrXRequestID
   130  	}
   131  
   132  	return nil
   133  }
   134  
   135  // NewAddProjectMetadatasBadRequest creates a AddProjectMetadatasBadRequest with default headers values
   136  func NewAddProjectMetadatasBadRequest() *AddProjectMetadatasBadRequest {
   137  	return &AddProjectMetadatasBadRequest{}
   138  }
   139  
   140  /*
   141  AddProjectMetadatasBadRequest describes a response with status code 400, with default header values.
   142  
   143  Bad request
   144  */
   145  type AddProjectMetadatasBadRequest struct {
   146  
   147  	/* The ID of the corresponding request for the response
   148  	 */
   149  	XRequestID string
   150  
   151  	Payload *models.Errors
   152  }
   153  
   154  // IsSuccess returns true when this add project metadatas bad request response has a 2xx status code
   155  func (o *AddProjectMetadatasBadRequest) IsSuccess() bool {
   156  	return false
   157  }
   158  
   159  // IsRedirect returns true when this add project metadatas bad request response has a 3xx status code
   160  func (o *AddProjectMetadatasBadRequest) IsRedirect() bool {
   161  	return false
   162  }
   163  
   164  // IsClientError returns true when this add project metadatas bad request response has a 4xx status code
   165  func (o *AddProjectMetadatasBadRequest) IsClientError() bool {
   166  	return true
   167  }
   168  
   169  // IsServerError returns true when this add project metadatas bad request response has a 5xx status code
   170  func (o *AddProjectMetadatasBadRequest) IsServerError() bool {
   171  	return false
   172  }
   173  
   174  // IsCode returns true when this add project metadatas bad request response a status code equal to that given
   175  func (o *AddProjectMetadatasBadRequest) IsCode(code int) bool {
   176  	return code == 400
   177  }
   178  
   179  func (o *AddProjectMetadatasBadRequest) Error() string {
   180  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasBadRequest  %+v", 400, o.Payload)
   181  }
   182  
   183  func (o *AddProjectMetadatasBadRequest) String() string {
   184  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasBadRequest  %+v", 400, o.Payload)
   185  }
   186  
   187  func (o *AddProjectMetadatasBadRequest) GetPayload() *models.Errors {
   188  	return o.Payload
   189  }
   190  
   191  func (o *AddProjectMetadatasBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   192  
   193  	// hydrates response header X-Request-Id
   194  	hdrXRequestID := response.GetHeader("X-Request-Id")
   195  
   196  	if hdrXRequestID != "" {
   197  		o.XRequestID = hdrXRequestID
   198  	}
   199  
   200  	o.Payload = new(models.Errors)
   201  
   202  	// response payload
   203  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   204  		return err
   205  	}
   206  
   207  	return nil
   208  }
   209  
   210  // NewAddProjectMetadatasUnauthorized creates a AddProjectMetadatasUnauthorized with default headers values
   211  func NewAddProjectMetadatasUnauthorized() *AddProjectMetadatasUnauthorized {
   212  	return &AddProjectMetadatasUnauthorized{}
   213  }
   214  
   215  /*
   216  AddProjectMetadatasUnauthorized describes a response with status code 401, with default header values.
   217  
   218  Unauthorized
   219  */
   220  type AddProjectMetadatasUnauthorized struct {
   221  
   222  	/* The ID of the corresponding request for the response
   223  	 */
   224  	XRequestID string
   225  
   226  	Payload *models.Errors
   227  }
   228  
   229  // IsSuccess returns true when this add project metadatas unauthorized response has a 2xx status code
   230  func (o *AddProjectMetadatasUnauthorized) IsSuccess() bool {
   231  	return false
   232  }
   233  
   234  // IsRedirect returns true when this add project metadatas unauthorized response has a 3xx status code
   235  func (o *AddProjectMetadatasUnauthorized) IsRedirect() bool {
   236  	return false
   237  }
   238  
   239  // IsClientError returns true when this add project metadatas unauthorized response has a 4xx status code
   240  func (o *AddProjectMetadatasUnauthorized) IsClientError() bool {
   241  	return true
   242  }
   243  
   244  // IsServerError returns true when this add project metadatas unauthorized response has a 5xx status code
   245  func (o *AddProjectMetadatasUnauthorized) IsServerError() bool {
   246  	return false
   247  }
   248  
   249  // IsCode returns true when this add project metadatas unauthorized response a status code equal to that given
   250  func (o *AddProjectMetadatasUnauthorized) IsCode(code int) bool {
   251  	return code == 401
   252  }
   253  
   254  func (o *AddProjectMetadatasUnauthorized) Error() string {
   255  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasUnauthorized  %+v", 401, o.Payload)
   256  }
   257  
   258  func (o *AddProjectMetadatasUnauthorized) String() string {
   259  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasUnauthorized  %+v", 401, o.Payload)
   260  }
   261  
   262  func (o *AddProjectMetadatasUnauthorized) GetPayload() *models.Errors {
   263  	return o.Payload
   264  }
   265  
   266  func (o *AddProjectMetadatasUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   267  
   268  	// hydrates response header X-Request-Id
   269  	hdrXRequestID := response.GetHeader("X-Request-Id")
   270  
   271  	if hdrXRequestID != "" {
   272  		o.XRequestID = hdrXRequestID
   273  	}
   274  
   275  	o.Payload = new(models.Errors)
   276  
   277  	// response payload
   278  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   279  		return err
   280  	}
   281  
   282  	return nil
   283  }
   284  
   285  // NewAddProjectMetadatasForbidden creates a AddProjectMetadatasForbidden with default headers values
   286  func NewAddProjectMetadatasForbidden() *AddProjectMetadatasForbidden {
   287  	return &AddProjectMetadatasForbidden{}
   288  }
   289  
   290  /*
   291  AddProjectMetadatasForbidden describes a response with status code 403, with default header values.
   292  
   293  Forbidden
   294  */
   295  type AddProjectMetadatasForbidden struct {
   296  
   297  	/* The ID of the corresponding request for the response
   298  	 */
   299  	XRequestID string
   300  
   301  	Payload *models.Errors
   302  }
   303  
   304  // IsSuccess returns true when this add project metadatas forbidden response has a 2xx status code
   305  func (o *AddProjectMetadatasForbidden) IsSuccess() bool {
   306  	return false
   307  }
   308  
   309  // IsRedirect returns true when this add project metadatas forbidden response has a 3xx status code
   310  func (o *AddProjectMetadatasForbidden) IsRedirect() bool {
   311  	return false
   312  }
   313  
   314  // IsClientError returns true when this add project metadatas forbidden response has a 4xx status code
   315  func (o *AddProjectMetadatasForbidden) IsClientError() bool {
   316  	return true
   317  }
   318  
   319  // IsServerError returns true when this add project metadatas forbidden response has a 5xx status code
   320  func (o *AddProjectMetadatasForbidden) IsServerError() bool {
   321  	return false
   322  }
   323  
   324  // IsCode returns true when this add project metadatas forbidden response a status code equal to that given
   325  func (o *AddProjectMetadatasForbidden) IsCode(code int) bool {
   326  	return code == 403
   327  }
   328  
   329  func (o *AddProjectMetadatasForbidden) Error() string {
   330  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasForbidden  %+v", 403, o.Payload)
   331  }
   332  
   333  func (o *AddProjectMetadatasForbidden) String() string {
   334  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasForbidden  %+v", 403, o.Payload)
   335  }
   336  
   337  func (o *AddProjectMetadatasForbidden) GetPayload() *models.Errors {
   338  	return o.Payload
   339  }
   340  
   341  func (o *AddProjectMetadatasForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   342  
   343  	// hydrates response header X-Request-Id
   344  	hdrXRequestID := response.GetHeader("X-Request-Id")
   345  
   346  	if hdrXRequestID != "" {
   347  		o.XRequestID = hdrXRequestID
   348  	}
   349  
   350  	o.Payload = new(models.Errors)
   351  
   352  	// response payload
   353  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   354  		return err
   355  	}
   356  
   357  	return nil
   358  }
   359  
   360  // NewAddProjectMetadatasNotFound creates a AddProjectMetadatasNotFound with default headers values
   361  func NewAddProjectMetadatasNotFound() *AddProjectMetadatasNotFound {
   362  	return &AddProjectMetadatasNotFound{}
   363  }
   364  
   365  /*
   366  AddProjectMetadatasNotFound describes a response with status code 404, with default header values.
   367  
   368  Not found
   369  */
   370  type AddProjectMetadatasNotFound struct {
   371  
   372  	/* The ID of the corresponding request for the response
   373  	 */
   374  	XRequestID string
   375  
   376  	Payload *models.Errors
   377  }
   378  
   379  // IsSuccess returns true when this add project metadatas not found response has a 2xx status code
   380  func (o *AddProjectMetadatasNotFound) IsSuccess() bool {
   381  	return false
   382  }
   383  
   384  // IsRedirect returns true when this add project metadatas not found response has a 3xx status code
   385  func (o *AddProjectMetadatasNotFound) IsRedirect() bool {
   386  	return false
   387  }
   388  
   389  // IsClientError returns true when this add project metadatas not found response has a 4xx status code
   390  func (o *AddProjectMetadatasNotFound) IsClientError() bool {
   391  	return true
   392  }
   393  
   394  // IsServerError returns true when this add project metadatas not found response has a 5xx status code
   395  func (o *AddProjectMetadatasNotFound) IsServerError() bool {
   396  	return false
   397  }
   398  
   399  // IsCode returns true when this add project metadatas not found response a status code equal to that given
   400  func (o *AddProjectMetadatasNotFound) IsCode(code int) bool {
   401  	return code == 404
   402  }
   403  
   404  func (o *AddProjectMetadatasNotFound) Error() string {
   405  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasNotFound  %+v", 404, o.Payload)
   406  }
   407  
   408  func (o *AddProjectMetadatasNotFound) String() string {
   409  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasNotFound  %+v", 404, o.Payload)
   410  }
   411  
   412  func (o *AddProjectMetadatasNotFound) GetPayload() *models.Errors {
   413  	return o.Payload
   414  }
   415  
   416  func (o *AddProjectMetadatasNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   417  
   418  	// hydrates response header X-Request-Id
   419  	hdrXRequestID := response.GetHeader("X-Request-Id")
   420  
   421  	if hdrXRequestID != "" {
   422  		o.XRequestID = hdrXRequestID
   423  	}
   424  
   425  	o.Payload = new(models.Errors)
   426  
   427  	// response payload
   428  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   429  		return err
   430  	}
   431  
   432  	return nil
   433  }
   434  
   435  // NewAddProjectMetadatasConflict creates a AddProjectMetadatasConflict with default headers values
   436  func NewAddProjectMetadatasConflict() *AddProjectMetadatasConflict {
   437  	return &AddProjectMetadatasConflict{}
   438  }
   439  
   440  /*
   441  AddProjectMetadatasConflict describes a response with status code 409, with default header values.
   442  
   443  Conflict
   444  */
   445  type AddProjectMetadatasConflict struct {
   446  
   447  	/* The ID of the corresponding request for the response
   448  	 */
   449  	XRequestID string
   450  
   451  	Payload *models.Errors
   452  }
   453  
   454  // IsSuccess returns true when this add project metadatas conflict response has a 2xx status code
   455  func (o *AddProjectMetadatasConflict) IsSuccess() bool {
   456  	return false
   457  }
   458  
   459  // IsRedirect returns true when this add project metadatas conflict response has a 3xx status code
   460  func (o *AddProjectMetadatasConflict) IsRedirect() bool {
   461  	return false
   462  }
   463  
   464  // IsClientError returns true when this add project metadatas conflict response has a 4xx status code
   465  func (o *AddProjectMetadatasConflict) IsClientError() bool {
   466  	return true
   467  }
   468  
   469  // IsServerError returns true when this add project metadatas conflict response has a 5xx status code
   470  func (o *AddProjectMetadatasConflict) IsServerError() bool {
   471  	return false
   472  }
   473  
   474  // IsCode returns true when this add project metadatas conflict response a status code equal to that given
   475  func (o *AddProjectMetadatasConflict) IsCode(code int) bool {
   476  	return code == 409
   477  }
   478  
   479  func (o *AddProjectMetadatasConflict) Error() string {
   480  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasConflict  %+v", 409, o.Payload)
   481  }
   482  
   483  func (o *AddProjectMetadatasConflict) String() string {
   484  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasConflict  %+v", 409, o.Payload)
   485  }
   486  
   487  func (o *AddProjectMetadatasConflict) GetPayload() *models.Errors {
   488  	return o.Payload
   489  }
   490  
   491  func (o *AddProjectMetadatasConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   492  
   493  	// hydrates response header X-Request-Id
   494  	hdrXRequestID := response.GetHeader("X-Request-Id")
   495  
   496  	if hdrXRequestID != "" {
   497  		o.XRequestID = hdrXRequestID
   498  	}
   499  
   500  	o.Payload = new(models.Errors)
   501  
   502  	// response payload
   503  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   504  		return err
   505  	}
   506  
   507  	return nil
   508  }
   509  
   510  // NewAddProjectMetadatasInternalServerError creates a AddProjectMetadatasInternalServerError with default headers values
   511  func NewAddProjectMetadatasInternalServerError() *AddProjectMetadatasInternalServerError {
   512  	return &AddProjectMetadatasInternalServerError{}
   513  }
   514  
   515  /*
   516  AddProjectMetadatasInternalServerError describes a response with status code 500, with default header values.
   517  
   518  Internal server error
   519  */
   520  type AddProjectMetadatasInternalServerError struct {
   521  
   522  	/* The ID of the corresponding request for the response
   523  	 */
   524  	XRequestID string
   525  
   526  	Payload *models.Errors
   527  }
   528  
   529  // IsSuccess returns true when this add project metadatas internal server error response has a 2xx status code
   530  func (o *AddProjectMetadatasInternalServerError) IsSuccess() bool {
   531  	return false
   532  }
   533  
   534  // IsRedirect returns true when this add project metadatas internal server error response has a 3xx status code
   535  func (o *AddProjectMetadatasInternalServerError) IsRedirect() bool {
   536  	return false
   537  }
   538  
   539  // IsClientError returns true when this add project metadatas internal server error response has a 4xx status code
   540  func (o *AddProjectMetadatasInternalServerError) IsClientError() bool {
   541  	return false
   542  }
   543  
   544  // IsServerError returns true when this add project metadatas internal server error response has a 5xx status code
   545  func (o *AddProjectMetadatasInternalServerError) IsServerError() bool {
   546  	return true
   547  }
   548  
   549  // IsCode returns true when this add project metadatas internal server error response a status code equal to that given
   550  func (o *AddProjectMetadatasInternalServerError) IsCode(code int) bool {
   551  	return code == 500
   552  }
   553  
   554  func (o *AddProjectMetadatasInternalServerError) Error() string {
   555  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasInternalServerError  %+v", 500, o.Payload)
   556  }
   557  
   558  func (o *AddProjectMetadatasInternalServerError) String() string {
   559  	return fmt.Sprintf("[POST /projects/{project_name_or_id}/metadatas/][%d] addProjectMetadatasInternalServerError  %+v", 500, o.Payload)
   560  }
   561  
   562  func (o *AddProjectMetadatasInternalServerError) GetPayload() *models.Errors {
   563  	return o.Payload
   564  }
   565  
   566  func (o *AddProjectMetadatasInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   567  
   568  	// hydrates response header X-Request-Id
   569  	hdrXRequestID := response.GetHeader("X-Request-Id")
   570  
   571  	if hdrXRequestID != "" {
   572  		o.XRequestID = hdrXRequestID
   573  	}
   574  
   575  	o.Payload = new(models.Errors)
   576  
   577  	// response payload
   578  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   579  		return err
   580  	}
   581  
   582  	return nil
   583  }