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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package jobservice
     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  // GetWorkerPoolsReader is a Reader for the GetWorkerPools structure.
    19  type GetWorkerPoolsReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *GetWorkerPoolsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewGetWorkerPoolsOK()
    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 := NewGetWorkerPoolsUnauthorized()
    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 := NewGetWorkerPoolsForbidden()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return nil, result
    44  	case 500:
    45  		result := NewGetWorkerPoolsInternalServerError()
    46  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    47  			return nil, err
    48  		}
    49  		return nil, result
    50  	default:
    51  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    52  	}
    53  }
    54  
    55  // NewGetWorkerPoolsOK creates a GetWorkerPoolsOK with default headers values
    56  func NewGetWorkerPoolsOK() *GetWorkerPoolsOK {
    57  	return &GetWorkerPoolsOK{}
    58  }
    59  
    60  /*
    61  GetWorkerPoolsOK describes a response with status code 200, with default header values.
    62  
    63  Get worker pools successfully.
    64  */
    65  type GetWorkerPoolsOK struct {
    66  	Payload []*models.WorkerPool
    67  }
    68  
    69  // IsSuccess returns true when this get worker pools o k response has a 2xx status code
    70  func (o *GetWorkerPoolsOK) IsSuccess() bool {
    71  	return true
    72  }
    73  
    74  // IsRedirect returns true when this get worker pools o k response has a 3xx status code
    75  func (o *GetWorkerPoolsOK) IsRedirect() bool {
    76  	return false
    77  }
    78  
    79  // IsClientError returns true when this get worker pools o k response has a 4xx status code
    80  func (o *GetWorkerPoolsOK) IsClientError() bool {
    81  	return false
    82  }
    83  
    84  // IsServerError returns true when this get worker pools o k response has a 5xx status code
    85  func (o *GetWorkerPoolsOK) IsServerError() bool {
    86  	return false
    87  }
    88  
    89  // IsCode returns true when this get worker pools o k response a status code equal to that given
    90  func (o *GetWorkerPoolsOK) IsCode(code int) bool {
    91  	return code == 200
    92  }
    93  
    94  func (o *GetWorkerPoolsOK) Error() string {
    95  	return fmt.Sprintf("[GET /jobservice/pools][%d] getWorkerPoolsOK  %+v", 200, o.Payload)
    96  }
    97  
    98  func (o *GetWorkerPoolsOK) String() string {
    99  	return fmt.Sprintf("[GET /jobservice/pools][%d] getWorkerPoolsOK  %+v", 200, o.Payload)
   100  }
   101  
   102  func (o *GetWorkerPoolsOK) GetPayload() []*models.WorkerPool {
   103  	return o.Payload
   104  }
   105  
   106  func (o *GetWorkerPoolsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   107  
   108  	// response payload
   109  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   110  		return err
   111  	}
   112  
   113  	return nil
   114  }
   115  
   116  // NewGetWorkerPoolsUnauthorized creates a GetWorkerPoolsUnauthorized with default headers values
   117  func NewGetWorkerPoolsUnauthorized() *GetWorkerPoolsUnauthorized {
   118  	return &GetWorkerPoolsUnauthorized{}
   119  }
   120  
   121  /*
   122  GetWorkerPoolsUnauthorized describes a response with status code 401, with default header values.
   123  
   124  Unauthorized
   125  */
   126  type GetWorkerPoolsUnauthorized struct {
   127  
   128  	/* The ID of the corresponding request for the response
   129  	 */
   130  	XRequestID string
   131  
   132  	Payload *models.Errors
   133  }
   134  
   135  // IsSuccess returns true when this get worker pools unauthorized response has a 2xx status code
   136  func (o *GetWorkerPoolsUnauthorized) IsSuccess() bool {
   137  	return false
   138  }
   139  
   140  // IsRedirect returns true when this get worker pools unauthorized response has a 3xx status code
   141  func (o *GetWorkerPoolsUnauthorized) IsRedirect() bool {
   142  	return false
   143  }
   144  
   145  // IsClientError returns true when this get worker pools unauthorized response has a 4xx status code
   146  func (o *GetWorkerPoolsUnauthorized) IsClientError() bool {
   147  	return true
   148  }
   149  
   150  // IsServerError returns true when this get worker pools unauthorized response has a 5xx status code
   151  func (o *GetWorkerPoolsUnauthorized) IsServerError() bool {
   152  	return false
   153  }
   154  
   155  // IsCode returns true when this get worker pools unauthorized response a status code equal to that given
   156  func (o *GetWorkerPoolsUnauthorized) IsCode(code int) bool {
   157  	return code == 401
   158  }
   159  
   160  func (o *GetWorkerPoolsUnauthorized) Error() string {
   161  	return fmt.Sprintf("[GET /jobservice/pools][%d] getWorkerPoolsUnauthorized  %+v", 401, o.Payload)
   162  }
   163  
   164  func (o *GetWorkerPoolsUnauthorized) String() string {
   165  	return fmt.Sprintf("[GET /jobservice/pools][%d] getWorkerPoolsUnauthorized  %+v", 401, o.Payload)
   166  }
   167  
   168  func (o *GetWorkerPoolsUnauthorized) GetPayload() *models.Errors {
   169  	return o.Payload
   170  }
   171  
   172  func (o *GetWorkerPoolsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   173  
   174  	// hydrates response header X-Request-Id
   175  	hdrXRequestID := response.GetHeader("X-Request-Id")
   176  
   177  	if hdrXRequestID != "" {
   178  		o.XRequestID = hdrXRequestID
   179  	}
   180  
   181  	o.Payload = new(models.Errors)
   182  
   183  	// response payload
   184  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   185  		return err
   186  	}
   187  
   188  	return nil
   189  }
   190  
   191  // NewGetWorkerPoolsForbidden creates a GetWorkerPoolsForbidden with default headers values
   192  func NewGetWorkerPoolsForbidden() *GetWorkerPoolsForbidden {
   193  	return &GetWorkerPoolsForbidden{}
   194  }
   195  
   196  /*
   197  GetWorkerPoolsForbidden describes a response with status code 403, with default header values.
   198  
   199  Forbidden
   200  */
   201  type GetWorkerPoolsForbidden struct {
   202  
   203  	/* The ID of the corresponding request for the response
   204  	 */
   205  	XRequestID string
   206  
   207  	Payload *models.Errors
   208  }
   209  
   210  // IsSuccess returns true when this get worker pools forbidden response has a 2xx status code
   211  func (o *GetWorkerPoolsForbidden) IsSuccess() bool {
   212  	return false
   213  }
   214  
   215  // IsRedirect returns true when this get worker pools forbidden response has a 3xx status code
   216  func (o *GetWorkerPoolsForbidden) IsRedirect() bool {
   217  	return false
   218  }
   219  
   220  // IsClientError returns true when this get worker pools forbidden response has a 4xx status code
   221  func (o *GetWorkerPoolsForbidden) IsClientError() bool {
   222  	return true
   223  }
   224  
   225  // IsServerError returns true when this get worker pools forbidden response has a 5xx status code
   226  func (o *GetWorkerPoolsForbidden) IsServerError() bool {
   227  	return false
   228  }
   229  
   230  // IsCode returns true when this get worker pools forbidden response a status code equal to that given
   231  func (o *GetWorkerPoolsForbidden) IsCode(code int) bool {
   232  	return code == 403
   233  }
   234  
   235  func (o *GetWorkerPoolsForbidden) Error() string {
   236  	return fmt.Sprintf("[GET /jobservice/pools][%d] getWorkerPoolsForbidden  %+v", 403, o.Payload)
   237  }
   238  
   239  func (o *GetWorkerPoolsForbidden) String() string {
   240  	return fmt.Sprintf("[GET /jobservice/pools][%d] getWorkerPoolsForbidden  %+v", 403, o.Payload)
   241  }
   242  
   243  func (o *GetWorkerPoolsForbidden) GetPayload() *models.Errors {
   244  	return o.Payload
   245  }
   246  
   247  func (o *GetWorkerPoolsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   248  
   249  	// hydrates response header X-Request-Id
   250  	hdrXRequestID := response.GetHeader("X-Request-Id")
   251  
   252  	if hdrXRequestID != "" {
   253  		o.XRequestID = hdrXRequestID
   254  	}
   255  
   256  	o.Payload = new(models.Errors)
   257  
   258  	// response payload
   259  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   260  		return err
   261  	}
   262  
   263  	return nil
   264  }
   265  
   266  // NewGetWorkerPoolsInternalServerError creates a GetWorkerPoolsInternalServerError with default headers values
   267  func NewGetWorkerPoolsInternalServerError() *GetWorkerPoolsInternalServerError {
   268  	return &GetWorkerPoolsInternalServerError{}
   269  }
   270  
   271  /*
   272  GetWorkerPoolsInternalServerError describes a response with status code 500, with default header values.
   273  
   274  Internal server error
   275  */
   276  type GetWorkerPoolsInternalServerError struct {
   277  
   278  	/* The ID of the corresponding request for the response
   279  	 */
   280  	XRequestID string
   281  
   282  	Payload *models.Errors
   283  }
   284  
   285  // IsSuccess returns true when this get worker pools internal server error response has a 2xx status code
   286  func (o *GetWorkerPoolsInternalServerError) IsSuccess() bool {
   287  	return false
   288  }
   289  
   290  // IsRedirect returns true when this get worker pools internal server error response has a 3xx status code
   291  func (o *GetWorkerPoolsInternalServerError) IsRedirect() bool {
   292  	return false
   293  }
   294  
   295  // IsClientError returns true when this get worker pools internal server error response has a 4xx status code
   296  func (o *GetWorkerPoolsInternalServerError) IsClientError() bool {
   297  	return false
   298  }
   299  
   300  // IsServerError returns true when this get worker pools internal server error response has a 5xx status code
   301  func (o *GetWorkerPoolsInternalServerError) IsServerError() bool {
   302  	return true
   303  }
   304  
   305  // IsCode returns true when this get worker pools internal server error response a status code equal to that given
   306  func (o *GetWorkerPoolsInternalServerError) IsCode(code int) bool {
   307  	return code == 500
   308  }
   309  
   310  func (o *GetWorkerPoolsInternalServerError) Error() string {
   311  	return fmt.Sprintf("[GET /jobservice/pools][%d] getWorkerPoolsInternalServerError  %+v", 500, o.Payload)
   312  }
   313  
   314  func (o *GetWorkerPoolsInternalServerError) String() string {
   315  	return fmt.Sprintf("[GET /jobservice/pools][%d] getWorkerPoolsInternalServerError  %+v", 500, o.Payload)
   316  }
   317  
   318  func (o *GetWorkerPoolsInternalServerError) GetPayload() *models.Errors {
   319  	return o.Payload
   320  }
   321  
   322  func (o *GetWorkerPoolsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   323  
   324  	// hydrates response header X-Request-Id
   325  	hdrXRequestID := response.GetHeader("X-Request-Id")
   326  
   327  	if hdrXRequestID != "" {
   328  		o.XRequestID = hdrXRequestID
   329  	}
   330  
   331  	o.Payload = new(models.Errors)
   332  
   333  	// response payload
   334  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   335  		return err
   336  	}
   337  
   338  	return nil
   339  }