github.com/cilium/cilium@v1.16.2/api/v1/client/service/get_service_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 service
     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  	"github.com/go-openapi/swag"
    21  )
    22  
    23  // NewGetServiceIDParams creates a new GetServiceIDParams object,
    24  // with the default timeout for this client.
    25  //
    26  // Default values are not hydrated, since defaults are normally applied by the API server side.
    27  //
    28  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    29  func NewGetServiceIDParams() *GetServiceIDParams {
    30  	return &GetServiceIDParams{
    31  		timeout: cr.DefaultTimeout,
    32  	}
    33  }
    34  
    35  // NewGetServiceIDParamsWithTimeout creates a new GetServiceIDParams object
    36  // with the ability to set a timeout on a request.
    37  func NewGetServiceIDParamsWithTimeout(timeout time.Duration) *GetServiceIDParams {
    38  	return &GetServiceIDParams{
    39  		timeout: timeout,
    40  	}
    41  }
    42  
    43  // NewGetServiceIDParamsWithContext creates a new GetServiceIDParams object
    44  // with the ability to set a context for a request.
    45  func NewGetServiceIDParamsWithContext(ctx context.Context) *GetServiceIDParams {
    46  	return &GetServiceIDParams{
    47  		Context: ctx,
    48  	}
    49  }
    50  
    51  // NewGetServiceIDParamsWithHTTPClient creates a new GetServiceIDParams object
    52  // with the ability to set a custom HTTPClient for a request.
    53  func NewGetServiceIDParamsWithHTTPClient(client *http.Client) *GetServiceIDParams {
    54  	return &GetServiceIDParams{
    55  		HTTPClient: client,
    56  	}
    57  }
    58  
    59  /*
    60  GetServiceIDParams contains all the parameters to send to the API endpoint
    61  
    62  	for the get service ID operation.
    63  
    64  	Typically these are written to a http.Request.
    65  */
    66  type GetServiceIDParams struct {
    67  
    68  	/* ID.
    69  
    70  	   ID of service
    71  	*/
    72  	ID int64
    73  
    74  	timeout    time.Duration
    75  	Context    context.Context
    76  	HTTPClient *http.Client
    77  }
    78  
    79  // WithDefaults hydrates default values in the get service ID params (not the query body).
    80  //
    81  // All values with no default are reset to their zero value.
    82  func (o *GetServiceIDParams) WithDefaults() *GetServiceIDParams {
    83  	o.SetDefaults()
    84  	return o
    85  }
    86  
    87  // SetDefaults hydrates default values in the get service ID params (not the query body).
    88  //
    89  // All values with no default are reset to their zero value.
    90  func (o *GetServiceIDParams) SetDefaults() {
    91  	// no default values defined for this parameter
    92  }
    93  
    94  // WithTimeout adds the timeout to the get service ID params
    95  func (o *GetServiceIDParams) WithTimeout(timeout time.Duration) *GetServiceIDParams {
    96  	o.SetTimeout(timeout)
    97  	return o
    98  }
    99  
   100  // SetTimeout adds the timeout to the get service ID params
   101  func (o *GetServiceIDParams) SetTimeout(timeout time.Duration) {
   102  	o.timeout = timeout
   103  }
   104  
   105  // WithContext adds the context to the get service ID params
   106  func (o *GetServiceIDParams) WithContext(ctx context.Context) *GetServiceIDParams {
   107  	o.SetContext(ctx)
   108  	return o
   109  }
   110  
   111  // SetContext adds the context to the get service ID params
   112  func (o *GetServiceIDParams) SetContext(ctx context.Context) {
   113  	o.Context = ctx
   114  }
   115  
   116  // WithHTTPClient adds the HTTPClient to the get service ID params
   117  func (o *GetServiceIDParams) WithHTTPClient(client *http.Client) *GetServiceIDParams {
   118  	o.SetHTTPClient(client)
   119  	return o
   120  }
   121  
   122  // SetHTTPClient adds the HTTPClient to the get service ID params
   123  func (o *GetServiceIDParams) SetHTTPClient(client *http.Client) {
   124  	o.HTTPClient = client
   125  }
   126  
   127  // WithID adds the id to the get service ID params
   128  func (o *GetServiceIDParams) WithID(id int64) *GetServiceIDParams {
   129  	o.SetID(id)
   130  	return o
   131  }
   132  
   133  // SetID adds the id to the get service ID params
   134  func (o *GetServiceIDParams) SetID(id int64) {
   135  	o.ID = id
   136  }
   137  
   138  // WriteToRequest writes these params to a swagger request
   139  func (o *GetServiceIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   140  
   141  	if err := r.SetTimeout(o.timeout); err != nil {
   142  		return err
   143  	}
   144  	var res []error
   145  
   146  	// path param id
   147  	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
   148  		return err
   149  	}
   150  
   151  	if len(res) > 0 {
   152  		return errors.CompositeValidationError(res...)
   153  	}
   154  	return nil
   155  }