github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/operations/put_guest_drive_by_id_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  // NewPutGuestDriveByIDParams creates a new PutGuestDriveByIDParams object
    23  // with the default values initialized.
    24  func NewPutGuestDriveByIDParams() *PutGuestDriveByIDParams {
    25  	var ()
    26  	return &PutGuestDriveByIDParams{
    27  
    28  		timeout: cr.DefaultTimeout,
    29  	}
    30  }
    31  
    32  // NewPutGuestDriveByIDParamsWithTimeout creates a new PutGuestDriveByIDParams object
    33  // with the default values initialized, and the ability to set a timeout on a request
    34  func NewPutGuestDriveByIDParamsWithTimeout(timeout time.Duration) *PutGuestDriveByIDParams {
    35  	var ()
    36  	return &PutGuestDriveByIDParams{
    37  
    38  		timeout: timeout,
    39  	}
    40  }
    41  
    42  // NewPutGuestDriveByIDParamsWithContext creates a new PutGuestDriveByIDParams object
    43  // with the default values initialized, and the ability to set a context for a request
    44  func NewPutGuestDriveByIDParamsWithContext(ctx context.Context) *PutGuestDriveByIDParams {
    45  	var ()
    46  	return &PutGuestDriveByIDParams{
    47  
    48  		Context: ctx,
    49  	}
    50  }
    51  
    52  // NewPutGuestDriveByIDParamsWithHTTPClient creates a new PutGuestDriveByIDParams object
    53  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    54  func NewPutGuestDriveByIDParamsWithHTTPClient(client *http.Client) *PutGuestDriveByIDParams {
    55  	var ()
    56  	return &PutGuestDriveByIDParams{
    57  		HTTPClient: client,
    58  	}
    59  }
    60  
    61  /*PutGuestDriveByIDParams contains all the parameters to send to the API endpoint
    62  for the put guest drive by ID operation typically these are written to a http.Request
    63  */
    64  type PutGuestDriveByIDParams struct {
    65  
    66  	/*Body
    67  	  Guest drive properties
    68  
    69  	*/
    70  	Body *models.Drive
    71  	/*DriveID
    72  	  The id of the guest drive
    73  
    74  	*/
    75  	DriveID string
    76  
    77  	timeout    time.Duration
    78  	Context    context.Context
    79  	HTTPClient *http.Client
    80  }
    81  
    82  // WithTimeout adds the timeout to the put guest drive by ID params
    83  func (o *PutGuestDriveByIDParams) WithTimeout(timeout time.Duration) *PutGuestDriveByIDParams {
    84  	o.SetTimeout(timeout)
    85  	return o
    86  }
    87  
    88  // SetTimeout adds the timeout to the put guest drive by ID params
    89  func (o *PutGuestDriveByIDParams) SetTimeout(timeout time.Duration) {
    90  	o.timeout = timeout
    91  }
    92  
    93  // WithContext adds the context to the put guest drive by ID params
    94  func (o *PutGuestDriveByIDParams) WithContext(ctx context.Context) *PutGuestDriveByIDParams {
    95  	o.SetContext(ctx)
    96  	return o
    97  }
    98  
    99  // SetContext adds the context to the put guest drive by ID params
   100  func (o *PutGuestDriveByIDParams) SetContext(ctx context.Context) {
   101  	o.Context = ctx
   102  }
   103  
   104  // WithHTTPClient adds the HTTPClient to the put guest drive by ID params
   105  func (o *PutGuestDriveByIDParams) WithHTTPClient(client *http.Client) *PutGuestDriveByIDParams {
   106  	o.SetHTTPClient(client)
   107  	return o
   108  }
   109  
   110  // SetHTTPClient adds the HTTPClient to the put guest drive by ID params
   111  func (o *PutGuestDriveByIDParams) SetHTTPClient(client *http.Client) {
   112  	o.HTTPClient = client
   113  }
   114  
   115  // WithBody adds the body to the put guest drive by ID params
   116  func (o *PutGuestDriveByIDParams) WithBody(body *models.Drive) *PutGuestDriveByIDParams {
   117  	o.SetBody(body)
   118  	return o
   119  }
   120  
   121  // SetBody adds the body to the put guest drive by ID params
   122  func (o *PutGuestDriveByIDParams) SetBody(body *models.Drive) {
   123  	o.Body = body
   124  }
   125  
   126  // WithDriveID adds the driveID to the put guest drive by ID params
   127  func (o *PutGuestDriveByIDParams) WithDriveID(driveID string) *PutGuestDriveByIDParams {
   128  	o.SetDriveID(driveID)
   129  	return o
   130  }
   131  
   132  // SetDriveID adds the driveId to the put guest drive by ID params
   133  func (o *PutGuestDriveByIDParams) SetDriveID(driveID string) {
   134  	o.DriveID = driveID
   135  }
   136  
   137  // WriteToRequest writes these params to a swagger request
   138  func (o *PutGuestDriveByIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   139  
   140  	if err := r.SetTimeout(o.timeout); err != nil {
   141  		return err
   142  	}
   143  	var res []error
   144  
   145  	if o.Body != nil {
   146  		if err := r.SetBodyParam(o.Body); err != nil {
   147  			return err
   148  		}
   149  	}
   150  
   151  	// path param drive_id
   152  	if err := r.SetPathParam("drive_id", o.DriveID); err != nil {
   153  		return err
   154  	}
   155  
   156  	if len(res) > 0 {
   157  		return errors.CompositeValidationError(res...)
   158  	}
   159  	return nil
   160  }