Skip to main content

netbox_openapi/models/
dcim_devices_create_request.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.6.8 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct DcimDevicesCreateRequest {
13    #[serde(
14        rename = "name",
15        default,
16        with = "::serde_with::rust::double_option",
17        skip_serializing_if = "Option::is_none"
18    )]
19    pub name: Option<Option<String>>,
20    #[serde(rename = "device_type")]
21    pub device_type: Box<crate::models::BulkDeviceBayTemplateRequestDeviceType>,
22    #[serde(rename = "role")]
23    pub role: Box<crate::models::BulkDeviceWithConfigContextRequestRole>,
24    #[serde(
25        rename = "tenant",
26        default,
27        with = "::serde_with::rust::double_option",
28        skip_serializing_if = "Option::is_none"
29    )]
30    pub tenant: Option<Option<Box<crate::models::AsnRangeRequestTenant>>>,
31    #[serde(
32        rename = "platform",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub platform: Option<Option<Box<crate::models::BulkDeviceTypeRequestDefaultPlatform>>>,
38    /// Chassis serial number, assigned by the manufacturer
39    #[serde(rename = "serial", skip_serializing_if = "Option::is_none")]
40    pub serial: Option<String>,
41    /// A unique tag used to identify this device
42    #[serde(
43        rename = "asset_tag",
44        default,
45        with = "::serde_with::rust::double_option",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub asset_tag: Option<Option<String>>,
49    #[serde(rename = "site")]
50    pub site: Box<crate::models::BulkDeviceWithConfigContextRequestSite>,
51    #[serde(
52        rename = "location",
53        default,
54        with = "::serde_with::rust::double_option",
55        skip_serializing_if = "Option::is_none"
56    )]
57    pub location: Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestLocation>>>,
58    #[serde(
59        rename = "rack",
60        default,
61        with = "::serde_with::rust::double_option",
62        skip_serializing_if = "Option::is_none"
63    )]
64    pub rack: Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestRack>>>,
65    #[serde(
66        rename = "position",
67        default,
68        with = "::serde_with::rust::double_option",
69        skip_serializing_if = "Option::is_none"
70    )]
71    pub position: Option<Option<f64>>,
72    /// * `front` - Front * `rear` - Rear
73    #[serde(
74        rename = "face",
75        default,
76        with = "::serde_with::rust::double_option",
77        skip_serializing_if = "Option::is_none"
78    )]
79    pub face: Option<Option<Face>>,
80    /// GPS coordinate in decimal format (xx.yyyyyy)
81    #[serde(
82        rename = "latitude",
83        default,
84        with = "::serde_with::rust::double_option",
85        skip_serializing_if = "Option::is_none"
86    )]
87    pub latitude: Option<Option<f64>>,
88    /// GPS coordinate in decimal format (xx.yyyyyy)
89    #[serde(
90        rename = "longitude",
91        default,
92        with = "::serde_with::rust::double_option",
93        skip_serializing_if = "Option::is_none"
94    )]
95    pub longitude: Option<Option<f64>>,
96    /// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `inventory` - Inventory * `decommissioning` - Decommissioning
97    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
98    pub status: Option<Status>,
99    /// * `front-to-rear` - Front to rear * `rear-to-front` - Rear to front * `left-to-right` - Left to right * `right-to-left` - Right to left * `side-to-rear` - Side to rear * `rear-to-side` - Rear to side * `bottom-to-top` - Bottom to top * `top-to-bottom` - Top to bottom * `passive` - Passive * `mixed` - Mixed
100    #[serde(
101        rename = "airflow",
102        default,
103        with = "::serde_with::rust::double_option",
104        skip_serializing_if = "Option::is_none"
105    )]
106    pub airflow: Option<Option<Airflow>>,
107    #[serde(
108        rename = "primary_ip4",
109        default,
110        with = "::serde_with::rust::double_option",
111        skip_serializing_if = "Option::is_none"
112    )]
113    pub primary_ip4:
114        Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestPrimaryIp4>>>,
115    #[serde(
116        rename = "primary_ip6",
117        default,
118        with = "::serde_with::rust::double_option",
119        skip_serializing_if = "Option::is_none"
120    )]
121    pub primary_ip6:
122        Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestPrimaryIp4>>>,
123    #[serde(
124        rename = "oob_ip",
125        default,
126        with = "::serde_with::rust::double_option",
127        skip_serializing_if = "Option::is_none"
128    )]
129    pub oob_ip: Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestPrimaryIp4>>>,
130    #[serde(
131        rename = "cluster",
132        default,
133        with = "::serde_with::rust::double_option",
134        skip_serializing_if = "Option::is_none"
135    )]
136    pub cluster: Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestCluster>>>,
137    #[serde(
138        rename = "virtual_chassis",
139        default,
140        with = "::serde_with::rust::double_option",
141        skip_serializing_if = "Option::is_none"
142    )]
143    pub virtual_chassis:
144        Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestVirtualChassis>>>,
145    #[serde(
146        rename = "vc_position",
147        default,
148        with = "::serde_with::rust::double_option",
149        skip_serializing_if = "Option::is_none"
150    )]
151    pub vc_position: Option<Option<i32>>,
152    /// Virtual chassis master election priority
153    #[serde(
154        rename = "vc_priority",
155        default,
156        with = "::serde_with::rust::double_option",
157        skip_serializing_if = "Option::is_none"
158    )]
159    pub vc_priority: Option<Option<i32>>,
160    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
161    pub description: Option<String>,
162    #[serde(
163        rename = "owner",
164        default,
165        with = "::serde_with::rust::double_option",
166        skip_serializing_if = "Option::is_none"
167    )]
168    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
169    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
170    pub comments: Option<String>,
171    #[serde(
172        rename = "config_template",
173        default,
174        with = "::serde_with::rust::double_option",
175        skip_serializing_if = "Option::is_none"
176    )]
177    pub config_template: Option<Option<Box<crate::models::BulkDeviceRoleRequestConfigTemplate>>>,
178    /// Local config context data takes precedence over source contexts in the final rendered config context
179    #[serde(
180        rename = "local_context_data",
181        default,
182        with = "::serde_with::rust::double_option",
183        skip_serializing_if = "Option::is_none"
184    )]
185    pub local_context_data: Option<Option<serde_json::Value>>,
186    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
187    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
188    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
189    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
190}
191
192impl DcimDevicesCreateRequest {
193    pub fn new(
194        device_type: crate::models::BulkDeviceBayTemplateRequestDeviceType,
195        role: crate::models::BulkDeviceWithConfigContextRequestRole,
196        site: crate::models::BulkDeviceWithConfigContextRequestSite,
197    ) -> DcimDevicesCreateRequest {
198        DcimDevicesCreateRequest {
199            name: None,
200            device_type: Box::new(device_type),
201            role: Box::new(role),
202            tenant: None,
203            platform: None,
204            serial: None,
205            asset_tag: None,
206            site: Box::new(site),
207            location: None,
208            rack: None,
209            position: None,
210            face: None,
211            latitude: None,
212            longitude: None,
213            status: None,
214            airflow: None,
215            primary_ip4: None,
216            primary_ip6: None,
217            oob_ip: None,
218            cluster: None,
219            virtual_chassis: None,
220            vc_position: None,
221            vc_priority: None,
222            description: None,
223            owner: None,
224            comments: None,
225            config_template: None,
226            local_context_data: None,
227            tags: None,
228            custom_fields: None,
229        }
230    }
231}
232
233/// * `front` - Front * `rear` - Rear
234#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
235pub enum Face {
236    #[serde(rename = "front")]
237    Front,
238    #[serde(rename = "rear")]
239    Rear,
240    #[serde(rename = "")]
241    Empty,
242    #[serde(rename = "null")]
243    Null,
244}
245
246impl Default for Face {
247    fn default() -> Face {
248        Self::Front
249    }
250}
251/// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `inventory` - Inventory * `decommissioning` - Decommissioning
252#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
253pub enum Status {
254    #[serde(rename = "offline")]
255    Offline,
256    #[serde(rename = "active")]
257    Active,
258    #[serde(rename = "planned")]
259    Planned,
260    #[serde(rename = "staged")]
261    Staged,
262    #[serde(rename = "failed")]
263    Failed,
264    #[serde(rename = "inventory")]
265    Inventory,
266    #[serde(rename = "decommissioning")]
267    Decommissioning,
268}
269
270impl Default for Status {
271    fn default() -> Status {
272        Self::Offline
273    }
274}
275/// * `front-to-rear` - Front to rear * `rear-to-front` - Rear to front * `left-to-right` - Left to right * `right-to-left` - Right to left * `side-to-rear` - Side to rear * `rear-to-side` - Rear to side * `bottom-to-top` - Bottom to top * `top-to-bottom` - Top to bottom * `passive` - Passive * `mixed` - Mixed
276#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
277pub enum Airflow {
278    #[serde(rename = "front-to-rear")]
279    FrontToRear,
280    #[serde(rename = "rear-to-front")]
281    RearToFront,
282    #[serde(rename = "left-to-right")]
283    LeftToRight,
284    #[serde(rename = "right-to-left")]
285    RightToLeft,
286    #[serde(rename = "side-to-rear")]
287    SideToRear,
288    #[serde(rename = "rear-to-side")]
289    RearToSide,
290    #[serde(rename = "bottom-to-top")]
291    BottomToTop,
292    #[serde(rename = "top-to-bottom")]
293    TopToBottom,
294    #[serde(rename = "passive")]
295    Passive,
296    #[serde(rename = "mixed")]
297    Mixed,
298    #[serde(rename = "")]
299    Empty,
300    #[serde(rename = "null")]
301    Null,
302}
303
304impl Default for Airflow {
305    fn default() -> Airflow {
306        Self::FrontToRear
307    }
308}