github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/artifact/copy_artifact_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package artifact 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 19 // NewCopyArtifactParams creates a new CopyArtifactParams object, 20 // with the default timeout for this client. 21 // 22 // Default values are not hydrated, since defaults are normally applied by the API server side. 23 // 24 // To enforce default values in parameter, use SetDefaults or WithDefaults. 25 func NewCopyArtifactParams() *CopyArtifactParams { 26 return &CopyArtifactParams{ 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewCopyArtifactParamsWithTimeout creates a new CopyArtifactParams object 32 // with the ability to set a timeout on a request. 33 func NewCopyArtifactParamsWithTimeout(timeout time.Duration) *CopyArtifactParams { 34 return &CopyArtifactParams{ 35 timeout: timeout, 36 } 37 } 38 39 // NewCopyArtifactParamsWithContext creates a new CopyArtifactParams object 40 // with the ability to set a context for a request. 41 func NewCopyArtifactParamsWithContext(ctx context.Context) *CopyArtifactParams { 42 return &CopyArtifactParams{ 43 Context: ctx, 44 } 45 } 46 47 // NewCopyArtifactParamsWithHTTPClient creates a new CopyArtifactParams object 48 // with the ability to set a custom HTTPClient for a request. 49 func NewCopyArtifactParamsWithHTTPClient(client *http.Client) *CopyArtifactParams { 50 return &CopyArtifactParams{ 51 HTTPClient: client, 52 } 53 } 54 55 /* 56 CopyArtifactParams contains all the parameters to send to the API endpoint 57 58 for the copy artifact operation. 59 60 Typically these are written to a http.Request. 61 */ 62 type CopyArtifactParams struct { 63 64 /* XRequestID. 65 66 An unique ID for the request 67 */ 68 XRequestID *string 69 70 /* From. 71 72 The artifact from which the new artifact is copied from, the format should be "project/repository:tag" or "project/repository@digest". 73 */ 74 From string 75 76 /* ProjectName. 77 78 The name of the project 79 */ 80 ProjectName string 81 82 /* RepositoryName. 83 84 The name of the repository. If it contains slash, encode it twice over with URL encoding. e.g. a/b -> a%2Fb -> a%252Fb 85 */ 86 RepositoryName string 87 88 timeout time.Duration 89 Context context.Context 90 HTTPClient *http.Client 91 } 92 93 // WithDefaults hydrates default values in the copy artifact params (not the query body). 94 // 95 // All values with no default are reset to their zero value. 96 func (o *CopyArtifactParams) WithDefaults() *CopyArtifactParams { 97 o.SetDefaults() 98 return o 99 } 100 101 // SetDefaults hydrates default values in the copy artifact params (not the query body). 102 // 103 // All values with no default are reset to their zero value. 104 func (o *CopyArtifactParams) SetDefaults() { 105 // no default values defined for this parameter 106 } 107 108 // WithTimeout adds the timeout to the copy artifact params 109 func (o *CopyArtifactParams) WithTimeout(timeout time.Duration) *CopyArtifactParams { 110 o.SetTimeout(timeout) 111 return o 112 } 113 114 // SetTimeout adds the timeout to the copy artifact params 115 func (o *CopyArtifactParams) SetTimeout(timeout time.Duration) { 116 o.timeout = timeout 117 } 118 119 // WithContext adds the context to the copy artifact params 120 func (o *CopyArtifactParams) WithContext(ctx context.Context) *CopyArtifactParams { 121 o.SetContext(ctx) 122 return o 123 } 124 125 // SetContext adds the context to the copy artifact params 126 func (o *CopyArtifactParams) SetContext(ctx context.Context) { 127 o.Context = ctx 128 } 129 130 // WithHTTPClient adds the HTTPClient to the copy artifact params 131 func (o *CopyArtifactParams) WithHTTPClient(client *http.Client) *CopyArtifactParams { 132 o.SetHTTPClient(client) 133 return o 134 } 135 136 // SetHTTPClient adds the HTTPClient to the copy artifact params 137 func (o *CopyArtifactParams) SetHTTPClient(client *http.Client) { 138 o.HTTPClient = client 139 } 140 141 // WithXRequestID adds the xRequestID to the copy artifact params 142 func (o *CopyArtifactParams) WithXRequestID(xRequestID *string) *CopyArtifactParams { 143 o.SetXRequestID(xRequestID) 144 return o 145 } 146 147 // SetXRequestID adds the xRequestId to the copy artifact params 148 func (o *CopyArtifactParams) SetXRequestID(xRequestID *string) { 149 o.XRequestID = xRequestID 150 } 151 152 // WithFrom adds the from to the copy artifact params 153 func (o *CopyArtifactParams) WithFrom(from string) *CopyArtifactParams { 154 o.SetFrom(from) 155 return o 156 } 157 158 // SetFrom adds the from to the copy artifact params 159 func (o *CopyArtifactParams) SetFrom(from string) { 160 o.From = from 161 } 162 163 // WithProjectName adds the projectName to the copy artifact params 164 func (o *CopyArtifactParams) WithProjectName(projectName string) *CopyArtifactParams { 165 o.SetProjectName(projectName) 166 return o 167 } 168 169 // SetProjectName adds the projectName to the copy artifact params 170 func (o *CopyArtifactParams) SetProjectName(projectName string) { 171 o.ProjectName = projectName 172 } 173 174 // WithRepositoryName adds the repositoryName to the copy artifact params 175 func (o *CopyArtifactParams) WithRepositoryName(repositoryName string) *CopyArtifactParams { 176 o.SetRepositoryName(repositoryName) 177 return o 178 } 179 180 // SetRepositoryName adds the repositoryName to the copy artifact params 181 func (o *CopyArtifactParams) SetRepositoryName(repositoryName string) { 182 o.RepositoryName = repositoryName 183 } 184 185 // WriteToRequest writes these params to a swagger request 186 func (o *CopyArtifactParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 187 188 if err := r.SetTimeout(o.timeout); err != nil { 189 return err 190 } 191 var res []error 192 193 if o.XRequestID != nil { 194 195 // header param X-Request-Id 196 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 197 return err 198 } 199 } 200 201 // query param from 202 qrFrom := o.From 203 qFrom := qrFrom 204 if qFrom != "" { 205 206 if err := r.SetQueryParam("from", qFrom); err != nil { 207 return err 208 } 209 } 210 211 // path param project_name 212 if err := r.SetPathParam("project_name", o.ProjectName); err != nil { 213 return err 214 } 215 216 // path param repository_name 217 if err := r.SetPathParam("repository_name", o.RepositoryName); err != nil { 218 return err 219 } 220 221 if len(res) > 0 { 222 return errors.CompositeValidationError(res...) 223 } 224 return nil 225 }