github.com/cilium/cilium@v1.16.2/api/v1/client/endpoint/get_endpoint_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 endpoint 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 // NewGetEndpointParams creates a new GetEndpointParams 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 NewGetEndpointParams() *GetEndpointParams { 31 return &GetEndpointParams{ 32 timeout: cr.DefaultTimeout, 33 } 34 } 35 36 // NewGetEndpointParamsWithTimeout creates a new GetEndpointParams object 37 // with the ability to set a timeout on a request. 38 func NewGetEndpointParamsWithTimeout(timeout time.Duration) *GetEndpointParams { 39 return &GetEndpointParams{ 40 timeout: timeout, 41 } 42 } 43 44 // NewGetEndpointParamsWithContext creates a new GetEndpointParams object 45 // with the ability to set a context for a request. 46 func NewGetEndpointParamsWithContext(ctx context.Context) *GetEndpointParams { 47 return &GetEndpointParams{ 48 Context: ctx, 49 } 50 } 51 52 // NewGetEndpointParamsWithHTTPClient creates a new GetEndpointParams object 53 // with the ability to set a custom HTTPClient for a request. 54 func NewGetEndpointParamsWithHTTPClient(client *http.Client) *GetEndpointParams { 55 return &GetEndpointParams{ 56 HTTPClient: client, 57 } 58 } 59 60 /* 61 GetEndpointParams contains all the parameters to send to the API endpoint 62 63 for the get endpoint operation. 64 65 Typically these are written to a http.Request. 66 */ 67 type GetEndpointParams 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 endpoint params (not the query body). 82 // 83 // All values with no default are reset to their zero value. 84 func (o *GetEndpointParams) WithDefaults() *GetEndpointParams { 85 o.SetDefaults() 86 return o 87 } 88 89 // SetDefaults hydrates default values in the get endpoint params (not the query body). 90 // 91 // All values with no default are reset to their zero value. 92 func (o *GetEndpointParams) SetDefaults() { 93 // no default values defined for this parameter 94 } 95 96 // WithTimeout adds the timeout to the get endpoint params 97 func (o *GetEndpointParams) WithTimeout(timeout time.Duration) *GetEndpointParams { 98 o.SetTimeout(timeout) 99 return o 100 } 101 102 // SetTimeout adds the timeout to the get endpoint params 103 func (o *GetEndpointParams) SetTimeout(timeout time.Duration) { 104 o.timeout = timeout 105 } 106 107 // WithContext adds the context to the get endpoint params 108 func (o *GetEndpointParams) WithContext(ctx context.Context) *GetEndpointParams { 109 o.SetContext(ctx) 110 return o 111 } 112 113 // SetContext adds the context to the get endpoint params 114 func (o *GetEndpointParams) SetContext(ctx context.Context) { 115 o.Context = ctx 116 } 117 118 // WithHTTPClient adds the HTTPClient to the get endpoint params 119 func (o *GetEndpointParams) WithHTTPClient(client *http.Client) *GetEndpointParams { 120 o.SetHTTPClient(client) 121 return o 122 } 123 124 // SetHTTPClient adds the HTTPClient to the get endpoint params 125 func (o *GetEndpointParams) SetHTTPClient(client *http.Client) { 126 o.HTTPClient = client 127 } 128 129 // WithLabels adds the labels to the get endpoint params 130 func (o *GetEndpointParams) WithLabels(labels models.Labels) *GetEndpointParams { 131 o.SetLabels(labels) 132 return o 133 } 134 135 // SetLabels adds the labels to the get endpoint params 136 func (o *GetEndpointParams) SetLabels(labels models.Labels) { 137 o.Labels = labels 138 } 139 140 // WriteToRequest writes these params to a swagger request 141 func (o *GetEndpointParams) 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 }