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