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