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