github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/securityhub/get_security_summary_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package securityhub 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 // NewGetSecuritySummaryParams creates a new GetSecuritySummaryParams 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 NewGetSecuritySummaryParams() *GetSecuritySummaryParams { 27 return &GetSecuritySummaryParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewGetSecuritySummaryParamsWithTimeout creates a new GetSecuritySummaryParams object 33 // with the ability to set a timeout on a request. 34 func NewGetSecuritySummaryParamsWithTimeout(timeout time.Duration) *GetSecuritySummaryParams { 35 return &GetSecuritySummaryParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewGetSecuritySummaryParamsWithContext creates a new GetSecuritySummaryParams object 41 // with the ability to set a context for a request. 42 func NewGetSecuritySummaryParamsWithContext(ctx context.Context) *GetSecuritySummaryParams { 43 return &GetSecuritySummaryParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewGetSecuritySummaryParamsWithHTTPClient creates a new GetSecuritySummaryParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewGetSecuritySummaryParamsWithHTTPClient(client *http.Client) *GetSecuritySummaryParams { 51 return &GetSecuritySummaryParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 GetSecuritySummaryParams contains all the parameters to send to the API endpoint 58 59 for the get security summary operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type GetSecuritySummaryParams struct { 64 65 /* XRequestID. 66 67 An unique ID for the request 68 */ 69 XRequestID *string 70 71 /* WithDangerousArtifact. 72 73 Specify whether the dangerous Artifact are included inside summary information 74 */ 75 WithDangerousArtifact *bool 76 77 /* WithDangerousCVE. 78 79 Specify whether the dangerous CVEs are included inside summary information 80 */ 81 WithDangerousCVE *bool 82 83 timeout time.Duration 84 Context context.Context 85 HTTPClient *http.Client 86 } 87 88 // WithDefaults hydrates default values in the get security summary params (not the query body). 89 // 90 // All values with no default are reset to their zero value. 91 func (o *GetSecuritySummaryParams) WithDefaults() *GetSecuritySummaryParams { 92 o.SetDefaults() 93 return o 94 } 95 96 // SetDefaults hydrates default values in the get security summary params (not the query body). 97 // 98 // All values with no default are reset to their zero value. 99 func (o *GetSecuritySummaryParams) SetDefaults() { 100 var ( 101 withDangerousArtifactDefault = bool(false) 102 103 withDangerousCVEDefault = bool(false) 104 ) 105 106 val := GetSecuritySummaryParams{ 107 WithDangerousArtifact: &withDangerousArtifactDefault, 108 WithDangerousCVE: &withDangerousCVEDefault, 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 get security summary params 118 func (o *GetSecuritySummaryParams) WithTimeout(timeout time.Duration) *GetSecuritySummaryParams { 119 o.SetTimeout(timeout) 120 return o 121 } 122 123 // SetTimeout adds the timeout to the get security summary params 124 func (o *GetSecuritySummaryParams) SetTimeout(timeout time.Duration) { 125 o.timeout = timeout 126 } 127 128 // WithContext adds the context to the get security summary params 129 func (o *GetSecuritySummaryParams) WithContext(ctx context.Context) *GetSecuritySummaryParams { 130 o.SetContext(ctx) 131 return o 132 } 133 134 // SetContext adds the context to the get security summary params 135 func (o *GetSecuritySummaryParams) SetContext(ctx context.Context) { 136 o.Context = ctx 137 } 138 139 // WithHTTPClient adds the HTTPClient to the get security summary params 140 func (o *GetSecuritySummaryParams) WithHTTPClient(client *http.Client) *GetSecuritySummaryParams { 141 o.SetHTTPClient(client) 142 return o 143 } 144 145 // SetHTTPClient adds the HTTPClient to the get security summary params 146 func (o *GetSecuritySummaryParams) SetHTTPClient(client *http.Client) { 147 o.HTTPClient = client 148 } 149 150 // WithXRequestID adds the xRequestID to the get security summary params 151 func (o *GetSecuritySummaryParams) WithXRequestID(xRequestID *string) *GetSecuritySummaryParams { 152 o.SetXRequestID(xRequestID) 153 return o 154 } 155 156 // SetXRequestID adds the xRequestId to the get security summary params 157 func (o *GetSecuritySummaryParams) SetXRequestID(xRequestID *string) { 158 o.XRequestID = xRequestID 159 } 160 161 // WithWithDangerousArtifact adds the withDangerousArtifact to the get security summary params 162 func (o *GetSecuritySummaryParams) WithWithDangerousArtifact(withDangerousArtifact *bool) *GetSecuritySummaryParams { 163 o.SetWithDangerousArtifact(withDangerousArtifact) 164 return o 165 } 166 167 // SetWithDangerousArtifact adds the withDangerousArtifact to the get security summary params 168 func (o *GetSecuritySummaryParams) SetWithDangerousArtifact(withDangerousArtifact *bool) { 169 o.WithDangerousArtifact = withDangerousArtifact 170 } 171 172 // WithWithDangerousCVE adds the withDangerousCVE to the get security summary params 173 func (o *GetSecuritySummaryParams) WithWithDangerousCVE(withDangerousCVE *bool) *GetSecuritySummaryParams { 174 o.SetWithDangerousCVE(withDangerousCVE) 175 return o 176 } 177 178 // SetWithDangerousCVE adds the withDangerousCve to the get security summary params 179 func (o *GetSecuritySummaryParams) SetWithDangerousCVE(withDangerousCVE *bool) { 180 o.WithDangerousCVE = withDangerousCVE 181 } 182 183 // WriteToRequest writes these params to a swagger request 184 func (o *GetSecuritySummaryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 185 186 if err := r.SetTimeout(o.timeout); err != nil { 187 return err 188 } 189 var res []error 190 191 if o.XRequestID != nil { 192 193 // header param X-Request-Id 194 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 195 return err 196 } 197 } 198 199 if o.WithDangerousArtifact != nil { 200 201 // query param with_dangerous_artifact 202 var qrWithDangerousArtifact bool 203 204 if o.WithDangerousArtifact != nil { 205 qrWithDangerousArtifact = *o.WithDangerousArtifact 206 } 207 qWithDangerousArtifact := swag.FormatBool(qrWithDangerousArtifact) 208 if qWithDangerousArtifact != "" { 209 210 if err := r.SetQueryParam("with_dangerous_artifact", qWithDangerousArtifact); err != nil { 211 return err 212 } 213 } 214 } 215 216 if o.WithDangerousCVE != nil { 217 218 // query param with_dangerous_cve 219 var qrWithDangerousCVE bool 220 221 if o.WithDangerousCVE != nil { 222 qrWithDangerousCVE = *o.WithDangerousCVE 223 } 224 qWithDangerousCVE := swag.FormatBool(qrWithDangerousCVE) 225 if qWithDangerousCVE != "" { 226 227 if err := r.SetQueryParam("with_dangerous_cve", qWithDangerousCVE); err != nil { 228 return err 229 } 230 } 231 } 232 233 if len(res) > 0 { 234 return errors.CompositeValidationError(res...) 235 } 236 return nil 237 }