blob: 6385b3bb7e362aa65d511d58633f3afeda57cbf2 [file] [log] [blame]
Serge Bazanskicc25bdf2018-10-25 14:02:58 +02001// Code generated by go-swagger; DO NOT EDIT.
2
3// Copyright 2018 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
17package dcim
18
19// This file was generated by the swagger tool.
20// Editing this file might prove futile when you re-run the swagger generate command
21
22import (
23 "net/http"
24 "time"
25
26 "golang.org/x/net/context"
27
28 "github.com/go-openapi/errors"
29 "github.com/go-openapi/runtime"
30 cr "github.com/go-openapi/runtime/client"
31
32 strfmt "github.com/go-openapi/strfmt"
33
34 "github.com/digitalocean/go-netbox/netbox/models"
35)
36
37// NewDcimDevicesCreateParams creates a new DcimDevicesCreateParams object
38// with the default values initialized.
39func NewDcimDevicesCreateParams() *DcimDevicesCreateParams {
40 var ()
41 return &DcimDevicesCreateParams{
42
43 timeout: cr.DefaultTimeout,
44 }
45}
46
47// NewDcimDevicesCreateParamsWithTimeout creates a new DcimDevicesCreateParams object
48// with the default values initialized, and the ability to set a timeout on a request
49func NewDcimDevicesCreateParamsWithTimeout(timeout time.Duration) *DcimDevicesCreateParams {
50 var ()
51 return &DcimDevicesCreateParams{
52
53 timeout: timeout,
54 }
55}
56
57// NewDcimDevicesCreateParamsWithContext creates a new DcimDevicesCreateParams object
58// with the default values initialized, and the ability to set a context for a request
59func NewDcimDevicesCreateParamsWithContext(ctx context.Context) *DcimDevicesCreateParams {
60 var ()
61 return &DcimDevicesCreateParams{
62
63 Context: ctx,
64 }
65}
66
67// NewDcimDevicesCreateParamsWithHTTPClient creates a new DcimDevicesCreateParams object
68// with the default values initialized, and the ability to set a custom HTTPClient for a request
69func NewDcimDevicesCreateParamsWithHTTPClient(client *http.Client) *DcimDevicesCreateParams {
70 var ()
71 return &DcimDevicesCreateParams{
72 HTTPClient: client,
73 }
74}
75
76/*DcimDevicesCreateParams contains all the parameters to send to the API endpoint
77for the dcim devices create operation typically these are written to a http.Request
78*/
79type DcimDevicesCreateParams struct {
80
81 /*Data*/
82 Data *models.WritableDevice
83
84 timeout time.Duration
85 Context context.Context
86 HTTPClient *http.Client
87}
88
89// WithTimeout adds the timeout to the dcim devices create params
90func (o *DcimDevicesCreateParams) WithTimeout(timeout time.Duration) *DcimDevicesCreateParams {
91 o.SetTimeout(timeout)
92 return o
93}
94
95// SetTimeout adds the timeout to the dcim devices create params
96func (o *DcimDevicesCreateParams) SetTimeout(timeout time.Duration) {
97 o.timeout = timeout
98}
99
100// WithContext adds the context to the dcim devices create params
101func (o *DcimDevicesCreateParams) WithContext(ctx context.Context) *DcimDevicesCreateParams {
102 o.SetContext(ctx)
103 return o
104}
105
106// SetContext adds the context to the dcim devices create params
107func (o *DcimDevicesCreateParams) SetContext(ctx context.Context) {
108 o.Context = ctx
109}
110
111// WithHTTPClient adds the HTTPClient to the dcim devices create params
112func (o *DcimDevicesCreateParams) WithHTTPClient(client *http.Client) *DcimDevicesCreateParams {
113 o.SetHTTPClient(client)
114 return o
115}
116
117// SetHTTPClient adds the HTTPClient to the dcim devices create params
118func (o *DcimDevicesCreateParams) SetHTTPClient(client *http.Client) {
119 o.HTTPClient = client
120}
121
122// WithData adds the data to the dcim devices create params
123func (o *DcimDevicesCreateParams) WithData(data *models.WritableDevice) *DcimDevicesCreateParams {
124 o.SetData(data)
125 return o
126}
127
128// SetData adds the data to the dcim devices create params
129func (o *DcimDevicesCreateParams) SetData(data *models.WritableDevice) {
130 o.Data = data
131}
132
133// WriteToRequest writes these params to a swagger request
134func (o *DcimDevicesCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
135
136 if err := r.SetTimeout(o.timeout); err != nil {
137 return err
138 }
139 var res []error
140
141 if o.Data != nil {
142 if err := r.SetBodyParam(o.Data); err != nil {
143 return err
144 }
145 }
146
147 if len(res) > 0 {
148 return errors.CompositeValidationError(res...)
149 }
150 return nil
151}