github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/registry/get_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  // GetRegistryReader is a Reader for the GetRegistry structure.
    19  type GetRegistryReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *GetRegistryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewGetRegistryOK()
    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 := NewGetRegistryUnauthorized()
    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 := NewGetRegistryForbidden()
    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 := NewGetRegistryNotFound()
    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 := NewGetRegistryInternalServerError()
    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  // NewGetRegistryOK creates a GetRegistryOK with default headers values
    62  func NewGetRegistryOK() *GetRegistryOK {
    63  	return &GetRegistryOK{}
    64  }
    65  
    66  /*
    67  GetRegistryOK describes a response with status code 200, with default header values.
    68  
    69  Success
    70  */
    71  type GetRegistryOK struct {
    72  	Payload *models.Registry
    73  }
    74  
    75  // IsSuccess returns true when this get registry o k response has a 2xx status code
    76  func (o *GetRegistryOK) IsSuccess() bool {
    77  	return true
    78  }
    79  
    80  // IsRedirect returns true when this get registry o k response has a 3xx status code
    81  func (o *GetRegistryOK) IsRedirect() bool {
    82  	return false
    83  }
    84  
    85  // IsClientError returns true when this get registry o k response has a 4xx status code
    86  func (o *GetRegistryOK) IsClientError() bool {
    87  	return false
    88  }
    89  
    90  // IsServerError returns true when this get registry o k response has a 5xx status code
    91  func (o *GetRegistryOK) IsServerError() bool {
    92  	return false
    93  }
    94  
    95  // IsCode returns true when this get registry o k response a status code equal to that given
    96  func (o *GetRegistryOK) IsCode(code int) bool {
    97  	return code == 200
    98  }
    99  
   100  func (o *GetRegistryOK) Error() string {
   101  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryOK  %+v", 200, o.Payload)
   102  }
   103  
   104  func (o *GetRegistryOK) String() string {
   105  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryOK  %+v", 200, o.Payload)
   106  }
   107  
   108  func (o *GetRegistryOK) GetPayload() *models.Registry {
   109  	return o.Payload
   110  }
   111  
   112  func (o *GetRegistryOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   113  
   114  	o.Payload = new(models.Registry)
   115  
   116  	// response payload
   117  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   118  		return err
   119  	}
   120  
   121  	return nil
   122  }
   123  
   124  // NewGetRegistryUnauthorized creates a GetRegistryUnauthorized with default headers values
   125  func NewGetRegistryUnauthorized() *GetRegistryUnauthorized {
   126  	return &GetRegistryUnauthorized{}
   127  }
   128  
   129  /*
   130  GetRegistryUnauthorized describes a response with status code 401, with default header values.
   131  
   132  Unauthorized
   133  */
   134  type GetRegistryUnauthorized struct {
   135  
   136  	/* The ID of the corresponding request for the response
   137  	 */
   138  	XRequestID string
   139  
   140  	Payload *models.Errors
   141  }
   142  
   143  // IsSuccess returns true when this get registry unauthorized response has a 2xx status code
   144  func (o *GetRegistryUnauthorized) IsSuccess() bool {
   145  	return false
   146  }
   147  
   148  // IsRedirect returns true when this get registry unauthorized response has a 3xx status code
   149  func (o *GetRegistryUnauthorized) IsRedirect() bool {
   150  	return false
   151  }
   152  
   153  // IsClientError returns true when this get registry unauthorized response has a 4xx status code
   154  func (o *GetRegistryUnauthorized) IsClientError() bool {
   155  	return true
   156  }
   157  
   158  // IsServerError returns true when this get registry unauthorized response has a 5xx status code
   159  func (o *GetRegistryUnauthorized) IsServerError() bool {
   160  	return false
   161  }
   162  
   163  // IsCode returns true when this get registry unauthorized response a status code equal to that given
   164  func (o *GetRegistryUnauthorized) IsCode(code int) bool {
   165  	return code == 401
   166  }
   167  
   168  func (o *GetRegistryUnauthorized) Error() string {
   169  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryUnauthorized  %+v", 401, o.Payload)
   170  }
   171  
   172  func (o *GetRegistryUnauthorized) String() string {
   173  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryUnauthorized  %+v", 401, o.Payload)
   174  }
   175  
   176  func (o *GetRegistryUnauthorized) GetPayload() *models.Errors {
   177  	return o.Payload
   178  }
   179  
   180  func (o *GetRegistryUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   181  
   182  	// hydrates response header X-Request-Id
   183  	hdrXRequestID := response.GetHeader("X-Request-Id")
   184  
   185  	if hdrXRequestID != "" {
   186  		o.XRequestID = hdrXRequestID
   187  	}
   188  
   189  	o.Payload = new(models.Errors)
   190  
   191  	// response payload
   192  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   193  		return err
   194  	}
   195  
   196  	return nil
   197  }
   198  
   199  // NewGetRegistryForbidden creates a GetRegistryForbidden with default headers values
   200  func NewGetRegistryForbidden() *GetRegistryForbidden {
   201  	return &GetRegistryForbidden{}
   202  }
   203  
   204  /*
   205  GetRegistryForbidden describes a response with status code 403, with default header values.
   206  
   207  Forbidden
   208  */
   209  type GetRegistryForbidden struct {
   210  
   211  	/* The ID of the corresponding request for the response
   212  	 */
   213  	XRequestID string
   214  
   215  	Payload *models.Errors
   216  }
   217  
   218  // IsSuccess returns true when this get registry forbidden response has a 2xx status code
   219  func (o *GetRegistryForbidden) IsSuccess() bool {
   220  	return false
   221  }
   222  
   223  // IsRedirect returns true when this get registry forbidden response has a 3xx status code
   224  func (o *GetRegistryForbidden) IsRedirect() bool {
   225  	return false
   226  }
   227  
   228  // IsClientError returns true when this get registry forbidden response has a 4xx status code
   229  func (o *GetRegistryForbidden) IsClientError() bool {
   230  	return true
   231  }
   232  
   233  // IsServerError returns true when this get registry forbidden response has a 5xx status code
   234  func (o *GetRegistryForbidden) IsServerError() bool {
   235  	return false
   236  }
   237  
   238  // IsCode returns true when this get registry forbidden response a status code equal to that given
   239  func (o *GetRegistryForbidden) IsCode(code int) bool {
   240  	return code == 403
   241  }
   242  
   243  func (o *GetRegistryForbidden) Error() string {
   244  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryForbidden  %+v", 403, o.Payload)
   245  }
   246  
   247  func (o *GetRegistryForbidden) String() string {
   248  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryForbidden  %+v", 403, o.Payload)
   249  }
   250  
   251  func (o *GetRegistryForbidden) GetPayload() *models.Errors {
   252  	return o.Payload
   253  }
   254  
   255  func (o *GetRegistryForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   256  
   257  	// hydrates response header X-Request-Id
   258  	hdrXRequestID := response.GetHeader("X-Request-Id")
   259  
   260  	if hdrXRequestID != "" {
   261  		o.XRequestID = hdrXRequestID
   262  	}
   263  
   264  	o.Payload = new(models.Errors)
   265  
   266  	// response payload
   267  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   268  		return err
   269  	}
   270  
   271  	return nil
   272  }
   273  
   274  // NewGetRegistryNotFound creates a GetRegistryNotFound with default headers values
   275  func NewGetRegistryNotFound() *GetRegistryNotFound {
   276  	return &GetRegistryNotFound{}
   277  }
   278  
   279  /*
   280  GetRegistryNotFound describes a response with status code 404, with default header values.
   281  
   282  Not found
   283  */
   284  type GetRegistryNotFound struct {
   285  
   286  	/* The ID of the corresponding request for the response
   287  	 */
   288  	XRequestID string
   289  
   290  	Payload *models.Errors
   291  }
   292  
   293  // IsSuccess returns true when this get registry not found response has a 2xx status code
   294  func (o *GetRegistryNotFound) IsSuccess() bool {
   295  	return false
   296  }
   297  
   298  // IsRedirect returns true when this get registry not found response has a 3xx status code
   299  func (o *GetRegistryNotFound) IsRedirect() bool {
   300  	return false
   301  }
   302  
   303  // IsClientError returns true when this get registry not found response has a 4xx status code
   304  func (o *GetRegistryNotFound) IsClientError() bool {
   305  	return true
   306  }
   307  
   308  // IsServerError returns true when this get registry not found response has a 5xx status code
   309  func (o *GetRegistryNotFound) IsServerError() bool {
   310  	return false
   311  }
   312  
   313  // IsCode returns true when this get registry not found response a status code equal to that given
   314  func (o *GetRegistryNotFound) IsCode(code int) bool {
   315  	return code == 404
   316  }
   317  
   318  func (o *GetRegistryNotFound) Error() string {
   319  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryNotFound  %+v", 404, o.Payload)
   320  }
   321  
   322  func (o *GetRegistryNotFound) String() string {
   323  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryNotFound  %+v", 404, o.Payload)
   324  }
   325  
   326  func (o *GetRegistryNotFound) GetPayload() *models.Errors {
   327  	return o.Payload
   328  }
   329  
   330  func (o *GetRegistryNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   331  
   332  	// hydrates response header X-Request-Id
   333  	hdrXRequestID := response.GetHeader("X-Request-Id")
   334  
   335  	if hdrXRequestID != "" {
   336  		o.XRequestID = hdrXRequestID
   337  	}
   338  
   339  	o.Payload = new(models.Errors)
   340  
   341  	// response payload
   342  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   343  		return err
   344  	}
   345  
   346  	return nil
   347  }
   348  
   349  // NewGetRegistryInternalServerError creates a GetRegistryInternalServerError with default headers values
   350  func NewGetRegistryInternalServerError() *GetRegistryInternalServerError {
   351  	return &GetRegistryInternalServerError{}
   352  }
   353  
   354  /*
   355  GetRegistryInternalServerError describes a response with status code 500, with default header values.
   356  
   357  Internal server error
   358  */
   359  type GetRegistryInternalServerError struct {
   360  
   361  	/* The ID of the corresponding request for the response
   362  	 */
   363  	XRequestID string
   364  
   365  	Payload *models.Errors
   366  }
   367  
   368  // IsSuccess returns true when this get registry internal server error response has a 2xx status code
   369  func (o *GetRegistryInternalServerError) IsSuccess() bool {
   370  	return false
   371  }
   372  
   373  // IsRedirect returns true when this get registry internal server error response has a 3xx status code
   374  func (o *GetRegistryInternalServerError) IsRedirect() bool {
   375  	return false
   376  }
   377  
   378  // IsClientError returns true when this get registry internal server error response has a 4xx status code
   379  func (o *GetRegistryInternalServerError) IsClientError() bool {
   380  	return false
   381  }
   382  
   383  // IsServerError returns true when this get registry internal server error response has a 5xx status code
   384  func (o *GetRegistryInternalServerError) IsServerError() bool {
   385  	return true
   386  }
   387  
   388  // IsCode returns true when this get registry internal server error response a status code equal to that given
   389  func (o *GetRegistryInternalServerError) IsCode(code int) bool {
   390  	return code == 500
   391  }
   392  
   393  func (o *GetRegistryInternalServerError) Error() string {
   394  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryInternalServerError  %+v", 500, o.Payload)
   395  }
   396  
   397  func (o *GetRegistryInternalServerError) String() string {
   398  	return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryInternalServerError  %+v", 500, o.Payload)
   399  }
   400  
   401  func (o *GetRegistryInternalServerError) GetPayload() *models.Errors {
   402  	return o.Payload
   403  }
   404  
   405  func (o *GetRegistryInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   406  
   407  	// hydrates response header X-Request-Id
   408  	hdrXRequestID := response.GetHeader("X-Request-Id")
   409  
   410  	if hdrXRequestID != "" {
   411  		o.XRequestID = hdrXRequestID
   412  	}
   413  
   414  	o.Payload = new(models.Errors)
   415  
   416  	// response payload
   417  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   418  		return err
   419  	}
   420  
   421  	return nil
   422  }