github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/robot/create_robot_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  // CreateRobotReader is a Reader for the CreateRobot structure.
    19  type CreateRobotReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *CreateRobotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 201:
    27  		result := NewCreateRobotCreated()
    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 := NewCreateRobotBadRequest()
    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 := NewCreateRobotUnauthorized()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return nil, result
    44  	case 403:
    45  		result := NewCreateRobotForbidden()
    46  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    47  			return nil, err
    48  		}
    49  		return nil, result
    50  	case 404:
    51  		result := NewCreateRobotNotFound()
    52  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    53  			return nil, err
    54  		}
    55  		return nil, result
    56  	case 500:
    57  		result := NewCreateRobotInternalServerError()
    58  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    59  			return nil, err
    60  		}
    61  		return nil, result
    62  	default:
    63  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    64  	}
    65  }
    66  
    67  // NewCreateRobotCreated creates a CreateRobotCreated with default headers values
    68  func NewCreateRobotCreated() *CreateRobotCreated {
    69  	return &CreateRobotCreated{}
    70  }
    71  
    72  /*
    73  CreateRobotCreated describes a response with status code 201, with default header values.
    74  
    75  Created
    76  */
    77  type CreateRobotCreated struct {
    78  
    79  	/* The location of the resource
    80  	 */
    81  	Location string
    82  
    83  	/* The ID of the corresponding request for the response
    84  	 */
    85  	XRequestID string
    86  
    87  	Payload *models.RobotCreated
    88  }
    89  
    90  // IsSuccess returns true when this create robot created response has a 2xx status code
    91  func (o *CreateRobotCreated) IsSuccess() bool {
    92  	return true
    93  }
    94  
    95  // IsRedirect returns true when this create robot created response has a 3xx status code
    96  func (o *CreateRobotCreated) IsRedirect() bool {
    97  	return false
    98  }
    99  
   100  // IsClientError returns true when this create robot created response has a 4xx status code
   101  func (o *CreateRobotCreated) IsClientError() bool {
   102  	return false
   103  }
   104  
   105  // IsServerError returns true when this create robot created response has a 5xx status code
   106  func (o *CreateRobotCreated) IsServerError() bool {
   107  	return false
   108  }
   109  
   110  // IsCode returns true when this create robot created response a status code equal to that given
   111  func (o *CreateRobotCreated) IsCode(code int) bool {
   112  	return code == 201
   113  }
   114  
   115  func (o *CreateRobotCreated) Error() string {
   116  	return fmt.Sprintf("[POST /robots][%d] createRobotCreated  %+v", 201, o.Payload)
   117  }
   118  
   119  func (o *CreateRobotCreated) String() string {
   120  	return fmt.Sprintf("[POST /robots][%d] createRobotCreated  %+v", 201, o.Payload)
   121  }
   122  
   123  func (o *CreateRobotCreated) GetPayload() *models.RobotCreated {
   124  	return o.Payload
   125  }
   126  
   127  func (o *CreateRobotCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   128  
   129  	// hydrates response header Location
   130  	hdrLocation := response.GetHeader("Location")
   131  
   132  	if hdrLocation != "" {
   133  		o.Location = hdrLocation
   134  	}
   135  
   136  	// hydrates response header X-Request-Id
   137  	hdrXRequestID := response.GetHeader("X-Request-Id")
   138  
   139  	if hdrXRequestID != "" {
   140  		o.XRequestID = hdrXRequestID
   141  	}
   142  
   143  	o.Payload = new(models.RobotCreated)
   144  
   145  	// response payload
   146  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   147  		return err
   148  	}
   149  
   150  	return nil
   151  }
   152  
   153  // NewCreateRobotBadRequest creates a CreateRobotBadRequest with default headers values
   154  func NewCreateRobotBadRequest() *CreateRobotBadRequest {
   155  	return &CreateRobotBadRequest{}
   156  }
   157  
   158  /*
   159  CreateRobotBadRequest describes a response with status code 400, with default header values.
   160  
   161  Bad request
   162  */
   163  type CreateRobotBadRequest struct {
   164  
   165  	/* The ID of the corresponding request for the response
   166  	 */
   167  	XRequestID string
   168  
   169  	Payload *models.Errors
   170  }
   171  
   172  // IsSuccess returns true when this create robot bad request response has a 2xx status code
   173  func (o *CreateRobotBadRequest) IsSuccess() bool {
   174  	return false
   175  }
   176  
   177  // IsRedirect returns true when this create robot bad request response has a 3xx status code
   178  func (o *CreateRobotBadRequest) IsRedirect() bool {
   179  	return false
   180  }
   181  
   182  // IsClientError returns true when this create robot bad request response has a 4xx status code
   183  func (o *CreateRobotBadRequest) IsClientError() bool {
   184  	return true
   185  }
   186  
   187  // IsServerError returns true when this create robot bad request response has a 5xx status code
   188  func (o *CreateRobotBadRequest) IsServerError() bool {
   189  	return false
   190  }
   191  
   192  // IsCode returns true when this create robot bad request response a status code equal to that given
   193  func (o *CreateRobotBadRequest) IsCode(code int) bool {
   194  	return code == 400
   195  }
   196  
   197  func (o *CreateRobotBadRequest) Error() string {
   198  	return fmt.Sprintf("[POST /robots][%d] createRobotBadRequest  %+v", 400, o.Payload)
   199  }
   200  
   201  func (o *CreateRobotBadRequest) String() string {
   202  	return fmt.Sprintf("[POST /robots][%d] createRobotBadRequest  %+v", 400, o.Payload)
   203  }
   204  
   205  func (o *CreateRobotBadRequest) GetPayload() *models.Errors {
   206  	return o.Payload
   207  }
   208  
   209  func (o *CreateRobotBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   210  
   211  	// hydrates response header X-Request-Id
   212  	hdrXRequestID := response.GetHeader("X-Request-Id")
   213  
   214  	if hdrXRequestID != "" {
   215  		o.XRequestID = hdrXRequestID
   216  	}
   217  
   218  	o.Payload = new(models.Errors)
   219  
   220  	// response payload
   221  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   222  		return err
   223  	}
   224  
   225  	return nil
   226  }
   227  
   228  // NewCreateRobotUnauthorized creates a CreateRobotUnauthorized with default headers values
   229  func NewCreateRobotUnauthorized() *CreateRobotUnauthorized {
   230  	return &CreateRobotUnauthorized{}
   231  }
   232  
   233  /*
   234  CreateRobotUnauthorized describes a response with status code 401, with default header values.
   235  
   236  Unauthorized
   237  */
   238  type CreateRobotUnauthorized struct {
   239  
   240  	/* The ID of the corresponding request for the response
   241  	 */
   242  	XRequestID string
   243  
   244  	Payload *models.Errors
   245  }
   246  
   247  // IsSuccess returns true when this create robot unauthorized response has a 2xx status code
   248  func (o *CreateRobotUnauthorized) IsSuccess() bool {
   249  	return false
   250  }
   251  
   252  // IsRedirect returns true when this create robot unauthorized response has a 3xx status code
   253  func (o *CreateRobotUnauthorized) IsRedirect() bool {
   254  	return false
   255  }
   256  
   257  // IsClientError returns true when this create robot unauthorized response has a 4xx status code
   258  func (o *CreateRobotUnauthorized) IsClientError() bool {
   259  	return true
   260  }
   261  
   262  // IsServerError returns true when this create robot unauthorized response has a 5xx status code
   263  func (o *CreateRobotUnauthorized) IsServerError() bool {
   264  	return false
   265  }
   266  
   267  // IsCode returns true when this create robot unauthorized response a status code equal to that given
   268  func (o *CreateRobotUnauthorized) IsCode(code int) bool {
   269  	return code == 401
   270  }
   271  
   272  func (o *CreateRobotUnauthorized) Error() string {
   273  	return fmt.Sprintf("[POST /robots][%d] createRobotUnauthorized  %+v", 401, o.Payload)
   274  }
   275  
   276  func (o *CreateRobotUnauthorized) String() string {
   277  	return fmt.Sprintf("[POST /robots][%d] createRobotUnauthorized  %+v", 401, o.Payload)
   278  }
   279  
   280  func (o *CreateRobotUnauthorized) GetPayload() *models.Errors {
   281  	return o.Payload
   282  }
   283  
   284  func (o *CreateRobotUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   285  
   286  	// hydrates response header X-Request-Id
   287  	hdrXRequestID := response.GetHeader("X-Request-Id")
   288  
   289  	if hdrXRequestID != "" {
   290  		o.XRequestID = hdrXRequestID
   291  	}
   292  
   293  	o.Payload = new(models.Errors)
   294  
   295  	// response payload
   296  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   297  		return err
   298  	}
   299  
   300  	return nil
   301  }
   302  
   303  // NewCreateRobotForbidden creates a CreateRobotForbidden with default headers values
   304  func NewCreateRobotForbidden() *CreateRobotForbidden {
   305  	return &CreateRobotForbidden{}
   306  }
   307  
   308  /*
   309  CreateRobotForbidden describes a response with status code 403, with default header values.
   310  
   311  Forbidden
   312  */
   313  type CreateRobotForbidden struct {
   314  
   315  	/* The ID of the corresponding request for the response
   316  	 */
   317  	XRequestID string
   318  
   319  	Payload *models.Errors
   320  }
   321  
   322  // IsSuccess returns true when this create robot forbidden response has a 2xx status code
   323  func (o *CreateRobotForbidden) IsSuccess() bool {
   324  	return false
   325  }
   326  
   327  // IsRedirect returns true when this create robot forbidden response has a 3xx status code
   328  func (o *CreateRobotForbidden) IsRedirect() bool {
   329  	return false
   330  }
   331  
   332  // IsClientError returns true when this create robot forbidden response has a 4xx status code
   333  func (o *CreateRobotForbidden) IsClientError() bool {
   334  	return true
   335  }
   336  
   337  // IsServerError returns true when this create robot forbidden response has a 5xx status code
   338  func (o *CreateRobotForbidden) IsServerError() bool {
   339  	return false
   340  }
   341  
   342  // IsCode returns true when this create robot forbidden response a status code equal to that given
   343  func (o *CreateRobotForbidden) IsCode(code int) bool {
   344  	return code == 403
   345  }
   346  
   347  func (o *CreateRobotForbidden) Error() string {
   348  	return fmt.Sprintf("[POST /robots][%d] createRobotForbidden  %+v", 403, o.Payload)
   349  }
   350  
   351  func (o *CreateRobotForbidden) String() string {
   352  	return fmt.Sprintf("[POST /robots][%d] createRobotForbidden  %+v", 403, o.Payload)
   353  }
   354  
   355  func (o *CreateRobotForbidden) GetPayload() *models.Errors {
   356  	return o.Payload
   357  }
   358  
   359  func (o *CreateRobotForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   360  
   361  	// hydrates response header X-Request-Id
   362  	hdrXRequestID := response.GetHeader("X-Request-Id")
   363  
   364  	if hdrXRequestID != "" {
   365  		o.XRequestID = hdrXRequestID
   366  	}
   367  
   368  	o.Payload = new(models.Errors)
   369  
   370  	// response payload
   371  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   372  		return err
   373  	}
   374  
   375  	return nil
   376  }
   377  
   378  // NewCreateRobotNotFound creates a CreateRobotNotFound with default headers values
   379  func NewCreateRobotNotFound() *CreateRobotNotFound {
   380  	return &CreateRobotNotFound{}
   381  }
   382  
   383  /*
   384  CreateRobotNotFound describes a response with status code 404, with default header values.
   385  
   386  Not found
   387  */
   388  type CreateRobotNotFound struct {
   389  
   390  	/* The ID of the corresponding request for the response
   391  	 */
   392  	XRequestID string
   393  
   394  	Payload *models.Errors
   395  }
   396  
   397  // IsSuccess returns true when this create robot not found response has a 2xx status code
   398  func (o *CreateRobotNotFound) IsSuccess() bool {
   399  	return false
   400  }
   401  
   402  // IsRedirect returns true when this create robot not found response has a 3xx status code
   403  func (o *CreateRobotNotFound) IsRedirect() bool {
   404  	return false
   405  }
   406  
   407  // IsClientError returns true when this create robot not found response has a 4xx status code
   408  func (o *CreateRobotNotFound) IsClientError() bool {
   409  	return true
   410  }
   411  
   412  // IsServerError returns true when this create robot not found response has a 5xx status code
   413  func (o *CreateRobotNotFound) IsServerError() bool {
   414  	return false
   415  }
   416  
   417  // IsCode returns true when this create robot not found response a status code equal to that given
   418  func (o *CreateRobotNotFound) IsCode(code int) bool {
   419  	return code == 404
   420  }
   421  
   422  func (o *CreateRobotNotFound) Error() string {
   423  	return fmt.Sprintf("[POST /robots][%d] createRobotNotFound  %+v", 404, o.Payload)
   424  }
   425  
   426  func (o *CreateRobotNotFound) String() string {
   427  	return fmt.Sprintf("[POST /robots][%d] createRobotNotFound  %+v", 404, o.Payload)
   428  }
   429  
   430  func (o *CreateRobotNotFound) GetPayload() *models.Errors {
   431  	return o.Payload
   432  }
   433  
   434  func (o *CreateRobotNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   435  
   436  	// hydrates response header X-Request-Id
   437  	hdrXRequestID := response.GetHeader("X-Request-Id")
   438  
   439  	if hdrXRequestID != "" {
   440  		o.XRequestID = hdrXRequestID
   441  	}
   442  
   443  	o.Payload = new(models.Errors)
   444  
   445  	// response payload
   446  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   447  		return err
   448  	}
   449  
   450  	return nil
   451  }
   452  
   453  // NewCreateRobotInternalServerError creates a CreateRobotInternalServerError with default headers values
   454  func NewCreateRobotInternalServerError() *CreateRobotInternalServerError {
   455  	return &CreateRobotInternalServerError{}
   456  }
   457  
   458  /*
   459  CreateRobotInternalServerError describes a response with status code 500, with default header values.
   460  
   461  Internal server error
   462  */
   463  type CreateRobotInternalServerError struct {
   464  
   465  	/* The ID of the corresponding request for the response
   466  	 */
   467  	XRequestID string
   468  
   469  	Payload *models.Errors
   470  }
   471  
   472  // IsSuccess returns true when this create robot internal server error response has a 2xx status code
   473  func (o *CreateRobotInternalServerError) IsSuccess() bool {
   474  	return false
   475  }
   476  
   477  // IsRedirect returns true when this create robot internal server error response has a 3xx status code
   478  func (o *CreateRobotInternalServerError) IsRedirect() bool {
   479  	return false
   480  }
   481  
   482  // IsClientError returns true when this create robot internal server error response has a 4xx status code
   483  func (o *CreateRobotInternalServerError) IsClientError() bool {
   484  	return false
   485  }
   486  
   487  // IsServerError returns true when this create robot internal server error response has a 5xx status code
   488  func (o *CreateRobotInternalServerError) IsServerError() bool {
   489  	return true
   490  }
   491  
   492  // IsCode returns true when this create robot internal server error response a status code equal to that given
   493  func (o *CreateRobotInternalServerError) IsCode(code int) bool {
   494  	return code == 500
   495  }
   496  
   497  func (o *CreateRobotInternalServerError) Error() string {
   498  	return fmt.Sprintf("[POST /robots][%d] createRobotInternalServerError  %+v", 500, o.Payload)
   499  }
   500  
   501  func (o *CreateRobotInternalServerError) String() string {
   502  	return fmt.Sprintf("[POST /robots][%d] createRobotInternalServerError  %+v", 500, o.Payload)
   503  }
   504  
   505  func (o *CreateRobotInternalServerError) GetPayload() *models.Errors {
   506  	return o.Payload
   507  }
   508  
   509  func (o *CreateRobotInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   510  
   511  	// hydrates response header X-Request-Id
   512  	hdrXRequestID := response.GetHeader("X-Request-Id")
   513  
   514  	if hdrXRequestID != "" {
   515  		o.XRequestID = hdrXRequestID
   516  	}
   517  
   518  	o.Payload = new(models.Errors)
   519  
   520  	// response payload
   521  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   522  		return err
   523  	}
   524  
   525  	return nil
   526  }