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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package icon
     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  // GetIconReader is a Reader for the GetIcon structure.
    19  type GetIconReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *GetIconReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewGetIconOK()
    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 := NewGetIconBadRequest()
    34  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    35  			return nil, err
    36  		}
    37  		return nil, result
    38  	case 404:
    39  		result := NewGetIconNotFound()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return nil, result
    44  	case 500:
    45  		result := NewGetIconInternalServerError()
    46  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    47  			return nil, err
    48  		}
    49  		return nil, result
    50  	default:
    51  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    52  	}
    53  }
    54  
    55  // NewGetIconOK creates a GetIconOK with default headers values
    56  func NewGetIconOK() *GetIconOK {
    57  	return &GetIconOK{}
    58  }
    59  
    60  /*
    61  GetIconOK describes a response with status code 200, with default header values.
    62  
    63  Success
    64  */
    65  type GetIconOK struct {
    66  	Payload *models.Icon
    67  }
    68  
    69  // IsSuccess returns true when this get icon o k response has a 2xx status code
    70  func (o *GetIconOK) IsSuccess() bool {
    71  	return true
    72  }
    73  
    74  // IsRedirect returns true when this get icon o k response has a 3xx status code
    75  func (o *GetIconOK) IsRedirect() bool {
    76  	return false
    77  }
    78  
    79  // IsClientError returns true when this get icon o k response has a 4xx status code
    80  func (o *GetIconOK) IsClientError() bool {
    81  	return false
    82  }
    83  
    84  // IsServerError returns true when this get icon o k response has a 5xx status code
    85  func (o *GetIconOK) IsServerError() bool {
    86  	return false
    87  }
    88  
    89  // IsCode returns true when this get icon o k response a status code equal to that given
    90  func (o *GetIconOK) IsCode(code int) bool {
    91  	return code == 200
    92  }
    93  
    94  func (o *GetIconOK) Error() string {
    95  	return fmt.Sprintf("[GET /icons/{digest}][%d] getIconOK  %+v", 200, o.Payload)
    96  }
    97  
    98  func (o *GetIconOK) String() string {
    99  	return fmt.Sprintf("[GET /icons/{digest}][%d] getIconOK  %+v", 200, o.Payload)
   100  }
   101  
   102  func (o *GetIconOK) GetPayload() *models.Icon {
   103  	return o.Payload
   104  }
   105  
   106  func (o *GetIconOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   107  
   108  	o.Payload = new(models.Icon)
   109  
   110  	// response payload
   111  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   112  		return err
   113  	}
   114  
   115  	return nil
   116  }
   117  
   118  // NewGetIconBadRequest creates a GetIconBadRequest with default headers values
   119  func NewGetIconBadRequest() *GetIconBadRequest {
   120  	return &GetIconBadRequest{}
   121  }
   122  
   123  /*
   124  GetIconBadRequest describes a response with status code 400, with default header values.
   125  
   126  Bad request
   127  */
   128  type GetIconBadRequest struct {
   129  
   130  	/* The ID of the corresponding request for the response
   131  	 */
   132  	XRequestID string
   133  
   134  	Payload *models.Errors
   135  }
   136  
   137  // IsSuccess returns true when this get icon bad request response has a 2xx status code
   138  func (o *GetIconBadRequest) IsSuccess() bool {
   139  	return false
   140  }
   141  
   142  // IsRedirect returns true when this get icon bad request response has a 3xx status code
   143  func (o *GetIconBadRequest) IsRedirect() bool {
   144  	return false
   145  }
   146  
   147  // IsClientError returns true when this get icon bad request response has a 4xx status code
   148  func (o *GetIconBadRequest) IsClientError() bool {
   149  	return true
   150  }
   151  
   152  // IsServerError returns true when this get icon bad request response has a 5xx status code
   153  func (o *GetIconBadRequest) IsServerError() bool {
   154  	return false
   155  }
   156  
   157  // IsCode returns true when this get icon bad request response a status code equal to that given
   158  func (o *GetIconBadRequest) IsCode(code int) bool {
   159  	return code == 400
   160  }
   161  
   162  func (o *GetIconBadRequest) Error() string {
   163  	return fmt.Sprintf("[GET /icons/{digest}][%d] getIconBadRequest  %+v", 400, o.Payload)
   164  }
   165  
   166  func (o *GetIconBadRequest) String() string {
   167  	return fmt.Sprintf("[GET /icons/{digest}][%d] getIconBadRequest  %+v", 400, o.Payload)
   168  }
   169  
   170  func (o *GetIconBadRequest) GetPayload() *models.Errors {
   171  	return o.Payload
   172  }
   173  
   174  func (o *GetIconBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   175  
   176  	// hydrates response header X-Request-Id
   177  	hdrXRequestID := response.GetHeader("X-Request-Id")
   178  
   179  	if hdrXRequestID != "" {
   180  		o.XRequestID = hdrXRequestID
   181  	}
   182  
   183  	o.Payload = new(models.Errors)
   184  
   185  	// response payload
   186  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   187  		return err
   188  	}
   189  
   190  	return nil
   191  }
   192  
   193  // NewGetIconNotFound creates a GetIconNotFound with default headers values
   194  func NewGetIconNotFound() *GetIconNotFound {
   195  	return &GetIconNotFound{}
   196  }
   197  
   198  /*
   199  GetIconNotFound describes a response with status code 404, with default header values.
   200  
   201  Not found
   202  */
   203  type GetIconNotFound struct {
   204  
   205  	/* The ID of the corresponding request for the response
   206  	 */
   207  	XRequestID string
   208  
   209  	Payload *models.Errors
   210  }
   211  
   212  // IsSuccess returns true when this get icon not found response has a 2xx status code
   213  func (o *GetIconNotFound) IsSuccess() bool {
   214  	return false
   215  }
   216  
   217  // IsRedirect returns true when this get icon not found response has a 3xx status code
   218  func (o *GetIconNotFound) IsRedirect() bool {
   219  	return false
   220  }
   221  
   222  // IsClientError returns true when this get icon not found response has a 4xx status code
   223  func (o *GetIconNotFound) IsClientError() bool {
   224  	return true
   225  }
   226  
   227  // IsServerError returns true when this get icon not found response has a 5xx status code
   228  func (o *GetIconNotFound) IsServerError() bool {
   229  	return false
   230  }
   231  
   232  // IsCode returns true when this get icon not found response a status code equal to that given
   233  func (o *GetIconNotFound) IsCode(code int) bool {
   234  	return code == 404
   235  }
   236  
   237  func (o *GetIconNotFound) Error() string {
   238  	return fmt.Sprintf("[GET /icons/{digest}][%d] getIconNotFound  %+v", 404, o.Payload)
   239  }
   240  
   241  func (o *GetIconNotFound) String() string {
   242  	return fmt.Sprintf("[GET /icons/{digest}][%d] getIconNotFound  %+v", 404, o.Payload)
   243  }
   244  
   245  func (o *GetIconNotFound) GetPayload() *models.Errors {
   246  	return o.Payload
   247  }
   248  
   249  func (o *GetIconNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   250  
   251  	// hydrates response header X-Request-Id
   252  	hdrXRequestID := response.GetHeader("X-Request-Id")
   253  
   254  	if hdrXRequestID != "" {
   255  		o.XRequestID = hdrXRequestID
   256  	}
   257  
   258  	o.Payload = new(models.Errors)
   259  
   260  	// response payload
   261  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   262  		return err
   263  	}
   264  
   265  	return nil
   266  }
   267  
   268  // NewGetIconInternalServerError creates a GetIconInternalServerError with default headers values
   269  func NewGetIconInternalServerError() *GetIconInternalServerError {
   270  	return &GetIconInternalServerError{}
   271  }
   272  
   273  /*
   274  GetIconInternalServerError describes a response with status code 500, with default header values.
   275  
   276  Internal server error
   277  */
   278  type GetIconInternalServerError struct {
   279  
   280  	/* The ID of the corresponding request for the response
   281  	 */
   282  	XRequestID string
   283  
   284  	Payload *models.Errors
   285  }
   286  
   287  // IsSuccess returns true when this get icon internal server error response has a 2xx status code
   288  func (o *GetIconInternalServerError) IsSuccess() bool {
   289  	return false
   290  }
   291  
   292  // IsRedirect returns true when this get icon internal server error response has a 3xx status code
   293  func (o *GetIconInternalServerError) IsRedirect() bool {
   294  	return false
   295  }
   296  
   297  // IsClientError returns true when this get icon internal server error response has a 4xx status code
   298  func (o *GetIconInternalServerError) IsClientError() bool {
   299  	return false
   300  }
   301  
   302  // IsServerError returns true when this get icon internal server error response has a 5xx status code
   303  func (o *GetIconInternalServerError) IsServerError() bool {
   304  	return true
   305  }
   306  
   307  // IsCode returns true when this get icon internal server error response a status code equal to that given
   308  func (o *GetIconInternalServerError) IsCode(code int) bool {
   309  	return code == 500
   310  }
   311  
   312  func (o *GetIconInternalServerError) Error() string {
   313  	return fmt.Sprintf("[GET /icons/{digest}][%d] getIconInternalServerError  %+v", 500, o.Payload)
   314  }
   315  
   316  func (o *GetIconInternalServerError) String() string {
   317  	return fmt.Sprintf("[GET /icons/{digest}][%d] getIconInternalServerError  %+v", 500, o.Payload)
   318  }
   319  
   320  func (o *GetIconInternalServerError) GetPayload() *models.Errors {
   321  	return o.Payload
   322  }
   323  
   324  func (o *GetIconInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   325  
   326  	// hydrates response header X-Request-Id
   327  	hdrXRequestID := response.GetHeader("X-Request-Id")
   328  
   329  	if hdrXRequestID != "" {
   330  		o.XRequestID = hdrXRequestID
   331  	}
   332  
   333  	o.Payload = new(models.Errors)
   334  
   335  	// response payload
   336  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   337  		return err
   338  	}
   339  
   340  	return nil
   341  }