github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/secrets/secrets_client/authentication/get_whoami_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package authentication 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 "net/http" 10 "time" 11 12 "golang.org/x/net/context" 13 14 "github.com/go-openapi/errors" 15 "github.com/go-openapi/runtime" 16 cr "github.com/go-openapi/runtime/client" 17 18 strfmt "github.com/go-openapi/strfmt" 19 ) 20 21 // NewGetWhoamiParams creates a new GetWhoamiParams object 22 // with the default values initialized. 23 func NewGetWhoamiParams() *GetWhoamiParams { 24 25 return &GetWhoamiParams{ 26 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewGetWhoamiParamsWithTimeout creates a new GetWhoamiParams object 32 // with the default values initialized, and the ability to set a timeout on a request 33 func NewGetWhoamiParamsWithTimeout(timeout time.Duration) *GetWhoamiParams { 34 35 return &GetWhoamiParams{ 36 37 timeout: timeout, 38 } 39 } 40 41 // NewGetWhoamiParamsWithContext creates a new GetWhoamiParams object 42 // with the default values initialized, and the ability to set a context for a request 43 func NewGetWhoamiParamsWithContext(ctx context.Context) *GetWhoamiParams { 44 45 return &GetWhoamiParams{ 46 47 Context: ctx, 48 } 49 } 50 51 // NewGetWhoamiParamsWithHTTPClient creates a new GetWhoamiParams object 52 // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 func NewGetWhoamiParamsWithHTTPClient(client *http.Client) *GetWhoamiParams { 54 55 return &GetWhoamiParams{ 56 HTTPClient: client, 57 } 58 } 59 60 /*GetWhoamiParams contains all the parameters to send to the API endpoint 61 for the get whoami operation typically these are written to a http.Request 62 */ 63 type GetWhoamiParams struct { 64 timeout time.Duration 65 Context context.Context 66 HTTPClient *http.Client 67 } 68 69 // WithTimeout adds the timeout to the get whoami params 70 func (o *GetWhoamiParams) WithTimeout(timeout time.Duration) *GetWhoamiParams { 71 o.SetTimeout(timeout) 72 return o 73 } 74 75 // SetTimeout adds the timeout to the get whoami params 76 func (o *GetWhoamiParams) SetTimeout(timeout time.Duration) { 77 o.timeout = timeout 78 } 79 80 // WithContext adds the context to the get whoami params 81 func (o *GetWhoamiParams) WithContext(ctx context.Context) *GetWhoamiParams { 82 o.SetContext(ctx) 83 return o 84 } 85 86 // SetContext adds the context to the get whoami params 87 func (o *GetWhoamiParams) SetContext(ctx context.Context) { 88 o.Context = ctx 89 } 90 91 // WithHTTPClient adds the HTTPClient to the get whoami params 92 func (o *GetWhoamiParams) WithHTTPClient(client *http.Client) *GetWhoamiParams { 93 o.SetHTTPClient(client) 94 return o 95 } 96 97 // SetHTTPClient adds the HTTPClient to the get whoami params 98 func (o *GetWhoamiParams) SetHTTPClient(client *http.Client) { 99 o.HTTPClient = client 100 } 101 102 // WriteToRequest writes these params to a swagger request 103 func (o *GetWhoamiParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 104 105 if err := r.SetTimeout(o.timeout); err != nil { 106 return err 107 } 108 var res []error 109 110 if len(res) > 0 { 111 return errors.CompositeValidationError(res...) 112 } 113 return nil 114 }