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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package retention
     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  	"context"
    10  	"fmt"
    11  	"io"
    12  
    13  	"github.com/go-openapi/runtime"
    14  	"github.com/go-openapi/strfmt"
    15  	"github.com/go-openapi/swag"
    16  
    17  	"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
    18  )
    19  
    20  // TriggerRetentionExecutionReader is a Reader for the TriggerRetentionExecution structure.
    21  type TriggerRetentionExecutionReader struct {
    22  	formats strfmt.Registry
    23  }
    24  
    25  // ReadResponse reads a server response into the received o.
    26  func (o *TriggerRetentionExecutionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    27  	switch response.Code() {
    28  	case 200:
    29  		result := NewTriggerRetentionExecutionOK()
    30  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    31  			return nil, err
    32  		}
    33  		return result, nil
    34  	case 201:
    35  		result := NewTriggerRetentionExecutionCreated()
    36  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    37  			return nil, err
    38  		}
    39  		return result, nil
    40  	case 401:
    41  		result := NewTriggerRetentionExecutionUnauthorized()
    42  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    43  			return nil, err
    44  		}
    45  		return nil, result
    46  	case 403:
    47  		result := NewTriggerRetentionExecutionForbidden()
    48  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    49  			return nil, err
    50  		}
    51  		return nil, result
    52  	case 500:
    53  		result := NewTriggerRetentionExecutionInternalServerError()
    54  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    55  			return nil, err
    56  		}
    57  		return nil, result
    58  	default:
    59  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    60  	}
    61  }
    62  
    63  // NewTriggerRetentionExecutionOK creates a TriggerRetentionExecutionOK with default headers values
    64  func NewTriggerRetentionExecutionOK() *TriggerRetentionExecutionOK {
    65  	return &TriggerRetentionExecutionOK{}
    66  }
    67  
    68  /*
    69  TriggerRetentionExecutionOK describes a response with status code 200, with default header values.
    70  
    71  Trigger a Retention job successfully.
    72  */
    73  type TriggerRetentionExecutionOK struct {
    74  }
    75  
    76  // IsSuccess returns true when this trigger retention execution o k response has a 2xx status code
    77  func (o *TriggerRetentionExecutionOK) IsSuccess() bool {
    78  	return true
    79  }
    80  
    81  // IsRedirect returns true when this trigger retention execution o k response has a 3xx status code
    82  func (o *TriggerRetentionExecutionOK) IsRedirect() bool {
    83  	return false
    84  }
    85  
    86  // IsClientError returns true when this trigger retention execution o k response has a 4xx status code
    87  func (o *TriggerRetentionExecutionOK) IsClientError() bool {
    88  	return false
    89  }
    90  
    91  // IsServerError returns true when this trigger retention execution o k response has a 5xx status code
    92  func (o *TriggerRetentionExecutionOK) IsServerError() bool {
    93  	return false
    94  }
    95  
    96  // IsCode returns true when this trigger retention execution o k response a status code equal to that given
    97  func (o *TriggerRetentionExecutionOK) IsCode(code int) bool {
    98  	return code == 200
    99  }
   100  
   101  func (o *TriggerRetentionExecutionOK) Error() string {
   102  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionOK ", 200)
   103  }
   104  
   105  func (o *TriggerRetentionExecutionOK) String() string {
   106  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionOK ", 200)
   107  }
   108  
   109  func (o *TriggerRetentionExecutionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   110  
   111  	return nil
   112  }
   113  
   114  // NewTriggerRetentionExecutionCreated creates a TriggerRetentionExecutionCreated with default headers values
   115  func NewTriggerRetentionExecutionCreated() *TriggerRetentionExecutionCreated {
   116  	return &TriggerRetentionExecutionCreated{}
   117  }
   118  
   119  /*
   120  TriggerRetentionExecutionCreated describes a response with status code 201, with default header values.
   121  
   122  Created
   123  */
   124  type TriggerRetentionExecutionCreated struct {
   125  
   126  	/* The location of the resource
   127  	 */
   128  	Location string
   129  
   130  	/* The ID of the corresponding request for the response
   131  	 */
   132  	XRequestID string
   133  }
   134  
   135  // IsSuccess returns true when this trigger retention execution created response has a 2xx status code
   136  func (o *TriggerRetentionExecutionCreated) IsSuccess() bool {
   137  	return true
   138  }
   139  
   140  // IsRedirect returns true when this trigger retention execution created response has a 3xx status code
   141  func (o *TriggerRetentionExecutionCreated) IsRedirect() bool {
   142  	return false
   143  }
   144  
   145  // IsClientError returns true when this trigger retention execution created response has a 4xx status code
   146  func (o *TriggerRetentionExecutionCreated) IsClientError() bool {
   147  	return false
   148  }
   149  
   150  // IsServerError returns true when this trigger retention execution created response has a 5xx status code
   151  func (o *TriggerRetentionExecutionCreated) IsServerError() bool {
   152  	return false
   153  }
   154  
   155  // IsCode returns true when this trigger retention execution created response a status code equal to that given
   156  func (o *TriggerRetentionExecutionCreated) IsCode(code int) bool {
   157  	return code == 201
   158  }
   159  
   160  func (o *TriggerRetentionExecutionCreated) Error() string {
   161  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionCreated ", 201)
   162  }
   163  
   164  func (o *TriggerRetentionExecutionCreated) String() string {
   165  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionCreated ", 201)
   166  }
   167  
   168  func (o *TriggerRetentionExecutionCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   169  
   170  	// hydrates response header Location
   171  	hdrLocation := response.GetHeader("Location")
   172  
   173  	if hdrLocation != "" {
   174  		o.Location = hdrLocation
   175  	}
   176  
   177  	// hydrates response header X-Request-Id
   178  	hdrXRequestID := response.GetHeader("X-Request-Id")
   179  
   180  	if hdrXRequestID != "" {
   181  		o.XRequestID = hdrXRequestID
   182  	}
   183  
   184  	return nil
   185  }
   186  
   187  // NewTriggerRetentionExecutionUnauthorized creates a TriggerRetentionExecutionUnauthorized with default headers values
   188  func NewTriggerRetentionExecutionUnauthorized() *TriggerRetentionExecutionUnauthorized {
   189  	return &TriggerRetentionExecutionUnauthorized{}
   190  }
   191  
   192  /*
   193  TriggerRetentionExecutionUnauthorized describes a response with status code 401, with default header values.
   194  
   195  Unauthorized
   196  */
   197  type TriggerRetentionExecutionUnauthorized 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 trigger retention execution unauthorized response has a 2xx status code
   207  func (o *TriggerRetentionExecutionUnauthorized) IsSuccess() bool {
   208  	return false
   209  }
   210  
   211  // IsRedirect returns true when this trigger retention execution unauthorized response has a 3xx status code
   212  func (o *TriggerRetentionExecutionUnauthorized) IsRedirect() bool {
   213  	return false
   214  }
   215  
   216  // IsClientError returns true when this trigger retention execution unauthorized response has a 4xx status code
   217  func (o *TriggerRetentionExecutionUnauthorized) IsClientError() bool {
   218  	return true
   219  }
   220  
   221  // IsServerError returns true when this trigger retention execution unauthorized response has a 5xx status code
   222  func (o *TriggerRetentionExecutionUnauthorized) IsServerError() bool {
   223  	return false
   224  }
   225  
   226  // IsCode returns true when this trigger retention execution unauthorized response a status code equal to that given
   227  func (o *TriggerRetentionExecutionUnauthorized) IsCode(code int) bool {
   228  	return code == 401
   229  }
   230  
   231  func (o *TriggerRetentionExecutionUnauthorized) Error() string {
   232  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionUnauthorized  %+v", 401, o.Payload)
   233  }
   234  
   235  func (o *TriggerRetentionExecutionUnauthorized) String() string {
   236  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionUnauthorized  %+v", 401, o.Payload)
   237  }
   238  
   239  func (o *TriggerRetentionExecutionUnauthorized) GetPayload() *models.Errors {
   240  	return o.Payload
   241  }
   242  
   243  func (o *TriggerRetentionExecutionUnauthorized) 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  // NewTriggerRetentionExecutionForbidden creates a TriggerRetentionExecutionForbidden with default headers values
   263  func NewTriggerRetentionExecutionForbidden() *TriggerRetentionExecutionForbidden {
   264  	return &TriggerRetentionExecutionForbidden{}
   265  }
   266  
   267  /*
   268  TriggerRetentionExecutionForbidden describes a response with status code 403, with default header values.
   269  
   270  Forbidden
   271  */
   272  type TriggerRetentionExecutionForbidden 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 trigger retention execution forbidden response has a 2xx status code
   282  func (o *TriggerRetentionExecutionForbidden) IsSuccess() bool {
   283  	return false
   284  }
   285  
   286  // IsRedirect returns true when this trigger retention execution forbidden response has a 3xx status code
   287  func (o *TriggerRetentionExecutionForbidden) IsRedirect() bool {
   288  	return false
   289  }
   290  
   291  // IsClientError returns true when this trigger retention execution forbidden response has a 4xx status code
   292  func (o *TriggerRetentionExecutionForbidden) IsClientError() bool {
   293  	return true
   294  }
   295  
   296  // IsServerError returns true when this trigger retention execution forbidden response has a 5xx status code
   297  func (o *TriggerRetentionExecutionForbidden) IsServerError() bool {
   298  	return false
   299  }
   300  
   301  // IsCode returns true when this trigger retention execution forbidden response a status code equal to that given
   302  func (o *TriggerRetentionExecutionForbidden) IsCode(code int) bool {
   303  	return code == 403
   304  }
   305  
   306  func (o *TriggerRetentionExecutionForbidden) Error() string {
   307  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionForbidden  %+v", 403, o.Payload)
   308  }
   309  
   310  func (o *TriggerRetentionExecutionForbidden) String() string {
   311  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionForbidden  %+v", 403, o.Payload)
   312  }
   313  
   314  func (o *TriggerRetentionExecutionForbidden) GetPayload() *models.Errors {
   315  	return o.Payload
   316  }
   317  
   318  func (o *TriggerRetentionExecutionForbidden) 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  // NewTriggerRetentionExecutionInternalServerError creates a TriggerRetentionExecutionInternalServerError with default headers values
   338  func NewTriggerRetentionExecutionInternalServerError() *TriggerRetentionExecutionInternalServerError {
   339  	return &TriggerRetentionExecutionInternalServerError{}
   340  }
   341  
   342  /*
   343  TriggerRetentionExecutionInternalServerError describes a response with status code 500, with default header values.
   344  
   345  Internal server error
   346  */
   347  type TriggerRetentionExecutionInternalServerError 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 trigger retention execution internal server error response has a 2xx status code
   357  func (o *TriggerRetentionExecutionInternalServerError) IsSuccess() bool {
   358  	return false
   359  }
   360  
   361  // IsRedirect returns true when this trigger retention execution internal server error response has a 3xx status code
   362  func (o *TriggerRetentionExecutionInternalServerError) IsRedirect() bool {
   363  	return false
   364  }
   365  
   366  // IsClientError returns true when this trigger retention execution internal server error response has a 4xx status code
   367  func (o *TriggerRetentionExecutionInternalServerError) IsClientError() bool {
   368  	return false
   369  }
   370  
   371  // IsServerError returns true when this trigger retention execution internal server error response has a 5xx status code
   372  func (o *TriggerRetentionExecutionInternalServerError) IsServerError() bool {
   373  	return true
   374  }
   375  
   376  // IsCode returns true when this trigger retention execution internal server error response a status code equal to that given
   377  func (o *TriggerRetentionExecutionInternalServerError) IsCode(code int) bool {
   378  	return code == 500
   379  }
   380  
   381  func (o *TriggerRetentionExecutionInternalServerError) Error() string {
   382  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionInternalServerError  %+v", 500, o.Payload)
   383  }
   384  
   385  func (o *TriggerRetentionExecutionInternalServerError) String() string {
   386  	return fmt.Sprintf("[POST /retentions/{id}/executions][%d] triggerRetentionExecutionInternalServerError  %+v", 500, o.Payload)
   387  }
   388  
   389  func (o *TriggerRetentionExecutionInternalServerError) GetPayload() *models.Errors {
   390  	return o.Payload
   391  }
   392  
   393  func (o *TriggerRetentionExecutionInternalServerError) 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  }
   411  
   412  /*
   413  TriggerRetentionExecutionBody trigger retention execution body
   414  swagger:model TriggerRetentionExecutionBody
   415  */
   416  type TriggerRetentionExecutionBody struct {
   417  
   418  	// dry run
   419  	DryRun bool `json:"dry_run,omitempty"`
   420  }
   421  
   422  // Validate validates this trigger retention execution body
   423  func (o *TriggerRetentionExecutionBody) Validate(formats strfmt.Registry) error {
   424  	return nil
   425  }
   426  
   427  // ContextValidate validates this trigger retention execution body based on context it is used
   428  func (o *TriggerRetentionExecutionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   429  	return nil
   430  }
   431  
   432  // MarshalBinary interface implementation
   433  func (o *TriggerRetentionExecutionBody) MarshalBinary() ([]byte, error) {
   434  	if o == nil {
   435  		return nil, nil
   436  	}
   437  	return swag.WriteJSON(o)
   438  }
   439  
   440  // UnmarshalBinary interface implementation
   441  func (o *TriggerRetentionExecutionBody) UnmarshalBinary(b []byte) error {
   442  	var res TriggerRetentionExecutionBody
   443  	if err := swag.ReadJSON(b, &res); err != nil {
   444  		return err
   445  	}
   446  	*o = res
   447  	return nil
   448  }