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