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