github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/scan/scan_artifact_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package scan 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 // NewScanArtifactParams creates a new ScanArtifactParams 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 NewScanArtifactParams() *ScanArtifactParams { 26 return &ScanArtifactParams{ 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewScanArtifactParamsWithTimeout creates a new ScanArtifactParams object 32 // with the ability to set a timeout on a request. 33 func NewScanArtifactParamsWithTimeout(timeout time.Duration) *ScanArtifactParams { 34 return &ScanArtifactParams{ 35 timeout: timeout, 36 } 37 } 38 39 // NewScanArtifactParamsWithContext creates a new ScanArtifactParams object 40 // with the ability to set a context for a request. 41 func NewScanArtifactParamsWithContext(ctx context.Context) *ScanArtifactParams { 42 return &ScanArtifactParams{ 43 Context: ctx, 44 } 45 } 46 47 // NewScanArtifactParamsWithHTTPClient creates a new ScanArtifactParams object 48 // with the ability to set a custom HTTPClient for a request. 49 func NewScanArtifactParamsWithHTTPClient(client *http.Client) *ScanArtifactParams { 50 return &ScanArtifactParams{ 51 HTTPClient: client, 52 } 53 } 54 55 /* 56 ScanArtifactParams contains all the parameters to send to the API endpoint 57 58 for the scan artifact operation. 59 60 Typically these are written to a http.Request. 61 */ 62 type ScanArtifactParams struct { 63 64 /* XRequestID. 65 66 An unique ID for the request 67 */ 68 XRequestID *string 69 70 /* ProjectName. 71 72 The name of the project 73 */ 74 ProjectName string 75 76 /* Reference. 77 78 The reference of the artifact, can be digest or tag 79 */ 80 Reference 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 scan artifact params (not the query body). 94 // 95 // All values with no default are reset to their zero value. 96 func (o *ScanArtifactParams) WithDefaults() *ScanArtifactParams { 97 o.SetDefaults() 98 return o 99 } 100 101 // SetDefaults hydrates default values in the scan artifact params (not the query body). 102 // 103 // All values with no default are reset to their zero value. 104 func (o *ScanArtifactParams) SetDefaults() { 105 // no default values defined for this parameter 106 } 107 108 // WithTimeout adds the timeout to the scan artifact params 109 func (o *ScanArtifactParams) WithTimeout(timeout time.Duration) *ScanArtifactParams { 110 o.SetTimeout(timeout) 111 return o 112 } 113 114 // SetTimeout adds the timeout to the scan artifact params 115 func (o *ScanArtifactParams) SetTimeout(timeout time.Duration) { 116 o.timeout = timeout 117 } 118 119 // WithContext adds the context to the scan artifact params 120 func (o *ScanArtifactParams) WithContext(ctx context.Context) *ScanArtifactParams { 121 o.SetContext(ctx) 122 return o 123 } 124 125 // SetContext adds the context to the scan artifact params 126 func (o *ScanArtifactParams) SetContext(ctx context.Context) { 127 o.Context = ctx 128 } 129 130 // WithHTTPClient adds the HTTPClient to the scan artifact params 131 func (o *ScanArtifactParams) WithHTTPClient(client *http.Client) *ScanArtifactParams { 132 o.SetHTTPClient(client) 133 return o 134 } 135 136 // SetHTTPClient adds the HTTPClient to the scan artifact params 137 func (o *ScanArtifactParams) SetHTTPClient(client *http.Client) { 138 o.HTTPClient = client 139 } 140 141 // WithXRequestID adds the xRequestID to the scan artifact params 142 func (o *ScanArtifactParams) WithXRequestID(xRequestID *string) *ScanArtifactParams { 143 o.SetXRequestID(xRequestID) 144 return o 145 } 146 147 // SetXRequestID adds the xRequestId to the scan artifact params 148 func (o *ScanArtifactParams) SetXRequestID(xRequestID *string) { 149 o.XRequestID = xRequestID 150 } 151 152 // WithProjectName adds the projectName to the scan artifact params 153 func (o *ScanArtifactParams) WithProjectName(projectName string) *ScanArtifactParams { 154 o.SetProjectName(projectName) 155 return o 156 } 157 158 // SetProjectName adds the projectName to the scan artifact params 159 func (o *ScanArtifactParams) SetProjectName(projectName string) { 160 o.ProjectName = projectName 161 } 162 163 // WithReference adds the reference to the scan artifact params 164 func (o *ScanArtifactParams) WithReference(reference string) *ScanArtifactParams { 165 o.SetReference(reference) 166 return o 167 } 168 169 // SetReference adds the reference to the scan artifact params 170 func (o *ScanArtifactParams) SetReference(reference string) { 171 o.Reference = reference 172 } 173 174 // WithRepositoryName adds the repositoryName to the scan artifact params 175 func (o *ScanArtifactParams) WithRepositoryName(repositoryName string) *ScanArtifactParams { 176 o.SetRepositoryName(repositoryName) 177 return o 178 } 179 180 // SetRepositoryName adds the repositoryName to the scan artifact params 181 func (o *ScanArtifactParams) SetRepositoryName(repositoryName string) { 182 o.RepositoryName = repositoryName 183 } 184 185 // WriteToRequest writes these params to a swagger request 186 func (o *ScanArtifactParams) 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 // path param project_name 202 if err := r.SetPathParam("project_name", o.ProjectName); err != nil { 203 return err 204 } 205 206 // path param reference 207 if err := r.SetPathParam("reference", o.Reference); err != nil { 208 return err 209 } 210 211 // path param repository_name 212 if err := r.SetPathParam("repository_name", o.RepositoryName); err != nil { 213 return err 214 } 215 216 if len(res) > 0 { 217 return errors.CompositeValidationError(res...) 218 } 219 return nil 220 }