github.com/cilium/cilium@v1.16.2/api/v1/client/endpoint/patch_endpoint_id_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 endpoint
     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  	"github.com/cilium/cilium/api/v1/models"
    22  )
    23  
    24  // NewPatchEndpointIDParams creates a new PatchEndpointIDParams object,
    25  // with the default timeout for this client.
    26  //
    27  // Default values are not hydrated, since defaults are normally applied by the API server side.
    28  //
    29  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    30  func NewPatchEndpointIDParams() *PatchEndpointIDParams {
    31  	return &PatchEndpointIDParams{
    32  		timeout: cr.DefaultTimeout,
    33  	}
    34  }
    35  
    36  // NewPatchEndpointIDParamsWithTimeout creates a new PatchEndpointIDParams object
    37  // with the ability to set a timeout on a request.
    38  func NewPatchEndpointIDParamsWithTimeout(timeout time.Duration) *PatchEndpointIDParams {
    39  	return &PatchEndpointIDParams{
    40  		timeout: timeout,
    41  	}
    42  }
    43  
    44  // NewPatchEndpointIDParamsWithContext creates a new PatchEndpointIDParams object
    45  // with the ability to set a context for a request.
    46  func NewPatchEndpointIDParamsWithContext(ctx context.Context) *PatchEndpointIDParams {
    47  	return &PatchEndpointIDParams{
    48  		Context: ctx,
    49  	}
    50  }
    51  
    52  // NewPatchEndpointIDParamsWithHTTPClient creates a new PatchEndpointIDParams object
    53  // with the ability to set a custom HTTPClient for a request.
    54  func NewPatchEndpointIDParamsWithHTTPClient(client *http.Client) *PatchEndpointIDParams {
    55  	return &PatchEndpointIDParams{
    56  		HTTPClient: client,
    57  	}
    58  }
    59  
    60  /*
    61  PatchEndpointIDParams contains all the parameters to send to the API endpoint
    62  
    63  	for the patch endpoint ID operation.
    64  
    65  	Typically these are written to a http.Request.
    66  */
    67  type PatchEndpointIDParams struct {
    68  
    69  	// Endpoint.
    70  	Endpoint *models.EndpointChangeRequest
    71  
    72  	/* ID.
    73  
    74  	     String describing an endpoint with the format ``[prefix:]id``. If no prefix
    75  	is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints
    76  	will be addressable by all endpoint ID prefixes with the exception of the
    77  	local Cilium UUID which is assigned to all endpoints.
    78  
    79  	Supported endpoint id prefixes:
    80  	  - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595
    81  	  - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343
    82  	  - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0
    83  	  - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique)
    84  	  - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique)
    85  	  - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique)
    86  	  - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1
    87  	  - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444
    88  
    89  	*/
    90  	ID string
    91  
    92  	timeout    time.Duration
    93  	Context    context.Context
    94  	HTTPClient *http.Client
    95  }
    96  
    97  // WithDefaults hydrates default values in the patch endpoint ID params (not the query body).
    98  //
    99  // All values with no default are reset to their zero value.
   100  func (o *PatchEndpointIDParams) WithDefaults() *PatchEndpointIDParams {
   101  	o.SetDefaults()
   102  	return o
   103  }
   104  
   105  // SetDefaults hydrates default values in the patch endpoint ID params (not the query body).
   106  //
   107  // All values with no default are reset to their zero value.
   108  func (o *PatchEndpointIDParams) SetDefaults() {
   109  	// no default values defined for this parameter
   110  }
   111  
   112  // WithTimeout adds the timeout to the patch endpoint ID params
   113  func (o *PatchEndpointIDParams) WithTimeout(timeout time.Duration) *PatchEndpointIDParams {
   114  	o.SetTimeout(timeout)
   115  	return o
   116  }
   117  
   118  // SetTimeout adds the timeout to the patch endpoint ID params
   119  func (o *PatchEndpointIDParams) SetTimeout(timeout time.Duration) {
   120  	o.timeout = timeout
   121  }
   122  
   123  // WithContext adds the context to the patch endpoint ID params
   124  func (o *PatchEndpointIDParams) WithContext(ctx context.Context) *PatchEndpointIDParams {
   125  	o.SetContext(ctx)
   126  	return o
   127  }
   128  
   129  // SetContext adds the context to the patch endpoint ID params
   130  func (o *PatchEndpointIDParams) SetContext(ctx context.Context) {
   131  	o.Context = ctx
   132  }
   133  
   134  // WithHTTPClient adds the HTTPClient to the patch endpoint ID params
   135  func (o *PatchEndpointIDParams) WithHTTPClient(client *http.Client) *PatchEndpointIDParams {
   136  	o.SetHTTPClient(client)
   137  	return o
   138  }
   139  
   140  // SetHTTPClient adds the HTTPClient to the patch endpoint ID params
   141  func (o *PatchEndpointIDParams) SetHTTPClient(client *http.Client) {
   142  	o.HTTPClient = client
   143  }
   144  
   145  // WithEndpoint adds the endpoint to the patch endpoint ID params
   146  func (o *PatchEndpointIDParams) WithEndpoint(endpoint *models.EndpointChangeRequest) *PatchEndpointIDParams {
   147  	o.SetEndpoint(endpoint)
   148  	return o
   149  }
   150  
   151  // SetEndpoint adds the endpoint to the patch endpoint ID params
   152  func (o *PatchEndpointIDParams) SetEndpoint(endpoint *models.EndpointChangeRequest) {
   153  	o.Endpoint = endpoint
   154  }
   155  
   156  // WithID adds the id to the patch endpoint ID params
   157  func (o *PatchEndpointIDParams) WithID(id string) *PatchEndpointIDParams {
   158  	o.SetID(id)
   159  	return o
   160  }
   161  
   162  // SetID adds the id to the patch endpoint ID params
   163  func (o *PatchEndpointIDParams) SetID(id string) {
   164  	o.ID = id
   165  }
   166  
   167  // WriteToRequest writes these params to a swagger request
   168  func (o *PatchEndpointIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   169  
   170  	if err := r.SetTimeout(o.timeout); err != nil {
   171  		return err
   172  	}
   173  	var res []error
   174  	if o.Endpoint != nil {
   175  		if err := r.SetBodyParam(o.Endpoint); err != nil {
   176  			return err
   177  		}
   178  	}
   179  
   180  	// path param id
   181  	if err := r.SetPathParam("id", o.ID); err != nil {
   182  		return err
   183  	}
   184  
   185  	if len(res) > 0 {
   186  		return errors.CompositeValidationError(res...)
   187  	}
   188  	return nil
   189  }