github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/repository/get_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 19 // NewGetRepositoryParams creates a new GetRepositoryParams 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 NewGetRepositoryParams() *GetRepositoryParams { 26 return &GetRepositoryParams{ 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewGetRepositoryParamsWithTimeout creates a new GetRepositoryParams object 32 // with the ability to set a timeout on a request. 33 func NewGetRepositoryParamsWithTimeout(timeout time.Duration) *GetRepositoryParams { 34 return &GetRepositoryParams{ 35 timeout: timeout, 36 } 37 } 38 39 // NewGetRepositoryParamsWithContext creates a new GetRepositoryParams object 40 // with the ability to set a context for a request. 41 func NewGetRepositoryParamsWithContext(ctx context.Context) *GetRepositoryParams { 42 return &GetRepositoryParams{ 43 Context: ctx, 44 } 45 } 46 47 // NewGetRepositoryParamsWithHTTPClient creates a new GetRepositoryParams object 48 // with the ability to set a custom HTTPClient for a request. 49 func NewGetRepositoryParamsWithHTTPClient(client *http.Client) *GetRepositoryParams { 50 return &GetRepositoryParams{ 51 HTTPClient: client, 52 } 53 } 54 55 /* 56 GetRepositoryParams contains all the parameters to send to the API endpoint 57 58 for the get repository operation. 59 60 Typically these are written to a http.Request. 61 */ 62 type GetRepositoryParams 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 /* RepositoryName. 77 78 The name of the repository. If it contains slash, encode it twice over with URL encoding. e.g. a/b -> a%2Fb -> a%252Fb 79 */ 80 RepositoryName string 81 82 timeout time.Duration 83 Context context.Context 84 HTTPClient *http.Client 85 } 86 87 // WithDefaults hydrates default values in the get repository params (not the query body). 88 // 89 // All values with no default are reset to their zero value. 90 func (o *GetRepositoryParams) WithDefaults() *GetRepositoryParams { 91 o.SetDefaults() 92 return o 93 } 94 95 // SetDefaults hydrates default values in the get repository params (not the query body). 96 // 97 // All values with no default are reset to their zero value. 98 func (o *GetRepositoryParams) SetDefaults() { 99 // no default values defined for this parameter 100 } 101 102 // WithTimeout adds the timeout to the get repository params 103 func (o *GetRepositoryParams) WithTimeout(timeout time.Duration) *GetRepositoryParams { 104 o.SetTimeout(timeout) 105 return o 106 } 107 108 // SetTimeout adds the timeout to the get repository params 109 func (o *GetRepositoryParams) SetTimeout(timeout time.Duration) { 110 o.timeout = timeout 111 } 112 113 // WithContext adds the context to the get repository params 114 func (o *GetRepositoryParams) WithContext(ctx context.Context) *GetRepositoryParams { 115 o.SetContext(ctx) 116 return o 117 } 118 119 // SetContext adds the context to the get repository params 120 func (o *GetRepositoryParams) SetContext(ctx context.Context) { 121 o.Context = ctx 122 } 123 124 // WithHTTPClient adds the HTTPClient to the get repository params 125 func (o *GetRepositoryParams) WithHTTPClient(client *http.Client) *GetRepositoryParams { 126 o.SetHTTPClient(client) 127 return o 128 } 129 130 // SetHTTPClient adds the HTTPClient to the get repository params 131 func (o *GetRepositoryParams) SetHTTPClient(client *http.Client) { 132 o.HTTPClient = client 133 } 134 135 // WithXRequestID adds the xRequestID to the get repository params 136 func (o *GetRepositoryParams) WithXRequestID(xRequestID *string) *GetRepositoryParams { 137 o.SetXRequestID(xRequestID) 138 return o 139 } 140 141 // SetXRequestID adds the xRequestId to the get repository params 142 func (o *GetRepositoryParams) SetXRequestID(xRequestID *string) { 143 o.XRequestID = xRequestID 144 } 145 146 // WithProjectName adds the projectName to the get repository params 147 func (o *GetRepositoryParams) WithProjectName(projectName string) *GetRepositoryParams { 148 o.SetProjectName(projectName) 149 return o 150 } 151 152 // SetProjectName adds the projectName to the get repository params 153 func (o *GetRepositoryParams) SetProjectName(projectName string) { 154 o.ProjectName = projectName 155 } 156 157 // WithRepositoryName adds the repositoryName to the get repository params 158 func (o *GetRepositoryParams) WithRepositoryName(repositoryName string) *GetRepositoryParams { 159 o.SetRepositoryName(repositoryName) 160 return o 161 } 162 163 // SetRepositoryName adds the repositoryName to the get repository params 164 func (o *GetRepositoryParams) SetRepositoryName(repositoryName string) { 165 o.RepositoryName = repositoryName 166 } 167 168 // WriteToRequest writes these params to a swagger request 169 func (o *GetRepositoryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 170 171 if err := r.SetTimeout(o.timeout); err != nil { 172 return err 173 } 174 var res []error 175 176 if o.XRequestID != nil { 177 178 // header param X-Request-Id 179 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 180 return err 181 } 182 } 183 184 // path param project_name 185 if err := r.SetPathParam("project_name", o.ProjectName); err != nil { 186 return err 187 } 188 189 // path param repository_name 190 if err := r.SetPathParam("repository_name", o.RepositoryName); err != nil { 191 return err 192 } 193 194 if len(res) > 0 { 195 return errors.CompositeValidationError(res...) 196 } 197 return nil 198 }