github.com/kubearmor/cilium@v1.6.12/api/v1/client/policy/get_fqdn_cache_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  // NewGetFqdnCacheParams creates a new GetFqdnCacheParams object
    21  // with the default values initialized.
    22  func NewGetFqdnCacheParams() *GetFqdnCacheParams {
    23  	var ()
    24  	return &GetFqdnCacheParams{
    25  
    26  		timeout: cr.DefaultTimeout,
    27  	}
    28  }
    29  
    30  // NewGetFqdnCacheParamsWithTimeout creates a new GetFqdnCacheParams object
    31  // with the default values initialized, and the ability to set a timeout on a request
    32  func NewGetFqdnCacheParamsWithTimeout(timeout time.Duration) *GetFqdnCacheParams {
    33  	var ()
    34  	return &GetFqdnCacheParams{
    35  
    36  		timeout: timeout,
    37  	}
    38  }
    39  
    40  // NewGetFqdnCacheParamsWithContext creates a new GetFqdnCacheParams object
    41  // with the default values initialized, and the ability to set a context for a request
    42  func NewGetFqdnCacheParamsWithContext(ctx context.Context) *GetFqdnCacheParams {
    43  	var ()
    44  	return &GetFqdnCacheParams{
    45  
    46  		Context: ctx,
    47  	}
    48  }
    49  
    50  // NewGetFqdnCacheParamsWithHTTPClient creates a new GetFqdnCacheParams object
    51  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    52  func NewGetFqdnCacheParamsWithHTTPClient(client *http.Client) *GetFqdnCacheParams {
    53  	var ()
    54  	return &GetFqdnCacheParams{
    55  		HTTPClient: client,
    56  	}
    57  }
    58  
    59  /*GetFqdnCacheParams contains all the parameters to send to the API endpoint
    60  for the get fqdn cache operation typically these are written to a http.Request
    61  */
    62  type GetFqdnCacheParams struct {
    63  
    64  	/*Cidr
    65  	  A CIDR range of IPs
    66  
    67  	*/
    68  	Cidr *string
    69  	/*Matchpattern
    70  	  A toFQDNs compatible matchPattern expression
    71  
    72  	*/
    73  	Matchpattern *string
    74  
    75  	timeout    time.Duration
    76  	Context    context.Context
    77  	HTTPClient *http.Client
    78  }
    79  
    80  // WithTimeout adds the timeout to the get fqdn cache params
    81  func (o *GetFqdnCacheParams) WithTimeout(timeout time.Duration) *GetFqdnCacheParams {
    82  	o.SetTimeout(timeout)
    83  	return o
    84  }
    85  
    86  // SetTimeout adds the timeout to the get fqdn cache params
    87  func (o *GetFqdnCacheParams) SetTimeout(timeout time.Duration) {
    88  	o.timeout = timeout
    89  }
    90  
    91  // WithContext adds the context to the get fqdn cache params
    92  func (o *GetFqdnCacheParams) WithContext(ctx context.Context) *GetFqdnCacheParams {
    93  	o.SetContext(ctx)
    94  	return o
    95  }
    96  
    97  // SetContext adds the context to the get fqdn cache params
    98  func (o *GetFqdnCacheParams) SetContext(ctx context.Context) {
    99  	o.Context = ctx
   100  }
   101  
   102  // WithHTTPClient adds the HTTPClient to the get fqdn cache params
   103  func (o *GetFqdnCacheParams) WithHTTPClient(client *http.Client) *GetFqdnCacheParams {
   104  	o.SetHTTPClient(client)
   105  	return o
   106  }
   107  
   108  // SetHTTPClient adds the HTTPClient to the get fqdn cache params
   109  func (o *GetFqdnCacheParams) SetHTTPClient(client *http.Client) {
   110  	o.HTTPClient = client
   111  }
   112  
   113  // WithCidr adds the cidr to the get fqdn cache params
   114  func (o *GetFqdnCacheParams) WithCidr(cidr *string) *GetFqdnCacheParams {
   115  	o.SetCidr(cidr)
   116  	return o
   117  }
   118  
   119  // SetCidr adds the cidr to the get fqdn cache params
   120  func (o *GetFqdnCacheParams) SetCidr(cidr *string) {
   121  	o.Cidr = cidr
   122  }
   123  
   124  // WithMatchpattern adds the matchpattern to the get fqdn cache params
   125  func (o *GetFqdnCacheParams) WithMatchpattern(matchpattern *string) *GetFqdnCacheParams {
   126  	o.SetMatchpattern(matchpattern)
   127  	return o
   128  }
   129  
   130  // SetMatchpattern adds the matchpattern to the get fqdn cache params
   131  func (o *GetFqdnCacheParams) SetMatchpattern(matchpattern *string) {
   132  	o.Matchpattern = matchpattern
   133  }
   134  
   135  // WriteToRequest writes these params to a swagger request
   136  func (o *GetFqdnCacheParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   137  
   138  	if err := r.SetTimeout(o.timeout); err != nil {
   139  		return err
   140  	}
   141  	var res []error
   142  
   143  	if o.Cidr != nil {
   144  
   145  		// query param cidr
   146  		var qrCidr string
   147  		if o.Cidr != nil {
   148  			qrCidr = *o.Cidr
   149  		}
   150  		qCidr := qrCidr
   151  		if qCidr != "" {
   152  			if err := r.SetQueryParam("cidr", qCidr); err != nil {
   153  				return err
   154  			}
   155  		}
   156  
   157  	}
   158  
   159  	if o.Matchpattern != nil {
   160  
   161  		// query param matchpattern
   162  		var qrMatchpattern string
   163  		if o.Matchpattern != nil {
   164  			qrMatchpattern = *o.Matchpattern
   165  		}
   166  		qMatchpattern := qrMatchpattern
   167  		if qMatchpattern != "" {
   168  			if err := r.SetQueryParam("matchpattern", qMatchpattern); err != nil {
   169  				return err
   170  			}
   171  		}
   172  
   173  	}
   174  
   175  	if len(res) > 0 {
   176  		return errors.CompositeValidationError(res...)
   177  	}
   178  	return nil
   179  }