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