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