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

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