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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package preheat
     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  // ListProvidersReader is a Reader for the ListProviders structure.
    19  type ListProvidersReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *ListProvidersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewListProvidersOK()
    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 := NewListProvidersBadRequest()
    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 := NewListProvidersUnauthorized()
    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 := NewListProvidersForbidden()
    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 := NewListProvidersNotFound()
    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 := NewListProvidersInternalServerError()
    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  // NewListProvidersOK creates a ListProvidersOK with default headers values
    68  func NewListProvidersOK() *ListProvidersOK {
    69  	return &ListProvidersOK{}
    70  }
    71  
    72  /*
    73  ListProvidersOK describes a response with status code 200, with default header values.
    74  
    75  Success
    76  */
    77  type ListProvidersOK struct {
    78  	Payload []*models.Metadata
    79  }
    80  
    81  // IsSuccess returns true when this list providers o k response has a 2xx status code
    82  func (o *ListProvidersOK) IsSuccess() bool {
    83  	return true
    84  }
    85  
    86  // IsRedirect returns true when this list providers o k response has a 3xx status code
    87  func (o *ListProvidersOK) IsRedirect() bool {
    88  	return false
    89  }
    90  
    91  // IsClientError returns true when this list providers o k response has a 4xx status code
    92  func (o *ListProvidersOK) IsClientError() bool {
    93  	return false
    94  }
    95  
    96  // IsServerError returns true when this list providers o k response has a 5xx status code
    97  func (o *ListProvidersOK) IsServerError() bool {
    98  	return false
    99  }
   100  
   101  // IsCode returns true when this list providers o k response a status code equal to that given
   102  func (o *ListProvidersOK) IsCode(code int) bool {
   103  	return code == 200
   104  }
   105  
   106  func (o *ListProvidersOK) Error() string {
   107  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersOK  %+v", 200, o.Payload)
   108  }
   109  
   110  func (o *ListProvidersOK) String() string {
   111  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersOK  %+v", 200, o.Payload)
   112  }
   113  
   114  func (o *ListProvidersOK) GetPayload() []*models.Metadata {
   115  	return o.Payload
   116  }
   117  
   118  func (o *ListProvidersOK) 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  // NewListProvidersBadRequest creates a ListProvidersBadRequest with default headers values
   129  func NewListProvidersBadRequest() *ListProvidersBadRequest {
   130  	return &ListProvidersBadRequest{}
   131  }
   132  
   133  /*
   134  ListProvidersBadRequest describes a response with status code 400, with default header values.
   135  
   136  Bad request
   137  */
   138  type ListProvidersBadRequest 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 list providers bad request response has a 2xx status code
   148  func (o *ListProvidersBadRequest) IsSuccess() bool {
   149  	return false
   150  }
   151  
   152  // IsRedirect returns true when this list providers bad request response has a 3xx status code
   153  func (o *ListProvidersBadRequest) IsRedirect() bool {
   154  	return false
   155  }
   156  
   157  // IsClientError returns true when this list providers bad request response has a 4xx status code
   158  func (o *ListProvidersBadRequest) IsClientError() bool {
   159  	return true
   160  }
   161  
   162  // IsServerError returns true when this list providers bad request response has a 5xx status code
   163  func (o *ListProvidersBadRequest) IsServerError() bool {
   164  	return false
   165  }
   166  
   167  // IsCode returns true when this list providers bad request response a status code equal to that given
   168  func (o *ListProvidersBadRequest) IsCode(code int) bool {
   169  	return code == 400
   170  }
   171  
   172  func (o *ListProvidersBadRequest) Error() string {
   173  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersBadRequest  %+v", 400, o.Payload)
   174  }
   175  
   176  func (o *ListProvidersBadRequest) String() string {
   177  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersBadRequest  %+v", 400, o.Payload)
   178  }
   179  
   180  func (o *ListProvidersBadRequest) GetPayload() *models.Errors {
   181  	return o.Payload
   182  }
   183  
   184  func (o *ListProvidersBadRequest) 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  // NewListProvidersUnauthorized creates a ListProvidersUnauthorized with default headers values
   204  func NewListProvidersUnauthorized() *ListProvidersUnauthorized {
   205  	return &ListProvidersUnauthorized{}
   206  }
   207  
   208  /*
   209  ListProvidersUnauthorized describes a response with status code 401, with default header values.
   210  
   211  Unauthorized
   212  */
   213  type ListProvidersUnauthorized 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 list providers unauthorized response has a 2xx status code
   223  func (o *ListProvidersUnauthorized) IsSuccess() bool {
   224  	return false
   225  }
   226  
   227  // IsRedirect returns true when this list providers unauthorized response has a 3xx status code
   228  func (o *ListProvidersUnauthorized) IsRedirect() bool {
   229  	return false
   230  }
   231  
   232  // IsClientError returns true when this list providers unauthorized response has a 4xx status code
   233  func (o *ListProvidersUnauthorized) IsClientError() bool {
   234  	return true
   235  }
   236  
   237  // IsServerError returns true when this list providers unauthorized response has a 5xx status code
   238  func (o *ListProvidersUnauthorized) IsServerError() bool {
   239  	return false
   240  }
   241  
   242  // IsCode returns true when this list providers unauthorized response a status code equal to that given
   243  func (o *ListProvidersUnauthorized) IsCode(code int) bool {
   244  	return code == 401
   245  }
   246  
   247  func (o *ListProvidersUnauthorized) Error() string {
   248  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersUnauthorized  %+v", 401, o.Payload)
   249  }
   250  
   251  func (o *ListProvidersUnauthorized) String() string {
   252  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersUnauthorized  %+v", 401, o.Payload)
   253  }
   254  
   255  func (o *ListProvidersUnauthorized) GetPayload() *models.Errors {
   256  	return o.Payload
   257  }
   258  
   259  func (o *ListProvidersUnauthorized) 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  // NewListProvidersForbidden creates a ListProvidersForbidden with default headers values
   279  func NewListProvidersForbidden() *ListProvidersForbidden {
   280  	return &ListProvidersForbidden{}
   281  }
   282  
   283  /*
   284  ListProvidersForbidden describes a response with status code 403, with default header values.
   285  
   286  Forbidden
   287  */
   288  type ListProvidersForbidden 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 list providers forbidden response has a 2xx status code
   298  func (o *ListProvidersForbidden) IsSuccess() bool {
   299  	return false
   300  }
   301  
   302  // IsRedirect returns true when this list providers forbidden response has a 3xx status code
   303  func (o *ListProvidersForbidden) IsRedirect() bool {
   304  	return false
   305  }
   306  
   307  // IsClientError returns true when this list providers forbidden response has a 4xx status code
   308  func (o *ListProvidersForbidden) IsClientError() bool {
   309  	return true
   310  }
   311  
   312  // IsServerError returns true when this list providers forbidden response has a 5xx status code
   313  func (o *ListProvidersForbidden) IsServerError() bool {
   314  	return false
   315  }
   316  
   317  // IsCode returns true when this list providers forbidden response a status code equal to that given
   318  func (o *ListProvidersForbidden) IsCode(code int) bool {
   319  	return code == 403
   320  }
   321  
   322  func (o *ListProvidersForbidden) Error() string {
   323  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersForbidden  %+v", 403, o.Payload)
   324  }
   325  
   326  func (o *ListProvidersForbidden) String() string {
   327  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersForbidden  %+v", 403, o.Payload)
   328  }
   329  
   330  func (o *ListProvidersForbidden) GetPayload() *models.Errors {
   331  	return o.Payload
   332  }
   333  
   334  func (o *ListProvidersForbidden) 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  // NewListProvidersNotFound creates a ListProvidersNotFound with default headers values
   354  func NewListProvidersNotFound() *ListProvidersNotFound {
   355  	return &ListProvidersNotFound{}
   356  }
   357  
   358  /*
   359  ListProvidersNotFound describes a response with status code 404, with default header values.
   360  
   361  Not found
   362  */
   363  type ListProvidersNotFound 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 list providers not found response has a 2xx status code
   373  func (o *ListProvidersNotFound) IsSuccess() bool {
   374  	return false
   375  }
   376  
   377  // IsRedirect returns true when this list providers not found response has a 3xx status code
   378  func (o *ListProvidersNotFound) IsRedirect() bool {
   379  	return false
   380  }
   381  
   382  // IsClientError returns true when this list providers not found response has a 4xx status code
   383  func (o *ListProvidersNotFound) IsClientError() bool {
   384  	return true
   385  }
   386  
   387  // IsServerError returns true when this list providers not found response has a 5xx status code
   388  func (o *ListProvidersNotFound) IsServerError() bool {
   389  	return false
   390  }
   391  
   392  // IsCode returns true when this list providers not found response a status code equal to that given
   393  func (o *ListProvidersNotFound) IsCode(code int) bool {
   394  	return code == 404
   395  }
   396  
   397  func (o *ListProvidersNotFound) Error() string {
   398  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersNotFound  %+v", 404, o.Payload)
   399  }
   400  
   401  func (o *ListProvidersNotFound) String() string {
   402  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersNotFound  %+v", 404, o.Payload)
   403  }
   404  
   405  func (o *ListProvidersNotFound) GetPayload() *models.Errors {
   406  	return o.Payload
   407  }
   408  
   409  func (o *ListProvidersNotFound) 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  // NewListProvidersInternalServerError creates a ListProvidersInternalServerError with default headers values
   429  func NewListProvidersInternalServerError() *ListProvidersInternalServerError {
   430  	return &ListProvidersInternalServerError{}
   431  }
   432  
   433  /*
   434  ListProvidersInternalServerError describes a response with status code 500, with default header values.
   435  
   436  Internal server error
   437  */
   438  type ListProvidersInternalServerError 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 list providers internal server error response has a 2xx status code
   448  func (o *ListProvidersInternalServerError) IsSuccess() bool {
   449  	return false
   450  }
   451  
   452  // IsRedirect returns true when this list providers internal server error response has a 3xx status code
   453  func (o *ListProvidersInternalServerError) IsRedirect() bool {
   454  	return false
   455  }
   456  
   457  // IsClientError returns true when this list providers internal server error response has a 4xx status code
   458  func (o *ListProvidersInternalServerError) IsClientError() bool {
   459  	return false
   460  }
   461  
   462  // IsServerError returns true when this list providers internal server error response has a 5xx status code
   463  func (o *ListProvidersInternalServerError) IsServerError() bool {
   464  	return true
   465  }
   466  
   467  // IsCode returns true when this list providers internal server error response a status code equal to that given
   468  func (o *ListProvidersInternalServerError) IsCode(code int) bool {
   469  	return code == 500
   470  }
   471  
   472  func (o *ListProvidersInternalServerError) Error() string {
   473  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersInternalServerError  %+v", 500, o.Payload)
   474  }
   475  
   476  func (o *ListProvidersInternalServerError) String() string {
   477  	return fmt.Sprintf("[GET /p2p/preheat/providers][%d] listProvidersInternalServerError  %+v", 500, o.Payload)
   478  }
   479  
   480  func (o *ListProvidersInternalServerError) GetPayload() *models.Errors {
   481  	return o.Payload
   482  }
   483  
   484  func (o *ListProvidersInternalServerError) 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  }