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