github.com/cilium/cilium@v1.16.2/api/v1/client/policy/get_identity_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Authors of Cilium 4 // SPDX-License-Identifier: Apache-2.0 5 6 package policy 7 8 // This file was generated by the swagger tool. 9 // Editing this file might prove futile when you re-run the swagger generate command 10 11 import ( 12 "context" 13 "net/http" 14 "time" 15 16 "github.com/go-openapi/errors" 17 "github.com/go-openapi/runtime" 18 cr "github.com/go-openapi/runtime/client" 19 "github.com/go-openapi/strfmt" 20 21 "github.com/cilium/cilium/api/v1/models" 22 ) 23 24 // NewGetIdentityParams creates a new GetIdentityParams object, 25 // with the default timeout for this client. 26 // 27 // Default values are not hydrated, since defaults are normally applied by the API server side. 28 // 29 // To enforce default values in parameter, use SetDefaults or WithDefaults. 30 func NewGetIdentityParams() *GetIdentityParams { 31 return &GetIdentityParams{ 32 timeout: cr.DefaultTimeout, 33 } 34 } 35 36 // NewGetIdentityParamsWithTimeout creates a new GetIdentityParams object 37 // with the ability to set a timeout on a request. 38 func NewGetIdentityParamsWithTimeout(timeout time.Duration) *GetIdentityParams { 39 return &GetIdentityParams{ 40 timeout: timeout, 41 } 42 } 43 44 // NewGetIdentityParamsWithContext creates a new GetIdentityParams object 45 // with the ability to set a context for a request. 46 func NewGetIdentityParamsWithContext(ctx context.Context) *GetIdentityParams { 47 return &GetIdentityParams{ 48 Context: ctx, 49 } 50 } 51 52 // NewGetIdentityParamsWithHTTPClient creates a new GetIdentityParams object 53 // with the ability to set a custom HTTPClient for a request. 54 func NewGetIdentityParamsWithHTTPClient(client *http.Client) *GetIdentityParams { 55 return &GetIdentityParams{ 56 HTTPClient: client, 57 } 58 } 59 60 /* 61 GetIdentityParams contains all the parameters to send to the API endpoint 62 63 for the get identity operation. 64 65 Typically these are written to a http.Request. 66 */ 67 type GetIdentityParams struct { 68 69 /* Labels. 70 71 List of labels 72 73 */ 74 Labels models.Labels 75 76 timeout time.Duration 77 Context context.Context 78 HTTPClient *http.Client 79 } 80 81 // WithDefaults hydrates default values in the get identity params (not the query body). 82 // 83 // All values with no default are reset to their zero value. 84 func (o *GetIdentityParams) WithDefaults() *GetIdentityParams { 85 o.SetDefaults() 86 return o 87 } 88 89 // SetDefaults hydrates default values in the get identity params (not the query body). 90 // 91 // All values with no default are reset to their zero value. 92 func (o *GetIdentityParams) SetDefaults() { 93 // no default values defined for this parameter 94 } 95 96 // WithTimeout adds the timeout to the get identity params 97 func (o *GetIdentityParams) WithTimeout(timeout time.Duration) *GetIdentityParams { 98 o.SetTimeout(timeout) 99 return o 100 } 101 102 // SetTimeout adds the timeout to the get identity params 103 func (o *GetIdentityParams) SetTimeout(timeout time.Duration) { 104 o.timeout = timeout 105 } 106 107 // WithContext adds the context to the get identity params 108 func (o *GetIdentityParams) WithContext(ctx context.Context) *GetIdentityParams { 109 o.SetContext(ctx) 110 return o 111 } 112 113 // SetContext adds the context to the get identity params 114 func (o *GetIdentityParams) SetContext(ctx context.Context) { 115 o.Context = ctx 116 } 117 118 // WithHTTPClient adds the HTTPClient to the get identity params 119 func (o *GetIdentityParams) WithHTTPClient(client *http.Client) *GetIdentityParams { 120 o.SetHTTPClient(client) 121 return o 122 } 123 124 // SetHTTPClient adds the HTTPClient to the get identity params 125 func (o *GetIdentityParams) SetHTTPClient(client *http.Client) { 126 o.HTTPClient = client 127 } 128 129 // WithLabels adds the labels to the get identity params 130 func (o *GetIdentityParams) WithLabels(labels models.Labels) *GetIdentityParams { 131 o.SetLabels(labels) 132 return o 133 } 134 135 // SetLabels adds the labels to the get identity params 136 func (o *GetIdentityParams) SetLabels(labels models.Labels) { 137 o.Labels = labels 138 } 139 140 // WriteToRequest writes these params to a swagger request 141 func (o *GetIdentityParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 142 143 if err := r.SetTimeout(o.timeout); err != nil { 144 return err 145 } 146 var res []error 147 if o.Labels != nil { 148 if err := r.SetBodyParam(o.Labels); err != nil { 149 return err 150 } 151 } 152 153 if len(res) > 0 { 154 return errors.CompositeValidationError(res...) 155 } 156 return nil 157 }