github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/scanner/set_scanner_as_default_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package scanner 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 // NewSetScannerAsDefaultParams creates a new SetScannerAsDefaultParams 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 NewSetScannerAsDefaultParams() *SetScannerAsDefaultParams { 28 return &SetScannerAsDefaultParams{ 29 timeout: cr.DefaultTimeout, 30 } 31 } 32 33 // NewSetScannerAsDefaultParamsWithTimeout creates a new SetScannerAsDefaultParams object 34 // with the ability to set a timeout on a request. 35 func NewSetScannerAsDefaultParamsWithTimeout(timeout time.Duration) *SetScannerAsDefaultParams { 36 return &SetScannerAsDefaultParams{ 37 timeout: timeout, 38 } 39 } 40 41 // NewSetScannerAsDefaultParamsWithContext creates a new SetScannerAsDefaultParams object 42 // with the ability to set a context for a request. 43 func NewSetScannerAsDefaultParamsWithContext(ctx context.Context) *SetScannerAsDefaultParams { 44 return &SetScannerAsDefaultParams{ 45 Context: ctx, 46 } 47 } 48 49 // NewSetScannerAsDefaultParamsWithHTTPClient creates a new SetScannerAsDefaultParams object 50 // with the ability to set a custom HTTPClient for a request. 51 func NewSetScannerAsDefaultParamsWithHTTPClient(client *http.Client) *SetScannerAsDefaultParams { 52 return &SetScannerAsDefaultParams{ 53 HTTPClient: client, 54 } 55 } 56 57 /* 58 SetScannerAsDefaultParams contains all the parameters to send to the API endpoint 59 60 for the set scanner as default operation. 61 62 Typically these are written to a http.Request. 63 */ 64 type SetScannerAsDefaultParams struct { 65 66 /* XRequestID. 67 68 An unique ID for the request 69 */ 70 XRequestID *string 71 72 // Payload. 73 Payload *models.IsDefault 74 75 /* RegistrationID. 76 77 The scanner registration identifier. 78 */ 79 RegistrationID string 80 81 timeout time.Duration 82 Context context.Context 83 HTTPClient *http.Client 84 } 85 86 // WithDefaults hydrates default values in the set scanner as default params (not the query body). 87 // 88 // All values with no default are reset to their zero value. 89 func (o *SetScannerAsDefaultParams) WithDefaults() *SetScannerAsDefaultParams { 90 o.SetDefaults() 91 return o 92 } 93 94 // SetDefaults hydrates default values in the set scanner as default params (not the query body). 95 // 96 // All values with no default are reset to their zero value. 97 func (o *SetScannerAsDefaultParams) SetDefaults() { 98 // no default values defined for this parameter 99 } 100 101 // WithTimeout adds the timeout to the set scanner as default params 102 func (o *SetScannerAsDefaultParams) WithTimeout(timeout time.Duration) *SetScannerAsDefaultParams { 103 o.SetTimeout(timeout) 104 return o 105 } 106 107 // SetTimeout adds the timeout to the set scanner as default params 108 func (o *SetScannerAsDefaultParams) SetTimeout(timeout time.Duration) { 109 o.timeout = timeout 110 } 111 112 // WithContext adds the context to the set scanner as default params 113 func (o *SetScannerAsDefaultParams) WithContext(ctx context.Context) *SetScannerAsDefaultParams { 114 o.SetContext(ctx) 115 return o 116 } 117 118 // SetContext adds the context to the set scanner as default params 119 func (o *SetScannerAsDefaultParams) SetContext(ctx context.Context) { 120 o.Context = ctx 121 } 122 123 // WithHTTPClient adds the HTTPClient to the set scanner as default params 124 func (o *SetScannerAsDefaultParams) WithHTTPClient(client *http.Client) *SetScannerAsDefaultParams { 125 o.SetHTTPClient(client) 126 return o 127 } 128 129 // SetHTTPClient adds the HTTPClient to the set scanner as default params 130 func (o *SetScannerAsDefaultParams) SetHTTPClient(client *http.Client) { 131 o.HTTPClient = client 132 } 133 134 // WithXRequestID adds the xRequestID to the set scanner as default params 135 func (o *SetScannerAsDefaultParams) WithXRequestID(xRequestID *string) *SetScannerAsDefaultParams { 136 o.SetXRequestID(xRequestID) 137 return o 138 } 139 140 // SetXRequestID adds the xRequestId to the set scanner as default params 141 func (o *SetScannerAsDefaultParams) SetXRequestID(xRequestID *string) { 142 o.XRequestID = xRequestID 143 } 144 145 // WithPayload adds the payload to the set scanner as default params 146 func (o *SetScannerAsDefaultParams) WithPayload(payload *models.IsDefault) *SetScannerAsDefaultParams { 147 o.SetPayload(payload) 148 return o 149 } 150 151 // SetPayload adds the payload to the set scanner as default params 152 func (o *SetScannerAsDefaultParams) SetPayload(payload *models.IsDefault) { 153 o.Payload = payload 154 } 155 156 // WithRegistrationID adds the registrationID to the set scanner as default params 157 func (o *SetScannerAsDefaultParams) WithRegistrationID(registrationID string) *SetScannerAsDefaultParams { 158 o.SetRegistrationID(registrationID) 159 return o 160 } 161 162 // SetRegistrationID adds the registrationId to the set scanner as default params 163 func (o *SetScannerAsDefaultParams) SetRegistrationID(registrationID string) { 164 o.RegistrationID = registrationID 165 } 166 167 // WriteToRequest writes these params to a swagger request 168 func (o *SetScannerAsDefaultParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 169 170 if err := r.SetTimeout(o.timeout); err != nil { 171 return err 172 } 173 var res []error 174 175 if o.XRequestID != nil { 176 177 // header param X-Request-Id 178 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 179 return err 180 } 181 } 182 if o.Payload != nil { 183 if err := r.SetBodyParam(o.Payload); err != nil { 184 return err 185 } 186 } 187 188 // path param registration_id 189 if err := r.SetPathParam("registration_id", o.RegistrationID); err != nil { 190 return err 191 } 192 193 if len(res) > 0 { 194 return errors.CompositeValidationError(res...) 195 } 196 return nil 197 }