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

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