github.com/looshlee/beatles@v0.0.0-20220727174639-742810ab631c/api/v1/client/service/put_service_id_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package service
     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  	"github.com/go-openapi/swag"
    17  
    18  	strfmt "github.com/go-openapi/strfmt"
    19  
    20  	models "github.com/cilium/cilium/api/v1/models"
    21  )
    22  
    23  // NewPutServiceIDParams creates a new PutServiceIDParams object
    24  // with the default values initialized.
    25  func NewPutServiceIDParams() *PutServiceIDParams {
    26  	var ()
    27  	return &PutServiceIDParams{
    28  
    29  		timeout: cr.DefaultTimeout,
    30  	}
    31  }
    32  
    33  // NewPutServiceIDParamsWithTimeout creates a new PutServiceIDParams object
    34  // with the default values initialized, and the ability to set a timeout on a request
    35  func NewPutServiceIDParamsWithTimeout(timeout time.Duration) *PutServiceIDParams {
    36  	var ()
    37  	return &PutServiceIDParams{
    38  
    39  		timeout: timeout,
    40  	}
    41  }
    42  
    43  // NewPutServiceIDParamsWithContext creates a new PutServiceIDParams object
    44  // with the default values initialized, and the ability to set a context for a request
    45  func NewPutServiceIDParamsWithContext(ctx context.Context) *PutServiceIDParams {
    46  	var ()
    47  	return &PutServiceIDParams{
    48  
    49  		Context: ctx,
    50  	}
    51  }
    52  
    53  // NewPutServiceIDParamsWithHTTPClient creates a new PutServiceIDParams object
    54  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    55  func NewPutServiceIDParamsWithHTTPClient(client *http.Client) *PutServiceIDParams {
    56  	var ()
    57  	return &PutServiceIDParams{
    58  		HTTPClient: client,
    59  	}
    60  }
    61  
    62  /*PutServiceIDParams contains all the parameters to send to the API endpoint
    63  for the put service ID operation typically these are written to a http.Request
    64  */
    65  type PutServiceIDParams struct {
    66  
    67  	/*Config
    68  	  Service configuration
    69  
    70  	*/
    71  	Config *models.ServiceSpec
    72  	/*ID
    73  	  ID of service
    74  
    75  	*/
    76  	ID int64
    77  
    78  	timeout    time.Duration
    79  	Context    context.Context
    80  	HTTPClient *http.Client
    81  }
    82  
    83  // WithTimeout adds the timeout to the put service ID params
    84  func (o *PutServiceIDParams) WithTimeout(timeout time.Duration) *PutServiceIDParams {
    85  	o.SetTimeout(timeout)
    86  	return o
    87  }
    88  
    89  // SetTimeout adds the timeout to the put service ID params
    90  func (o *PutServiceIDParams) SetTimeout(timeout time.Duration) {
    91  	o.timeout = timeout
    92  }
    93  
    94  // WithContext adds the context to the put service ID params
    95  func (o *PutServiceIDParams) WithContext(ctx context.Context) *PutServiceIDParams {
    96  	o.SetContext(ctx)
    97  	return o
    98  }
    99  
   100  // SetContext adds the context to the put service ID params
   101  func (o *PutServiceIDParams) SetContext(ctx context.Context) {
   102  	o.Context = ctx
   103  }
   104  
   105  // WithHTTPClient adds the HTTPClient to the put service ID params
   106  func (o *PutServiceIDParams) WithHTTPClient(client *http.Client) *PutServiceIDParams {
   107  	o.SetHTTPClient(client)
   108  	return o
   109  }
   110  
   111  // SetHTTPClient adds the HTTPClient to the put service ID params
   112  func (o *PutServiceIDParams) SetHTTPClient(client *http.Client) {
   113  	o.HTTPClient = client
   114  }
   115  
   116  // WithConfig adds the config to the put service ID params
   117  func (o *PutServiceIDParams) WithConfig(config *models.ServiceSpec) *PutServiceIDParams {
   118  	o.SetConfig(config)
   119  	return o
   120  }
   121  
   122  // SetConfig adds the config to the put service ID params
   123  func (o *PutServiceIDParams) SetConfig(config *models.ServiceSpec) {
   124  	o.Config = config
   125  }
   126  
   127  // WithID adds the id to the put service ID params
   128  func (o *PutServiceIDParams) WithID(id int64) *PutServiceIDParams {
   129  	o.SetID(id)
   130  	return o
   131  }
   132  
   133  // SetID adds the id to the put service ID params
   134  func (o *PutServiceIDParams) SetID(id int64) {
   135  	o.ID = id
   136  }
   137  
   138  // WriteToRequest writes these params to a swagger request
   139  func (o *PutServiceIDParams) 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  	if o.Config != nil {
   147  		if err := r.SetBodyParam(o.Config); err != nil {
   148  			return err
   149  		}
   150  	}
   151  
   152  	// path param id
   153  	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
   154  		return err
   155  	}
   156  
   157  	if len(res) > 0 {
   158  		return errors.CompositeValidationError(res...)
   159  	}
   160  	return nil
   161  }