github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/project_metadata/add_project_metadatas_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package project_metadata 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 "github.com/go-openapi/swag" 18 ) 19 20 // NewAddProjectMetadatasParams creates a new AddProjectMetadatasParams object, 21 // with the default timeout for this client. 22 // 23 // Default values are not hydrated, since defaults are normally applied by the API server side. 24 // 25 // To enforce default values in parameter, use SetDefaults or WithDefaults. 26 func NewAddProjectMetadatasParams() *AddProjectMetadatasParams { 27 return &AddProjectMetadatasParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewAddProjectMetadatasParamsWithTimeout creates a new AddProjectMetadatasParams object 33 // with the ability to set a timeout on a request. 34 func NewAddProjectMetadatasParamsWithTimeout(timeout time.Duration) *AddProjectMetadatasParams { 35 return &AddProjectMetadatasParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewAddProjectMetadatasParamsWithContext creates a new AddProjectMetadatasParams object 41 // with the ability to set a context for a request. 42 func NewAddProjectMetadatasParamsWithContext(ctx context.Context) *AddProjectMetadatasParams { 43 return &AddProjectMetadatasParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewAddProjectMetadatasParamsWithHTTPClient creates a new AddProjectMetadatasParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewAddProjectMetadatasParamsWithHTTPClient(client *http.Client) *AddProjectMetadatasParams { 51 return &AddProjectMetadatasParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 AddProjectMetadatasParams contains all the parameters to send to the API endpoint 58 59 for the add project metadatas operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type AddProjectMetadatasParams struct { 64 65 /* XIsResourceName. 66 67 The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. 68 */ 69 XIsResourceName *bool 70 71 /* XRequestID. 72 73 An unique ID for the request 74 */ 75 XRequestID *string 76 77 // Metadata. 78 Metadata map[string]string 79 80 /* ProjectNameOrID. 81 82 The name or id of the project 83 */ 84 ProjectNameOrID string 85 86 timeout time.Duration 87 Context context.Context 88 HTTPClient *http.Client 89 } 90 91 // WithDefaults hydrates default values in the add project metadatas params (not the query body). 92 // 93 // All values with no default are reset to their zero value. 94 func (o *AddProjectMetadatasParams) WithDefaults() *AddProjectMetadatasParams { 95 o.SetDefaults() 96 return o 97 } 98 99 // SetDefaults hydrates default values in the add project metadatas params (not the query body). 100 // 101 // All values with no default are reset to their zero value. 102 func (o *AddProjectMetadatasParams) SetDefaults() { 103 var ( 104 xIsResourceNameDefault = bool(false) 105 ) 106 107 val := AddProjectMetadatasParams{ 108 XIsResourceName: &xIsResourceNameDefault, 109 } 110 111 val.timeout = o.timeout 112 val.Context = o.Context 113 val.HTTPClient = o.HTTPClient 114 *o = val 115 } 116 117 // WithTimeout adds the timeout to the add project metadatas params 118 func (o *AddProjectMetadatasParams) WithTimeout(timeout time.Duration) *AddProjectMetadatasParams { 119 o.SetTimeout(timeout) 120 return o 121 } 122 123 // SetTimeout adds the timeout to the add project metadatas params 124 func (o *AddProjectMetadatasParams) SetTimeout(timeout time.Duration) { 125 o.timeout = timeout 126 } 127 128 // WithContext adds the context to the add project metadatas params 129 func (o *AddProjectMetadatasParams) WithContext(ctx context.Context) *AddProjectMetadatasParams { 130 o.SetContext(ctx) 131 return o 132 } 133 134 // SetContext adds the context to the add project metadatas params 135 func (o *AddProjectMetadatasParams) SetContext(ctx context.Context) { 136 o.Context = ctx 137 } 138 139 // WithHTTPClient adds the HTTPClient to the add project metadatas params 140 func (o *AddProjectMetadatasParams) WithHTTPClient(client *http.Client) *AddProjectMetadatasParams { 141 o.SetHTTPClient(client) 142 return o 143 } 144 145 // SetHTTPClient adds the HTTPClient to the add project metadatas params 146 func (o *AddProjectMetadatasParams) SetHTTPClient(client *http.Client) { 147 o.HTTPClient = client 148 } 149 150 // WithXIsResourceName adds the xIsResourceName to the add project metadatas params 151 func (o *AddProjectMetadatasParams) WithXIsResourceName(xIsResourceName *bool) *AddProjectMetadatasParams { 152 o.SetXIsResourceName(xIsResourceName) 153 return o 154 } 155 156 // SetXIsResourceName adds the xIsResourceName to the add project metadatas params 157 func (o *AddProjectMetadatasParams) SetXIsResourceName(xIsResourceName *bool) { 158 o.XIsResourceName = xIsResourceName 159 } 160 161 // WithXRequestID adds the xRequestID to the add project metadatas params 162 func (o *AddProjectMetadatasParams) WithXRequestID(xRequestID *string) *AddProjectMetadatasParams { 163 o.SetXRequestID(xRequestID) 164 return o 165 } 166 167 // SetXRequestID adds the xRequestId to the add project metadatas params 168 func (o *AddProjectMetadatasParams) SetXRequestID(xRequestID *string) { 169 o.XRequestID = xRequestID 170 } 171 172 // WithMetadata adds the metadata to the add project metadatas params 173 func (o *AddProjectMetadatasParams) WithMetadata(metadata map[string]string) *AddProjectMetadatasParams { 174 o.SetMetadata(metadata) 175 return o 176 } 177 178 // SetMetadata adds the metadata to the add project metadatas params 179 func (o *AddProjectMetadatasParams) SetMetadata(metadata map[string]string) { 180 o.Metadata = metadata 181 } 182 183 // WithProjectNameOrID adds the projectNameOrID to the add project metadatas params 184 func (o *AddProjectMetadatasParams) WithProjectNameOrID(projectNameOrID string) *AddProjectMetadatasParams { 185 o.SetProjectNameOrID(projectNameOrID) 186 return o 187 } 188 189 // SetProjectNameOrID adds the projectNameOrId to the add project metadatas params 190 func (o *AddProjectMetadatasParams) SetProjectNameOrID(projectNameOrID string) { 191 o.ProjectNameOrID = projectNameOrID 192 } 193 194 // WriteToRequest writes these params to a swagger request 195 func (o *AddProjectMetadatasParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 196 197 if err := r.SetTimeout(o.timeout); err != nil { 198 return err 199 } 200 var res []error 201 202 if o.XIsResourceName != nil { 203 204 // header param X-Is-Resource-Name 205 if err := r.SetHeaderParam("X-Is-Resource-Name", swag.FormatBool(*o.XIsResourceName)); err != nil { 206 return err 207 } 208 } 209 210 if o.XRequestID != nil { 211 212 // header param X-Request-Id 213 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 214 return err 215 } 216 } 217 if o.Metadata != nil { 218 if err := r.SetBodyParam(o.Metadata); err != nil { 219 return err 220 } 221 } 222 223 // path param project_name_or_id 224 if err := r.SetPathParam("project_name_or_id", o.ProjectNameOrID); err != nil { 225 return err 226 } 227 228 if len(res) > 0 { 229 return errors.CompositeValidationError(res...) 230 } 231 return nil 232 }