github.com/cilium/cilium@v1.16.2/api/v1/client/policy/get_identity_id_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  
    22  // NewGetIdentityIDParams creates a new GetIdentityIDParams object,
    23  // with the default timeout for this client.
    24  //
    25  // Default values are not hydrated, since defaults are normally applied by the API server side.
    26  //
    27  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    28  func NewGetIdentityIDParams() *GetIdentityIDParams {
    29  	return &GetIdentityIDParams{
    30  		timeout: cr.DefaultTimeout,
    31  	}
    32  }
    33  
    34  // NewGetIdentityIDParamsWithTimeout creates a new GetIdentityIDParams object
    35  // with the ability to set a timeout on a request.
    36  func NewGetIdentityIDParamsWithTimeout(timeout time.Duration) *GetIdentityIDParams {
    37  	return &GetIdentityIDParams{
    38  		timeout: timeout,
    39  	}
    40  }
    41  
    42  // NewGetIdentityIDParamsWithContext creates a new GetIdentityIDParams object
    43  // with the ability to set a context for a request.
    44  func NewGetIdentityIDParamsWithContext(ctx context.Context) *GetIdentityIDParams {
    45  	return &GetIdentityIDParams{
    46  		Context: ctx,
    47  	}
    48  }
    49  
    50  // NewGetIdentityIDParamsWithHTTPClient creates a new GetIdentityIDParams object
    51  // with the ability to set a custom HTTPClient for a request.
    52  func NewGetIdentityIDParamsWithHTTPClient(client *http.Client) *GetIdentityIDParams {
    53  	return &GetIdentityIDParams{
    54  		HTTPClient: client,
    55  	}
    56  }
    57  
    58  /*
    59  GetIdentityIDParams contains all the parameters to send to the API endpoint
    60  
    61  	for the get identity ID operation.
    62  
    63  	Typically these are written to a http.Request.
    64  */
    65  type GetIdentityIDParams struct {
    66  
    67  	/* ID.
    68  
    69  	   Cluster wide unique identifier of a security identity.
    70  
    71  	*/
    72  	ID string
    73  
    74  	timeout    time.Duration
    75  	Context    context.Context
    76  	HTTPClient *http.Client
    77  }
    78  
    79  // WithDefaults hydrates default values in the get identity ID params (not the query body).
    80  //
    81  // All values with no default are reset to their zero value.
    82  func (o *GetIdentityIDParams) WithDefaults() *GetIdentityIDParams {
    83  	o.SetDefaults()
    84  	return o
    85  }
    86  
    87  // SetDefaults hydrates default values in the get identity ID params (not the query body).
    88  //
    89  // All values with no default are reset to their zero value.
    90  func (o *GetIdentityIDParams) SetDefaults() {
    91  	// no default values defined for this parameter
    92  }
    93  
    94  // WithTimeout adds the timeout to the get identity ID params
    95  func (o *GetIdentityIDParams) WithTimeout(timeout time.Duration) *GetIdentityIDParams {
    96  	o.SetTimeout(timeout)
    97  	return o
    98  }
    99  
   100  // SetTimeout adds the timeout to the get identity ID params
   101  func (o *GetIdentityIDParams) SetTimeout(timeout time.Duration) {
   102  	o.timeout = timeout
   103  }
   104  
   105  // WithContext adds the context to the get identity ID params
   106  func (o *GetIdentityIDParams) WithContext(ctx context.Context) *GetIdentityIDParams {
   107  	o.SetContext(ctx)
   108  	return o
   109  }
   110  
   111  // SetContext adds the context to the get identity ID params
   112  func (o *GetIdentityIDParams) SetContext(ctx context.Context) {
   113  	o.Context = ctx
   114  }
   115  
   116  // WithHTTPClient adds the HTTPClient to the get identity ID params
   117  func (o *GetIdentityIDParams) WithHTTPClient(client *http.Client) *GetIdentityIDParams {
   118  	o.SetHTTPClient(client)
   119  	return o
   120  }
   121  
   122  // SetHTTPClient adds the HTTPClient to the get identity ID params
   123  func (o *GetIdentityIDParams) SetHTTPClient(client *http.Client) {
   124  	o.HTTPClient = client
   125  }
   126  
   127  // WithID adds the id to the get identity ID params
   128  func (o *GetIdentityIDParams) WithID(id string) *GetIdentityIDParams {
   129  	o.SetID(id)
   130  	return o
   131  }
   132  
   133  // SetID adds the id to the get identity ID params
   134  func (o *GetIdentityIDParams) SetID(id string) {
   135  	o.ID = id
   136  }
   137  
   138  // WriteToRequest writes these params to a swagger request
   139  func (o *GetIdentityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   140  
   141  	if err := r.SetTimeout(o.timeout); err != nil {
   142  		return err
   143  	}
   144  	var res []error
   145  
   146  	// path param id
   147  	if err := r.SetPathParam("id", o.ID); err != nil {
   148  		return err
   149  	}
   150  
   151  	if len(res) > 0 {
   152  		return errors.CompositeValidationError(res...)
   153  	}
   154  	return nil
   155  }