github.com/kubearmor/cilium@v1.6.12/api/v1/client/policy/get_fqdn_cache_id_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  
    20  // NewGetFqdnCacheIDParams creates a new GetFqdnCacheIDParams object
    21  // with the default values initialized.
    22  func NewGetFqdnCacheIDParams() *GetFqdnCacheIDParams {
    23  	var ()
    24  	return &GetFqdnCacheIDParams{
    25  
    26  		timeout: cr.DefaultTimeout,
    27  	}
    28  }
    29  
    30  // NewGetFqdnCacheIDParamsWithTimeout creates a new GetFqdnCacheIDParams object
    31  // with the default values initialized, and the ability to set a timeout on a request
    32  func NewGetFqdnCacheIDParamsWithTimeout(timeout time.Duration) *GetFqdnCacheIDParams {
    33  	var ()
    34  	return &GetFqdnCacheIDParams{
    35  
    36  		timeout: timeout,
    37  	}
    38  }
    39  
    40  // NewGetFqdnCacheIDParamsWithContext creates a new GetFqdnCacheIDParams object
    41  // with the default values initialized, and the ability to set a context for a request
    42  func NewGetFqdnCacheIDParamsWithContext(ctx context.Context) *GetFqdnCacheIDParams {
    43  	var ()
    44  	return &GetFqdnCacheIDParams{
    45  
    46  		Context: ctx,
    47  	}
    48  }
    49  
    50  // NewGetFqdnCacheIDParamsWithHTTPClient creates a new GetFqdnCacheIDParams object
    51  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    52  func NewGetFqdnCacheIDParamsWithHTTPClient(client *http.Client) *GetFqdnCacheIDParams {
    53  	var ()
    54  	return &GetFqdnCacheIDParams{
    55  		HTTPClient: client,
    56  	}
    57  }
    58  
    59  /*GetFqdnCacheIDParams contains all the parameters to send to the API endpoint
    60  for the get fqdn cache ID operation typically these are written to a http.Request
    61  */
    62  type GetFqdnCacheIDParams struct {
    63  
    64  	/*Cidr
    65  	  A CIDR range of IPs
    66  
    67  	*/
    68  	Cidr *string
    69  	/*ID
    70  	  String describing an endpoint with the format ``[prefix:]id``. If no prefix
    71  	is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints
    72  	will be addressable by all endpoint ID prefixes with the exception of the
    73  	local Cilium UUID which is assigned to all endpoints.
    74  
    75  	Supported endpoint id prefixes:
    76  	  - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595
    77  	  - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343
    78  	  - container-id: Container runtime ID, e.g. container-id:22222
    79  	  - container-name: Container name, e.g. container-name:foobar
    80  	  - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar
    81  	  - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444
    82  
    83  
    84  	*/
    85  	ID string
    86  	/*Matchpattern
    87  	  A toFQDNs compatible matchPattern expression
    88  
    89  	*/
    90  	Matchpattern *string
    91  
    92  	timeout    time.Duration
    93  	Context    context.Context
    94  	HTTPClient *http.Client
    95  }
    96  
    97  // WithTimeout adds the timeout to the get fqdn cache ID params
    98  func (o *GetFqdnCacheIDParams) WithTimeout(timeout time.Duration) *GetFqdnCacheIDParams {
    99  	o.SetTimeout(timeout)
   100  	return o
   101  }
   102  
   103  // SetTimeout adds the timeout to the get fqdn cache ID params
   104  func (o *GetFqdnCacheIDParams) SetTimeout(timeout time.Duration) {
   105  	o.timeout = timeout
   106  }
   107  
   108  // WithContext adds the context to the get fqdn cache ID params
   109  func (o *GetFqdnCacheIDParams) WithContext(ctx context.Context) *GetFqdnCacheIDParams {
   110  	o.SetContext(ctx)
   111  	return o
   112  }
   113  
   114  // SetContext adds the context to the get fqdn cache ID params
   115  func (o *GetFqdnCacheIDParams) SetContext(ctx context.Context) {
   116  	o.Context = ctx
   117  }
   118  
   119  // WithHTTPClient adds the HTTPClient to the get fqdn cache ID params
   120  func (o *GetFqdnCacheIDParams) WithHTTPClient(client *http.Client) *GetFqdnCacheIDParams {
   121  	o.SetHTTPClient(client)
   122  	return o
   123  }
   124  
   125  // SetHTTPClient adds the HTTPClient to the get fqdn cache ID params
   126  func (o *GetFqdnCacheIDParams) SetHTTPClient(client *http.Client) {
   127  	o.HTTPClient = client
   128  }
   129  
   130  // WithCidr adds the cidr to the get fqdn cache ID params
   131  func (o *GetFqdnCacheIDParams) WithCidr(cidr *string) *GetFqdnCacheIDParams {
   132  	o.SetCidr(cidr)
   133  	return o
   134  }
   135  
   136  // SetCidr adds the cidr to the get fqdn cache ID params
   137  func (o *GetFqdnCacheIDParams) SetCidr(cidr *string) {
   138  	o.Cidr = cidr
   139  }
   140  
   141  // WithID adds the id to the get fqdn cache ID params
   142  func (o *GetFqdnCacheIDParams) WithID(id string) *GetFqdnCacheIDParams {
   143  	o.SetID(id)
   144  	return o
   145  }
   146  
   147  // SetID adds the id to the get fqdn cache ID params
   148  func (o *GetFqdnCacheIDParams) SetID(id string) {
   149  	o.ID = id
   150  }
   151  
   152  // WithMatchpattern adds the matchpattern to the get fqdn cache ID params
   153  func (o *GetFqdnCacheIDParams) WithMatchpattern(matchpattern *string) *GetFqdnCacheIDParams {
   154  	o.SetMatchpattern(matchpattern)
   155  	return o
   156  }
   157  
   158  // SetMatchpattern adds the matchpattern to the get fqdn cache ID params
   159  func (o *GetFqdnCacheIDParams) SetMatchpattern(matchpattern *string) {
   160  	o.Matchpattern = matchpattern
   161  }
   162  
   163  // WriteToRequest writes these params to a swagger request
   164  func (o *GetFqdnCacheIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   165  
   166  	if err := r.SetTimeout(o.timeout); err != nil {
   167  		return err
   168  	}
   169  	var res []error
   170  
   171  	if o.Cidr != nil {
   172  
   173  		// query param cidr
   174  		var qrCidr string
   175  		if o.Cidr != nil {
   176  			qrCidr = *o.Cidr
   177  		}
   178  		qCidr := qrCidr
   179  		if qCidr != "" {
   180  			if err := r.SetQueryParam("cidr", qCidr); err != nil {
   181  				return err
   182  			}
   183  		}
   184  
   185  	}
   186  
   187  	// path param id
   188  	if err := r.SetPathParam("id", o.ID); err != nil {
   189  		return err
   190  	}
   191  
   192  	if o.Matchpattern != nil {
   193  
   194  		// query param matchpattern
   195  		var qrMatchpattern string
   196  		if o.Matchpattern != nil {
   197  			qrMatchpattern = *o.Matchpattern
   198  		}
   199  		qMatchpattern := qrMatchpattern
   200  		if qMatchpattern != "" {
   201  			if err := r.SetQueryParam("matchpattern", qMatchpattern); err != nil {
   202  				return err
   203  			}
   204  		}
   205  
   206  	}
   207  
   208  	if len(res) > 0 {
   209  		return errors.CompositeValidationError(res...)
   210  	}
   211  	return nil
   212  }