github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/purge/update_purge_schedule_parameters.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  	"context"
    10  	"net/http"
    11  	"time"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/runtime"
    15  	cr "github.com/go-openapi/runtime/client"
    16  	"github.com/go-openapi/strfmt"
    17  
    18  	"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
    19  )
    20  
    21  // NewUpdatePurgeScheduleParams creates a new UpdatePurgeScheduleParams object,
    22  // with the default timeout for this client.
    23  //
    24  // Default values are not hydrated, since defaults are normally applied by the API server side.
    25  //
    26  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    27  func NewUpdatePurgeScheduleParams() *UpdatePurgeScheduleParams {
    28  	return &UpdatePurgeScheduleParams{
    29  		timeout: cr.DefaultTimeout,
    30  	}
    31  }
    32  
    33  // NewUpdatePurgeScheduleParamsWithTimeout creates a new UpdatePurgeScheduleParams object
    34  // with the ability to set a timeout on a request.
    35  func NewUpdatePurgeScheduleParamsWithTimeout(timeout time.Duration) *UpdatePurgeScheduleParams {
    36  	return &UpdatePurgeScheduleParams{
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewUpdatePurgeScheduleParamsWithContext creates a new UpdatePurgeScheduleParams object
    42  // with the ability to set a context for a request.
    43  func NewUpdatePurgeScheduleParamsWithContext(ctx context.Context) *UpdatePurgeScheduleParams {
    44  	return &UpdatePurgeScheduleParams{
    45  		Context: ctx,
    46  	}
    47  }
    48  
    49  // NewUpdatePurgeScheduleParamsWithHTTPClient creates a new UpdatePurgeScheduleParams object
    50  // with the ability to set a custom HTTPClient for a request.
    51  func NewUpdatePurgeScheduleParamsWithHTTPClient(client *http.Client) *UpdatePurgeScheduleParams {
    52  	return &UpdatePurgeScheduleParams{
    53  		HTTPClient: client,
    54  	}
    55  }
    56  
    57  /*
    58  UpdatePurgeScheduleParams contains all the parameters to send to the API endpoint
    59  
    60  	for the update purge schedule operation.
    61  
    62  	Typically these are written to a http.Request.
    63  */
    64  type UpdatePurgeScheduleParams struct {
    65  
    66  	/* XRequestID.
    67  
    68  	   An unique ID for the request
    69  	*/
    70  	XRequestID *string
    71  
    72  	/* Schedule.
    73  
    74  	     The purge job's schedule, it is a json object. |
    75  	The sample format is |
    76  	{"parameters":{"audit_retention_hour":168,"dry_run":true, "include_operations":"create,delete,pull"},"schedule":{"type":"Hourly","cron":"0 0 * * * *"}} |
    77  	the include_operation should be a comma separated string, e.g. create,delete,pull, if it is empty, no operation will be purged.
    78  
    79  	*/
    80  	Schedule *models.Schedule
    81  
    82  	timeout    time.Duration
    83  	Context    context.Context
    84  	HTTPClient *http.Client
    85  }
    86  
    87  // WithDefaults hydrates default values in the update purge schedule params (not the query body).
    88  //
    89  // All values with no default are reset to their zero value.
    90  func (o *UpdatePurgeScheduleParams) WithDefaults() *UpdatePurgeScheduleParams {
    91  	o.SetDefaults()
    92  	return o
    93  }
    94  
    95  // SetDefaults hydrates default values in the update purge schedule params (not the query body).
    96  //
    97  // All values with no default are reset to their zero value.
    98  func (o *UpdatePurgeScheduleParams) SetDefaults() {
    99  	// no default values defined for this parameter
   100  }
   101  
   102  // WithTimeout adds the timeout to the update purge schedule params
   103  func (o *UpdatePurgeScheduleParams) WithTimeout(timeout time.Duration) *UpdatePurgeScheduleParams {
   104  	o.SetTimeout(timeout)
   105  	return o
   106  }
   107  
   108  // SetTimeout adds the timeout to the update purge schedule params
   109  func (o *UpdatePurgeScheduleParams) SetTimeout(timeout time.Duration) {
   110  	o.timeout = timeout
   111  }
   112  
   113  // WithContext adds the context to the update purge schedule params
   114  func (o *UpdatePurgeScheduleParams) WithContext(ctx context.Context) *UpdatePurgeScheduleParams {
   115  	o.SetContext(ctx)
   116  	return o
   117  }
   118  
   119  // SetContext adds the context to the update purge schedule params
   120  func (o *UpdatePurgeScheduleParams) SetContext(ctx context.Context) {
   121  	o.Context = ctx
   122  }
   123  
   124  // WithHTTPClient adds the HTTPClient to the update purge schedule params
   125  func (o *UpdatePurgeScheduleParams) WithHTTPClient(client *http.Client) *UpdatePurgeScheduleParams {
   126  	o.SetHTTPClient(client)
   127  	return o
   128  }
   129  
   130  // SetHTTPClient adds the HTTPClient to the update purge schedule params
   131  func (o *UpdatePurgeScheduleParams) SetHTTPClient(client *http.Client) {
   132  	o.HTTPClient = client
   133  }
   134  
   135  // WithXRequestID adds the xRequestID to the update purge schedule params
   136  func (o *UpdatePurgeScheduleParams) WithXRequestID(xRequestID *string) *UpdatePurgeScheduleParams {
   137  	o.SetXRequestID(xRequestID)
   138  	return o
   139  }
   140  
   141  // SetXRequestID adds the xRequestId to the update purge schedule params
   142  func (o *UpdatePurgeScheduleParams) SetXRequestID(xRequestID *string) {
   143  	o.XRequestID = xRequestID
   144  }
   145  
   146  // WithSchedule adds the schedule to the update purge schedule params
   147  func (o *UpdatePurgeScheduleParams) WithSchedule(schedule *models.Schedule) *UpdatePurgeScheduleParams {
   148  	o.SetSchedule(schedule)
   149  	return o
   150  }
   151  
   152  // SetSchedule adds the schedule to the update purge schedule params
   153  func (o *UpdatePurgeScheduleParams) SetSchedule(schedule *models.Schedule) {
   154  	o.Schedule = schedule
   155  }
   156  
   157  // WriteToRequest writes these params to a swagger request
   158  func (o *UpdatePurgeScheduleParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   159  
   160  	if err := r.SetTimeout(o.timeout); err != nil {
   161  		return err
   162  	}
   163  	var res []error
   164  
   165  	if o.XRequestID != nil {
   166  
   167  		// header param X-Request-Id
   168  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   169  			return err
   170  		}
   171  	}
   172  	if o.Schedule != nil {
   173  		if err := r.SetBodyParam(o.Schedule); err != nil {
   174  			return err
   175  		}
   176  	}
   177  
   178  	if len(res) > 0 {
   179  		return errors.CompositeValidationError(res...)
   180  	}
   181  	return nil
   182  }