github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/operations/patch_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 // NewPatchGuestDriveByIDParams creates a new PatchGuestDriveByIDParams object 23 // with the default values initialized. 24 func NewPatchGuestDriveByIDParams() *PatchGuestDriveByIDParams { 25 var () 26 return &PatchGuestDriveByIDParams{ 27 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewPatchGuestDriveByIDParamsWithTimeout creates a new PatchGuestDriveByIDParams object 33 // with the default values initialized, and the ability to set a timeout on a request 34 func NewPatchGuestDriveByIDParamsWithTimeout(timeout time.Duration) *PatchGuestDriveByIDParams { 35 var () 36 return &PatchGuestDriveByIDParams{ 37 38 timeout: timeout, 39 } 40 } 41 42 // NewPatchGuestDriveByIDParamsWithContext creates a new PatchGuestDriveByIDParams object 43 // with the default values initialized, and the ability to set a context for a request 44 func NewPatchGuestDriveByIDParamsWithContext(ctx context.Context) *PatchGuestDriveByIDParams { 45 var () 46 return &PatchGuestDriveByIDParams{ 47 48 Context: ctx, 49 } 50 } 51 52 // NewPatchGuestDriveByIDParamsWithHTTPClient creates a new PatchGuestDriveByIDParams object 53 // with the default values initialized, and the ability to set a custom HTTPClient for a request 54 func NewPatchGuestDriveByIDParamsWithHTTPClient(client *http.Client) *PatchGuestDriveByIDParams { 55 var () 56 return &PatchGuestDriveByIDParams{ 57 HTTPClient: client, 58 } 59 } 60 61 /*PatchGuestDriveByIDParams contains all the parameters to send to the API endpoint 62 for the patch guest drive by ID operation typically these are written to a http.Request 63 */ 64 type PatchGuestDriveByIDParams struct { 65 66 /*Body 67 Guest drive properties 68 69 */ 70 Body *models.PartialDrive 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 patch guest drive by ID params 83 func (o *PatchGuestDriveByIDParams) WithTimeout(timeout time.Duration) *PatchGuestDriveByIDParams { 84 o.SetTimeout(timeout) 85 return o 86 } 87 88 // SetTimeout adds the timeout to the patch guest drive by ID params 89 func (o *PatchGuestDriveByIDParams) SetTimeout(timeout time.Duration) { 90 o.timeout = timeout 91 } 92 93 // WithContext adds the context to the patch guest drive by ID params 94 func (o *PatchGuestDriveByIDParams) WithContext(ctx context.Context) *PatchGuestDriveByIDParams { 95 o.SetContext(ctx) 96 return o 97 } 98 99 // SetContext adds the context to the patch guest drive by ID params 100 func (o *PatchGuestDriveByIDParams) SetContext(ctx context.Context) { 101 o.Context = ctx 102 } 103 104 // WithHTTPClient adds the HTTPClient to the patch guest drive by ID params 105 func (o *PatchGuestDriveByIDParams) WithHTTPClient(client *http.Client) *PatchGuestDriveByIDParams { 106 o.SetHTTPClient(client) 107 return o 108 } 109 110 // SetHTTPClient adds the HTTPClient to the patch guest drive by ID params 111 func (o *PatchGuestDriveByIDParams) SetHTTPClient(client *http.Client) { 112 o.HTTPClient = client 113 } 114 115 // WithBody adds the body to the patch guest drive by ID params 116 func (o *PatchGuestDriveByIDParams) WithBody(body *models.PartialDrive) *PatchGuestDriveByIDParams { 117 o.SetBody(body) 118 return o 119 } 120 121 // SetBody adds the body to the patch guest drive by ID params 122 func (o *PatchGuestDriveByIDParams) SetBody(body *models.PartialDrive) { 123 o.Body = body 124 } 125 126 // WithDriveID adds the driveID to the patch guest drive by ID params 127 func (o *PatchGuestDriveByIDParams) WithDriveID(driveID string) *PatchGuestDriveByIDParams { 128 o.SetDriveID(driveID) 129 return o 130 } 131 132 // SetDriveID adds the driveId to the patch guest drive by ID params 133 func (o *PatchGuestDriveByIDParams) SetDriveID(driveID string) { 134 o.DriveID = driveID 135 } 136 137 // WriteToRequest writes these params to a swagger request 138 func (o *PatchGuestDriveByIDParams) 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 }