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