github.com/kubearmor/cilium@v1.6.12/api/v1/client/policy/get_identity_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package policy 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 17 strfmt "github.com/go-openapi/strfmt" 18 19 models "github.com/cilium/cilium/api/v1/models" 20 ) 21 22 // NewGetIdentityParams creates a new GetIdentityParams object 23 // with the default values initialized. 24 func NewGetIdentityParams() *GetIdentityParams { 25 var () 26 return &GetIdentityParams{ 27 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewGetIdentityParamsWithTimeout creates a new GetIdentityParams object 33 // with the default values initialized, and the ability to set a timeout on a request 34 func NewGetIdentityParamsWithTimeout(timeout time.Duration) *GetIdentityParams { 35 var () 36 return &GetIdentityParams{ 37 38 timeout: timeout, 39 } 40 } 41 42 // NewGetIdentityParamsWithContext creates a new GetIdentityParams object 43 // with the default values initialized, and the ability to set a context for a request 44 func NewGetIdentityParamsWithContext(ctx context.Context) *GetIdentityParams { 45 var () 46 return &GetIdentityParams{ 47 48 Context: ctx, 49 } 50 } 51 52 // NewGetIdentityParamsWithHTTPClient creates a new GetIdentityParams object 53 // with the default values initialized, and the ability to set a custom HTTPClient for a request 54 func NewGetIdentityParamsWithHTTPClient(client *http.Client) *GetIdentityParams { 55 var () 56 return &GetIdentityParams{ 57 HTTPClient: client, 58 } 59 } 60 61 /*GetIdentityParams contains all the parameters to send to the API endpoint 62 for the get identity operation typically these are written to a http.Request 63 */ 64 type GetIdentityParams struct { 65 66 /*Labels 67 List of labels 68 69 70 */ 71 Labels models.Labels 72 73 timeout time.Duration 74 Context context.Context 75 HTTPClient *http.Client 76 } 77 78 // WithTimeout adds the timeout to the get identity params 79 func (o *GetIdentityParams) WithTimeout(timeout time.Duration) *GetIdentityParams { 80 o.SetTimeout(timeout) 81 return o 82 } 83 84 // SetTimeout adds the timeout to the get identity params 85 func (o *GetIdentityParams) SetTimeout(timeout time.Duration) { 86 o.timeout = timeout 87 } 88 89 // WithContext adds the context to the get identity params 90 func (o *GetIdentityParams) WithContext(ctx context.Context) *GetIdentityParams { 91 o.SetContext(ctx) 92 return o 93 } 94 95 // SetContext adds the context to the get identity params 96 func (o *GetIdentityParams) SetContext(ctx context.Context) { 97 o.Context = ctx 98 } 99 100 // WithHTTPClient adds the HTTPClient to the get identity params 101 func (o *GetIdentityParams) WithHTTPClient(client *http.Client) *GetIdentityParams { 102 o.SetHTTPClient(client) 103 return o 104 } 105 106 // SetHTTPClient adds the HTTPClient to the get identity params 107 func (o *GetIdentityParams) SetHTTPClient(client *http.Client) { 108 o.HTTPClient = client 109 } 110 111 // WithLabels adds the labels to the get identity params 112 func (o *GetIdentityParams) WithLabels(labels models.Labels) *GetIdentityParams { 113 o.SetLabels(labels) 114 return o 115 } 116 117 // SetLabels adds the labels to the get identity params 118 func (o *GetIdentityParams) SetLabels(labels models.Labels) { 119 o.Labels = labels 120 } 121 122 // WriteToRequest writes these params to a swagger request 123 func (o *GetIdentityParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 124 125 if err := r.SetTimeout(o.timeout); err != nil { 126 return err 127 } 128 var res []error 129 130 if o.Labels != nil { 131 if err := r.SetBodyParam(o.Labels); err != nil { 132 return err 133 } 134 } 135 136 if len(res) > 0 { 137 return errors.CompositeValidationError(res...) 138 } 139 return nil 140 }