github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/systeminfo/get_system_info_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  // GetSystemInfoReader is a Reader for the GetSystemInfo structure.
    19  type GetSystemInfoReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *GetSystemInfoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewGetSystemInfoOK()
    28  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    29  			return nil, err
    30  		}
    31  		return result, nil
    32  	case 500:
    33  		result := NewGetSystemInfoInternalServerError()
    34  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    35  			return nil, err
    36  		}
    37  		return nil, result
    38  	default:
    39  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    40  	}
    41  }
    42  
    43  // NewGetSystemInfoOK creates a GetSystemInfoOK with default headers values
    44  func NewGetSystemInfoOK() *GetSystemInfoOK {
    45  	return &GetSystemInfoOK{}
    46  }
    47  
    48  /*
    49  GetSystemInfoOK describes a response with status code 200, with default header values.
    50  
    51  Get general info successfully.
    52  */
    53  type GetSystemInfoOK struct {
    54  	Payload *models.GeneralInfo
    55  }
    56  
    57  // IsSuccess returns true when this get system info o k response has a 2xx status code
    58  func (o *GetSystemInfoOK) IsSuccess() bool {
    59  	return true
    60  }
    61  
    62  // IsRedirect returns true when this get system info o k response has a 3xx status code
    63  func (o *GetSystemInfoOK) IsRedirect() bool {
    64  	return false
    65  }
    66  
    67  // IsClientError returns true when this get system info o k response has a 4xx status code
    68  func (o *GetSystemInfoOK) IsClientError() bool {
    69  	return false
    70  }
    71  
    72  // IsServerError returns true when this get system info o k response has a 5xx status code
    73  func (o *GetSystemInfoOK) IsServerError() bool {
    74  	return false
    75  }
    76  
    77  // IsCode returns true when this get system info o k response a status code equal to that given
    78  func (o *GetSystemInfoOK) IsCode(code int) bool {
    79  	return code == 200
    80  }
    81  
    82  func (o *GetSystemInfoOK) Error() string {
    83  	return fmt.Sprintf("[GET /systeminfo][%d] getSystemInfoOK  %+v", 200, o.Payload)
    84  }
    85  
    86  func (o *GetSystemInfoOK) String() string {
    87  	return fmt.Sprintf("[GET /systeminfo][%d] getSystemInfoOK  %+v", 200, o.Payload)
    88  }
    89  
    90  func (o *GetSystemInfoOK) GetPayload() *models.GeneralInfo {
    91  	return o.Payload
    92  }
    93  
    94  func (o *GetSystemInfoOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    95  
    96  	o.Payload = new(models.GeneralInfo)
    97  
    98  	// response payload
    99  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   100  		return err
   101  	}
   102  
   103  	return nil
   104  }
   105  
   106  // NewGetSystemInfoInternalServerError creates a GetSystemInfoInternalServerError with default headers values
   107  func NewGetSystemInfoInternalServerError() *GetSystemInfoInternalServerError {
   108  	return &GetSystemInfoInternalServerError{}
   109  }
   110  
   111  /*
   112  GetSystemInfoInternalServerError describes a response with status code 500, with default header values.
   113  
   114  Internal server error
   115  */
   116  type GetSystemInfoInternalServerError struct {
   117  
   118  	/* The ID of the corresponding request for the response
   119  	 */
   120  	XRequestID string
   121  
   122  	Payload *models.Errors
   123  }
   124  
   125  // IsSuccess returns true when this get system info internal server error response has a 2xx status code
   126  func (o *GetSystemInfoInternalServerError) IsSuccess() bool {
   127  	return false
   128  }
   129  
   130  // IsRedirect returns true when this get system info internal server error response has a 3xx status code
   131  func (o *GetSystemInfoInternalServerError) IsRedirect() bool {
   132  	return false
   133  }
   134  
   135  // IsClientError returns true when this get system info internal server error response has a 4xx status code
   136  func (o *GetSystemInfoInternalServerError) IsClientError() bool {
   137  	return false
   138  }
   139  
   140  // IsServerError returns true when this get system info internal server error response has a 5xx status code
   141  func (o *GetSystemInfoInternalServerError) IsServerError() bool {
   142  	return true
   143  }
   144  
   145  // IsCode returns true when this get system info internal server error response a status code equal to that given
   146  func (o *GetSystemInfoInternalServerError) IsCode(code int) bool {
   147  	return code == 500
   148  }
   149  
   150  func (o *GetSystemInfoInternalServerError) Error() string {
   151  	return fmt.Sprintf("[GET /systeminfo][%d] getSystemInfoInternalServerError  %+v", 500, o.Payload)
   152  }
   153  
   154  func (o *GetSystemInfoInternalServerError) String() string {
   155  	return fmt.Sprintf("[GET /systeminfo][%d] getSystemInfoInternalServerError  %+v", 500, o.Payload)
   156  }
   157  
   158  func (o *GetSystemInfoInternalServerError) GetPayload() *models.Errors {
   159  	return o.Payload
   160  }
   161  
   162  func (o *GetSystemInfoInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   163  
   164  	// hydrates response header X-Request-Id
   165  	hdrXRequestID := response.GetHeader("X-Request-Id")
   166  
   167  	if hdrXRequestID != "" {
   168  		o.XRequestID = hdrXRequestID
   169  	}
   170  
   171  	o.Payload = new(models.Errors)
   172  
   173  	// response payload
   174  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   175  		return err
   176  	}
   177  
   178  	return nil
   179  }