github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/operations/put_logger_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package operations
     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/kata-containers/runtime/virtcontainers/pkg/firecracker/client/models"
    20  )
    21  
    22  // NewPutLoggerParams creates a new PutLoggerParams object
    23  // with the default values initialized.
    24  func NewPutLoggerParams() *PutLoggerParams {
    25  	var ()
    26  	return &PutLoggerParams{
    27  
    28  		timeout: cr.DefaultTimeout,
    29  	}
    30  }
    31  
    32  // NewPutLoggerParamsWithTimeout creates a new PutLoggerParams object
    33  // with the default values initialized, and the ability to set a timeout on a request
    34  func NewPutLoggerParamsWithTimeout(timeout time.Duration) *PutLoggerParams {
    35  	var ()
    36  	return &PutLoggerParams{
    37  
    38  		timeout: timeout,
    39  	}
    40  }
    41  
    42  // NewPutLoggerParamsWithContext creates a new PutLoggerParams object
    43  // with the default values initialized, and the ability to set a context for a request
    44  func NewPutLoggerParamsWithContext(ctx context.Context) *PutLoggerParams {
    45  	var ()
    46  	return &PutLoggerParams{
    47  
    48  		Context: ctx,
    49  	}
    50  }
    51  
    52  // NewPutLoggerParamsWithHTTPClient creates a new PutLoggerParams object
    53  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    54  func NewPutLoggerParamsWithHTTPClient(client *http.Client) *PutLoggerParams {
    55  	var ()
    56  	return &PutLoggerParams{
    57  		HTTPClient: client,
    58  	}
    59  }
    60  
    61  /*PutLoggerParams contains all the parameters to send to the API endpoint
    62  for the put logger operation typically these are written to a http.Request
    63  */
    64  type PutLoggerParams struct {
    65  
    66  	/*Body
    67  	  Logging system description
    68  
    69  	*/
    70  	Body *models.Logger
    71  
    72  	timeout    time.Duration
    73  	Context    context.Context
    74  	HTTPClient *http.Client
    75  }
    76  
    77  // WithTimeout adds the timeout to the put logger params
    78  func (o *PutLoggerParams) WithTimeout(timeout time.Duration) *PutLoggerParams {
    79  	o.SetTimeout(timeout)
    80  	return o
    81  }
    82  
    83  // SetTimeout adds the timeout to the put logger params
    84  func (o *PutLoggerParams) SetTimeout(timeout time.Duration) {
    85  	o.timeout = timeout
    86  }
    87  
    88  // WithContext adds the context to the put logger params
    89  func (o *PutLoggerParams) WithContext(ctx context.Context) *PutLoggerParams {
    90  	o.SetContext(ctx)
    91  	return o
    92  }
    93  
    94  // SetContext adds the context to the put logger params
    95  func (o *PutLoggerParams) SetContext(ctx context.Context) {
    96  	o.Context = ctx
    97  }
    98  
    99  // WithHTTPClient adds the HTTPClient to the put logger params
   100  func (o *PutLoggerParams) WithHTTPClient(client *http.Client) *PutLoggerParams {
   101  	o.SetHTTPClient(client)
   102  	return o
   103  }
   104  
   105  // SetHTTPClient adds the HTTPClient to the put logger params
   106  func (o *PutLoggerParams) SetHTTPClient(client *http.Client) {
   107  	o.HTTPClient = client
   108  }
   109  
   110  // WithBody adds the body to the put logger params
   111  func (o *PutLoggerParams) WithBody(body *models.Logger) *PutLoggerParams {
   112  	o.SetBody(body)
   113  	return o
   114  }
   115  
   116  // SetBody adds the body to the put logger params
   117  func (o *PutLoggerParams) SetBody(body *models.Logger) {
   118  	o.Body = body
   119  }
   120  
   121  // WriteToRequest writes these params to a swagger request
   122  func (o *PutLoggerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   123  
   124  	if err := r.SetTimeout(o.timeout); err != nil {
   125  		return err
   126  	}
   127  	var res []error
   128  
   129  	if o.Body != nil {
   130  		if err := r.SetBodyParam(o.Body); err != nil {
   131  			return err
   132  		}
   133  	}
   134  
   135  	if len(res) > 0 {
   136  		return errors.CompositeValidationError(res...)
   137  	}
   138  	return nil
   139  }