github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/purge/create_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 // NewCreatePurgeScheduleParams creates a new CreatePurgeScheduleParams 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 NewCreatePurgeScheduleParams() *CreatePurgeScheduleParams { 28 return &CreatePurgeScheduleParams{ 29 timeout: cr.DefaultTimeout, 30 } 31 } 32 33 // NewCreatePurgeScheduleParamsWithTimeout creates a new CreatePurgeScheduleParams object 34 // with the ability to set a timeout on a request. 35 func NewCreatePurgeScheduleParamsWithTimeout(timeout time.Duration) *CreatePurgeScheduleParams { 36 return &CreatePurgeScheduleParams{ 37 timeout: timeout, 38 } 39 } 40 41 // NewCreatePurgeScheduleParamsWithContext creates a new CreatePurgeScheduleParams object 42 // with the ability to set a context for a request. 43 func NewCreatePurgeScheduleParamsWithContext(ctx context.Context) *CreatePurgeScheduleParams { 44 return &CreatePurgeScheduleParams{ 45 Context: ctx, 46 } 47 } 48 49 // NewCreatePurgeScheduleParamsWithHTTPClient creates a new CreatePurgeScheduleParams object 50 // with the ability to set a custom HTTPClient for a request. 51 func NewCreatePurgeScheduleParamsWithHTTPClient(client *http.Client) *CreatePurgeScheduleParams { 52 return &CreatePurgeScheduleParams{ 53 HTTPClient: client, 54 } 55 } 56 57 /* 58 CreatePurgeScheduleParams contains all the parameters to send to the API endpoint 59 60 for the create purge schedule operation. 61 62 Typically these are written to a http.Request. 63 */ 64 type CreatePurgeScheduleParams 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 create purge schedule params (not the query body). 88 // 89 // All values with no default are reset to their zero value. 90 func (o *CreatePurgeScheduleParams) WithDefaults() *CreatePurgeScheduleParams { 91 o.SetDefaults() 92 return o 93 } 94 95 // SetDefaults hydrates default values in the create purge schedule params (not the query body). 96 // 97 // All values with no default are reset to their zero value. 98 func (o *CreatePurgeScheduleParams) SetDefaults() { 99 // no default values defined for this parameter 100 } 101 102 // WithTimeout adds the timeout to the create purge schedule params 103 func (o *CreatePurgeScheduleParams) WithTimeout(timeout time.Duration) *CreatePurgeScheduleParams { 104 o.SetTimeout(timeout) 105 return o 106 } 107 108 // SetTimeout adds the timeout to the create purge schedule params 109 func (o *CreatePurgeScheduleParams) SetTimeout(timeout time.Duration) { 110 o.timeout = timeout 111 } 112 113 // WithContext adds the context to the create purge schedule params 114 func (o *CreatePurgeScheduleParams) WithContext(ctx context.Context) *CreatePurgeScheduleParams { 115 o.SetContext(ctx) 116 return o 117 } 118 119 // SetContext adds the context to the create purge schedule params 120 func (o *CreatePurgeScheduleParams) SetContext(ctx context.Context) { 121 o.Context = ctx 122 } 123 124 // WithHTTPClient adds the HTTPClient to the create purge schedule params 125 func (o *CreatePurgeScheduleParams) WithHTTPClient(client *http.Client) *CreatePurgeScheduleParams { 126 o.SetHTTPClient(client) 127 return o 128 } 129 130 // SetHTTPClient adds the HTTPClient to the create purge schedule params 131 func (o *CreatePurgeScheduleParams) SetHTTPClient(client *http.Client) { 132 o.HTTPClient = client 133 } 134 135 // WithXRequestID adds the xRequestID to the create purge schedule params 136 func (o *CreatePurgeScheduleParams) WithXRequestID(xRequestID *string) *CreatePurgeScheduleParams { 137 o.SetXRequestID(xRequestID) 138 return o 139 } 140 141 // SetXRequestID adds the xRequestId to the create purge schedule params 142 func (o *CreatePurgeScheduleParams) SetXRequestID(xRequestID *string) { 143 o.XRequestID = xRequestID 144 } 145 146 // WithSchedule adds the schedule to the create purge schedule params 147 func (o *CreatePurgeScheduleParams) WithSchedule(schedule *models.Schedule) *CreatePurgeScheduleParams { 148 o.SetSchedule(schedule) 149 return o 150 } 151 152 // SetSchedule adds the schedule to the create purge schedule params 153 func (o *CreatePurgeScheduleParams) SetSchedule(schedule *models.Schedule) { 154 o.Schedule = schedule 155 } 156 157 // WriteToRequest writes these params to a swagger request 158 func (o *CreatePurgeScheduleParams) 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 }