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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package systeminfo
     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  // GetCertReader is a Reader for the GetCert structure.
    19  type GetCertReader struct {
    20  	formats strfmt.Registry
    21  	writer  io.Writer
    22  }
    23  
    24  // ReadResponse reads a server response into the received o.
    25  func (o *GetCertReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    26  	switch response.Code() {
    27  	case 200:
    28  		result := NewGetCertOK(o.writer)
    29  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    30  			return nil, err
    31  		}
    32  		return result, nil
    33  	case 404:
    34  		result := NewGetCertNotFound()
    35  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    36  			return nil, err
    37  		}
    38  		return nil, result
    39  	case 500:
    40  		result := NewGetCertInternalServerError()
    41  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    42  			return nil, err
    43  		}
    44  		return nil, result
    45  	default:
    46  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    47  	}
    48  }
    49  
    50  // NewGetCertOK creates a GetCertOK with default headers values
    51  func NewGetCertOK(writer io.Writer) *GetCertOK {
    52  	return &GetCertOK{
    53  
    54  		Payload: writer,
    55  	}
    56  }
    57  
    58  /*
    59  GetCertOK describes a response with status code 200, with default header values.
    60  
    61  Get default root certificate successfully.
    62  */
    63  type GetCertOK struct {
    64  
    65  	/* To set the filename of the downloaded file.
    66  	 */
    67  	ContentDisposition string
    68  
    69  	Payload io.Writer
    70  }
    71  
    72  // IsSuccess returns true when this get cert o k response has a 2xx status code
    73  func (o *GetCertOK) IsSuccess() bool {
    74  	return true
    75  }
    76  
    77  // IsRedirect returns true when this get cert o k response has a 3xx status code
    78  func (o *GetCertOK) IsRedirect() bool {
    79  	return false
    80  }
    81  
    82  // IsClientError returns true when this get cert o k response has a 4xx status code
    83  func (o *GetCertOK) IsClientError() bool {
    84  	return false
    85  }
    86  
    87  // IsServerError returns true when this get cert o k response has a 5xx status code
    88  func (o *GetCertOK) IsServerError() bool {
    89  	return false
    90  }
    91  
    92  // IsCode returns true when this get cert o k response a status code equal to that given
    93  func (o *GetCertOK) IsCode(code int) bool {
    94  	return code == 200
    95  }
    96  
    97  func (o *GetCertOK) Error() string {
    98  	return fmt.Sprintf("[GET /systeminfo/getcert][%d] getCertOK  %+v", 200, o.Payload)
    99  }
   100  
   101  func (o *GetCertOK) String() string {
   102  	return fmt.Sprintf("[GET /systeminfo/getcert][%d] getCertOK  %+v", 200, o.Payload)
   103  }
   104  
   105  func (o *GetCertOK) GetPayload() io.Writer {
   106  	return o.Payload
   107  }
   108  
   109  func (o *GetCertOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   110  
   111  	// hydrates response header Content-Disposition
   112  	hdrContentDisposition := response.GetHeader("Content-Disposition")
   113  
   114  	if hdrContentDisposition != "" {
   115  		o.ContentDisposition = hdrContentDisposition
   116  	}
   117  
   118  	// response payload
   119  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   120  		return err
   121  	}
   122  
   123  	return nil
   124  }
   125  
   126  // NewGetCertNotFound creates a GetCertNotFound with default headers values
   127  func NewGetCertNotFound() *GetCertNotFound {
   128  	return &GetCertNotFound{}
   129  }
   130  
   131  /*
   132  GetCertNotFound describes a response with status code 404, with default header values.
   133  
   134  Not found the default root certificate.
   135  */
   136  type GetCertNotFound struct {
   137  }
   138  
   139  // IsSuccess returns true when this get cert not found response has a 2xx status code
   140  func (o *GetCertNotFound) IsSuccess() bool {
   141  	return false
   142  }
   143  
   144  // IsRedirect returns true when this get cert not found response has a 3xx status code
   145  func (o *GetCertNotFound) IsRedirect() bool {
   146  	return false
   147  }
   148  
   149  // IsClientError returns true when this get cert not found response has a 4xx status code
   150  func (o *GetCertNotFound) IsClientError() bool {
   151  	return true
   152  }
   153  
   154  // IsServerError returns true when this get cert not found response has a 5xx status code
   155  func (o *GetCertNotFound) IsServerError() bool {
   156  	return false
   157  }
   158  
   159  // IsCode returns true when this get cert not found response a status code equal to that given
   160  func (o *GetCertNotFound) IsCode(code int) bool {
   161  	return code == 404
   162  }
   163  
   164  func (o *GetCertNotFound) Error() string {
   165  	return fmt.Sprintf("[GET /systeminfo/getcert][%d] getCertNotFound ", 404)
   166  }
   167  
   168  func (o *GetCertNotFound) String() string {
   169  	return fmt.Sprintf("[GET /systeminfo/getcert][%d] getCertNotFound ", 404)
   170  }
   171  
   172  func (o *GetCertNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   173  
   174  	return nil
   175  }
   176  
   177  // NewGetCertInternalServerError creates a GetCertInternalServerError with default headers values
   178  func NewGetCertInternalServerError() *GetCertInternalServerError {
   179  	return &GetCertInternalServerError{}
   180  }
   181  
   182  /*
   183  GetCertInternalServerError describes a response with status code 500, with default header values.
   184  
   185  Internal server error
   186  */
   187  type GetCertInternalServerError struct {
   188  
   189  	/* The ID of the corresponding request for the response
   190  	 */
   191  	XRequestID string
   192  
   193  	Payload *models.Errors
   194  }
   195  
   196  // IsSuccess returns true when this get cert internal server error response has a 2xx status code
   197  func (o *GetCertInternalServerError) IsSuccess() bool {
   198  	return false
   199  }
   200  
   201  // IsRedirect returns true when this get cert internal server error response has a 3xx status code
   202  func (o *GetCertInternalServerError) IsRedirect() bool {
   203  	return false
   204  }
   205  
   206  // IsClientError returns true when this get cert internal server error response has a 4xx status code
   207  func (o *GetCertInternalServerError) IsClientError() bool {
   208  	return false
   209  }
   210  
   211  // IsServerError returns true when this get cert internal server error response has a 5xx status code
   212  func (o *GetCertInternalServerError) IsServerError() bool {
   213  	return true
   214  }
   215  
   216  // IsCode returns true when this get cert internal server error response a status code equal to that given
   217  func (o *GetCertInternalServerError) IsCode(code int) bool {
   218  	return code == 500
   219  }
   220  
   221  func (o *GetCertInternalServerError) Error() string {
   222  	return fmt.Sprintf("[GET /systeminfo/getcert][%d] getCertInternalServerError  %+v", 500, o.Payload)
   223  }
   224  
   225  func (o *GetCertInternalServerError) String() string {
   226  	return fmt.Sprintf("[GET /systeminfo/getcert][%d] getCertInternalServerError  %+v", 500, o.Payload)
   227  }
   228  
   229  func (o *GetCertInternalServerError) GetPayload() *models.Errors {
   230  	return o.Payload
   231  }
   232  
   233  func (o *GetCertInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   234  
   235  	// hydrates response header X-Request-Id
   236  	hdrXRequestID := response.GetHeader("X-Request-Id")
   237  
   238  	if hdrXRequestID != "" {
   239  		o.XRequestID = hdrXRequestID
   240  	}
   241  
   242  	o.Payload = new(models.Errors)
   243  
   244  	// response payload
   245  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   246  		return err
   247  	}
   248  
   249  	return nil
   250  }