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