github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/preheat/update_policy_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package preheat 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 // NewUpdatePolicyParams creates a new UpdatePolicyParams 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 NewUpdatePolicyParams() *UpdatePolicyParams { 28 return &UpdatePolicyParams{ 29 timeout: cr.DefaultTimeout, 30 } 31 } 32 33 // NewUpdatePolicyParamsWithTimeout creates a new UpdatePolicyParams object 34 // with the ability to set a timeout on a request. 35 func NewUpdatePolicyParamsWithTimeout(timeout time.Duration) *UpdatePolicyParams { 36 return &UpdatePolicyParams{ 37 timeout: timeout, 38 } 39 } 40 41 // NewUpdatePolicyParamsWithContext creates a new UpdatePolicyParams object 42 // with the ability to set a context for a request. 43 func NewUpdatePolicyParamsWithContext(ctx context.Context) *UpdatePolicyParams { 44 return &UpdatePolicyParams{ 45 Context: ctx, 46 } 47 } 48 49 // NewUpdatePolicyParamsWithHTTPClient creates a new UpdatePolicyParams object 50 // with the ability to set a custom HTTPClient for a request. 51 func NewUpdatePolicyParamsWithHTTPClient(client *http.Client) *UpdatePolicyParams { 52 return &UpdatePolicyParams{ 53 HTTPClient: client, 54 } 55 } 56 57 /* 58 UpdatePolicyParams contains all the parameters to send to the API endpoint 59 60 for the update policy operation. 61 62 Typically these are written to a http.Request. 63 */ 64 type UpdatePolicyParams struct { 65 66 /* XRequestID. 67 68 An unique ID for the request 69 */ 70 XRequestID *string 71 72 /* Policy. 73 74 The policy schema info 75 */ 76 Policy *models.PreheatPolicy 77 78 /* PreheatPolicyName. 79 80 Preheat Policy Name 81 */ 82 PreheatPolicyName string 83 84 /* ProjectName. 85 86 The name of the project 87 */ 88 ProjectName string 89 90 timeout time.Duration 91 Context context.Context 92 HTTPClient *http.Client 93 } 94 95 // WithDefaults hydrates default values in the update policy params (not the query body). 96 // 97 // All values with no default are reset to their zero value. 98 func (o *UpdatePolicyParams) WithDefaults() *UpdatePolicyParams { 99 o.SetDefaults() 100 return o 101 } 102 103 // SetDefaults hydrates default values in the update policy params (not the query body). 104 // 105 // All values with no default are reset to their zero value. 106 func (o *UpdatePolicyParams) SetDefaults() { 107 // no default values defined for this parameter 108 } 109 110 // WithTimeout adds the timeout to the update policy params 111 func (o *UpdatePolicyParams) WithTimeout(timeout time.Duration) *UpdatePolicyParams { 112 o.SetTimeout(timeout) 113 return o 114 } 115 116 // SetTimeout adds the timeout to the update policy params 117 func (o *UpdatePolicyParams) SetTimeout(timeout time.Duration) { 118 o.timeout = timeout 119 } 120 121 // WithContext adds the context to the update policy params 122 func (o *UpdatePolicyParams) WithContext(ctx context.Context) *UpdatePolicyParams { 123 o.SetContext(ctx) 124 return o 125 } 126 127 // SetContext adds the context to the update policy params 128 func (o *UpdatePolicyParams) SetContext(ctx context.Context) { 129 o.Context = ctx 130 } 131 132 // WithHTTPClient adds the HTTPClient to the update policy params 133 func (o *UpdatePolicyParams) WithHTTPClient(client *http.Client) *UpdatePolicyParams { 134 o.SetHTTPClient(client) 135 return o 136 } 137 138 // SetHTTPClient adds the HTTPClient to the update policy params 139 func (o *UpdatePolicyParams) SetHTTPClient(client *http.Client) { 140 o.HTTPClient = client 141 } 142 143 // WithXRequestID adds the xRequestID to the update policy params 144 func (o *UpdatePolicyParams) WithXRequestID(xRequestID *string) *UpdatePolicyParams { 145 o.SetXRequestID(xRequestID) 146 return o 147 } 148 149 // SetXRequestID adds the xRequestId to the update policy params 150 func (o *UpdatePolicyParams) SetXRequestID(xRequestID *string) { 151 o.XRequestID = xRequestID 152 } 153 154 // WithPolicy adds the policy to the update policy params 155 func (o *UpdatePolicyParams) WithPolicy(policy *models.PreheatPolicy) *UpdatePolicyParams { 156 o.SetPolicy(policy) 157 return o 158 } 159 160 // SetPolicy adds the policy to the update policy params 161 func (o *UpdatePolicyParams) SetPolicy(policy *models.PreheatPolicy) { 162 o.Policy = policy 163 } 164 165 // WithPreheatPolicyName adds the preheatPolicyName to the update policy params 166 func (o *UpdatePolicyParams) WithPreheatPolicyName(preheatPolicyName string) *UpdatePolicyParams { 167 o.SetPreheatPolicyName(preheatPolicyName) 168 return o 169 } 170 171 // SetPreheatPolicyName adds the preheatPolicyName to the update policy params 172 func (o *UpdatePolicyParams) SetPreheatPolicyName(preheatPolicyName string) { 173 o.PreheatPolicyName = preheatPolicyName 174 } 175 176 // WithProjectName adds the projectName to the update policy params 177 func (o *UpdatePolicyParams) WithProjectName(projectName string) *UpdatePolicyParams { 178 o.SetProjectName(projectName) 179 return o 180 } 181 182 // SetProjectName adds the projectName to the update policy params 183 func (o *UpdatePolicyParams) SetProjectName(projectName string) { 184 o.ProjectName = projectName 185 } 186 187 // WriteToRequest writes these params to a swagger request 188 func (o *UpdatePolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 189 190 if err := r.SetTimeout(o.timeout); err != nil { 191 return err 192 } 193 var res []error 194 195 if o.XRequestID != nil { 196 197 // header param X-Request-Id 198 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 199 return err 200 } 201 } 202 if o.Policy != nil { 203 if err := r.SetBodyParam(o.Policy); err != nil { 204 return err 205 } 206 } 207 208 // path param preheat_policy_name 209 if err := r.SetPathParam("preheat_policy_name", o.PreheatPolicyName); err != nil { 210 return err 211 } 212 213 // path param project_name 214 if err := r.SetPathParam("project_name", o.ProjectName); err != nil { 215 return err 216 } 217 218 if len(res) > 0 { 219 return errors.CompositeValidationError(res...) 220 } 221 return nil 222 }