github.com/digitalocean/go-netbox@v0.0.2/netbox/client/dcim/dcim_device_bays_partial_update_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright 2020 The go-netbox Authors. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 // 17 18 package dcim 19 20 // This file was generated by the swagger tool. 21 // Editing this file might prove futile when you re-run the swagger generate command 22 23 import ( 24 "context" 25 "net/http" 26 "time" 27 28 "github.com/go-openapi/errors" 29 "github.com/go-openapi/runtime" 30 cr "github.com/go-openapi/runtime/client" 31 "github.com/go-openapi/strfmt" 32 "github.com/go-openapi/swag" 33 34 "github.com/digitalocean/go-netbox/netbox/models" 35 ) 36 37 // NewDcimDeviceBaysPartialUpdateParams creates a new DcimDeviceBaysPartialUpdateParams object, 38 // with the default timeout for this client. 39 // 40 // Default values are not hydrated, since defaults are normally applied by the API server side. 41 // 42 // To enforce default values in parameter, use SetDefaults or WithDefaults. 43 func NewDcimDeviceBaysPartialUpdateParams() *DcimDeviceBaysPartialUpdateParams { 44 return &DcimDeviceBaysPartialUpdateParams{ 45 timeout: cr.DefaultTimeout, 46 } 47 } 48 49 // NewDcimDeviceBaysPartialUpdateParamsWithTimeout creates a new DcimDeviceBaysPartialUpdateParams object 50 // with the ability to set a timeout on a request. 51 func NewDcimDeviceBaysPartialUpdateParamsWithTimeout(timeout time.Duration) *DcimDeviceBaysPartialUpdateParams { 52 return &DcimDeviceBaysPartialUpdateParams{ 53 timeout: timeout, 54 } 55 } 56 57 // NewDcimDeviceBaysPartialUpdateParamsWithContext creates a new DcimDeviceBaysPartialUpdateParams object 58 // with the ability to set a context for a request. 59 func NewDcimDeviceBaysPartialUpdateParamsWithContext(ctx context.Context) *DcimDeviceBaysPartialUpdateParams { 60 return &DcimDeviceBaysPartialUpdateParams{ 61 Context: ctx, 62 } 63 } 64 65 // NewDcimDeviceBaysPartialUpdateParamsWithHTTPClient creates a new DcimDeviceBaysPartialUpdateParams object 66 // with the ability to set a custom HTTPClient for a request. 67 func NewDcimDeviceBaysPartialUpdateParamsWithHTTPClient(client *http.Client) *DcimDeviceBaysPartialUpdateParams { 68 return &DcimDeviceBaysPartialUpdateParams{ 69 HTTPClient: client, 70 } 71 } 72 73 /* DcimDeviceBaysPartialUpdateParams contains all the parameters to send to the API endpoint 74 for the dcim device bays partial update operation. 75 76 Typically these are written to a http.Request. 77 */ 78 type DcimDeviceBaysPartialUpdateParams struct { 79 80 // Data. 81 Data *models.WritableDeviceBay 82 83 /* ID. 84 85 A unique integer value identifying this device bay. 86 */ 87 ID int64 88 89 timeout time.Duration 90 Context context.Context 91 HTTPClient *http.Client 92 } 93 94 // WithDefaults hydrates default values in the dcim device bays partial update params (not the query body). 95 // 96 // All values with no default are reset to their zero value. 97 func (o *DcimDeviceBaysPartialUpdateParams) WithDefaults() *DcimDeviceBaysPartialUpdateParams { 98 o.SetDefaults() 99 return o 100 } 101 102 // SetDefaults hydrates default values in the dcim device bays partial update params (not the query body). 103 // 104 // All values with no default are reset to their zero value. 105 func (o *DcimDeviceBaysPartialUpdateParams) SetDefaults() { 106 // no default values defined for this parameter 107 } 108 109 // WithTimeout adds the timeout to the dcim device bays partial update params 110 func (o *DcimDeviceBaysPartialUpdateParams) WithTimeout(timeout time.Duration) *DcimDeviceBaysPartialUpdateParams { 111 o.SetTimeout(timeout) 112 return o 113 } 114 115 // SetTimeout adds the timeout to the dcim device bays partial update params 116 func (o *DcimDeviceBaysPartialUpdateParams) SetTimeout(timeout time.Duration) { 117 o.timeout = timeout 118 } 119 120 // WithContext adds the context to the dcim device bays partial update params 121 func (o *DcimDeviceBaysPartialUpdateParams) WithContext(ctx context.Context) *DcimDeviceBaysPartialUpdateParams { 122 o.SetContext(ctx) 123 return o 124 } 125 126 // SetContext adds the context to the dcim device bays partial update params 127 func (o *DcimDeviceBaysPartialUpdateParams) SetContext(ctx context.Context) { 128 o.Context = ctx 129 } 130 131 // WithHTTPClient adds the HTTPClient to the dcim device bays partial update params 132 func (o *DcimDeviceBaysPartialUpdateParams) WithHTTPClient(client *http.Client) *DcimDeviceBaysPartialUpdateParams { 133 o.SetHTTPClient(client) 134 return o 135 } 136 137 // SetHTTPClient adds the HTTPClient to the dcim device bays partial update params 138 func (o *DcimDeviceBaysPartialUpdateParams) SetHTTPClient(client *http.Client) { 139 o.HTTPClient = client 140 } 141 142 // WithData adds the data to the dcim device bays partial update params 143 func (o *DcimDeviceBaysPartialUpdateParams) WithData(data *models.WritableDeviceBay) *DcimDeviceBaysPartialUpdateParams { 144 o.SetData(data) 145 return o 146 } 147 148 // SetData adds the data to the dcim device bays partial update params 149 func (o *DcimDeviceBaysPartialUpdateParams) SetData(data *models.WritableDeviceBay) { 150 o.Data = data 151 } 152 153 // WithID adds the id to the dcim device bays partial update params 154 func (o *DcimDeviceBaysPartialUpdateParams) WithID(id int64) *DcimDeviceBaysPartialUpdateParams { 155 o.SetID(id) 156 return o 157 } 158 159 // SetID adds the id to the dcim device bays partial update params 160 func (o *DcimDeviceBaysPartialUpdateParams) SetID(id int64) { 161 o.ID = id 162 } 163 164 // WriteToRequest writes these params to a swagger request 165 func (o *DcimDeviceBaysPartialUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 166 167 if err := r.SetTimeout(o.timeout); err != nil { 168 return err 169 } 170 var res []error 171 if o.Data != nil { 172 if err := r.SetBodyParam(o.Data); err != nil { 173 return err 174 } 175 } 176 177 // path param id 178 if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 179 return err 180 } 181 182 if len(res) > 0 { 183 return errors.CompositeValidationError(res...) 184 } 185 return nil 186 }