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.2 (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::DeviceBayTemplateRequestDeviceType>,
22    #[serde(rename = "role")]
23    pub role: Box<crate::models::DeviceWithConfigContextRequestRole>,
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::DeviceTypeRequestDefaultPlatform>>>,
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::DeviceWithConfigContextRequestSite>,
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::DeviceWithConfigContextRequestLocation>>>,
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::DeviceWithConfigContextRequestRack>>>,
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: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
114    #[serde(
115        rename = "primary_ip6",
116        default,
117        with = "::serde_with::rust::double_option",
118        skip_serializing_if = "Option::is_none"
119    )]
120    pub primary_ip6: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
121    #[serde(
122        rename = "oob_ip",
123        default,
124        with = "::serde_with::rust::double_option",
125        skip_serializing_if = "Option::is_none"
126    )]
127    pub oob_ip: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
128    #[serde(
129        rename = "cluster",
130        default,
131        with = "::serde_with::rust::double_option",
132        skip_serializing_if = "Option::is_none"
133    )]
134    pub cluster: Option<Option<Box<crate::models::DeviceWithConfigContextRequestCluster>>>,
135    #[serde(
136        rename = "virtual_chassis",
137        default,
138        with = "::serde_with::rust::double_option",
139        skip_serializing_if = "Option::is_none"
140    )]
141    pub virtual_chassis:
142        Option<Option<Box<crate::models::DeviceWithConfigContextRequestVirtualChassis>>>,
143    #[serde(
144        rename = "vc_position",
145        default,
146        with = "::serde_with::rust::double_option",
147        skip_serializing_if = "Option::is_none"
148    )]
149    pub vc_position: Option<Option<i32>>,
150    /// Virtual chassis master election priority
151    #[serde(
152        rename = "vc_priority",
153        default,
154        with = "::serde_with::rust::double_option",
155        skip_serializing_if = "Option::is_none"
156    )]
157    pub vc_priority: Option<Option<i32>>,
158    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
159    pub description: Option<String>,
160    #[serde(
161        rename = "owner",
162        default,
163        with = "::serde_with::rust::double_option",
164        skip_serializing_if = "Option::is_none"
165    )]
166    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
167    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
168    pub comments: Option<String>,
169    #[serde(
170        rename = "config_template",
171        default,
172        with = "::serde_with::rust::double_option",
173        skip_serializing_if = "Option::is_none"
174    )]
175    pub config_template: Option<Option<Box<crate::models::DeviceRoleRequestConfigTemplate>>>,
176    /// Local config context data takes precedence over source contexts in the final rendered config context
177    #[serde(
178        rename = "local_context_data",
179        default,
180        with = "::serde_with::rust::double_option",
181        skip_serializing_if = "Option::is_none"
182    )]
183    pub local_context_data: Option<Option<serde_json::Value>>,
184    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
185    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
186    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
187    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
188}
189
190impl DcimDevicesCreateRequest {
191    pub fn new(
192        device_type: crate::models::DeviceBayTemplateRequestDeviceType,
193        role: crate::models::DeviceWithConfigContextRequestRole,
194        site: crate::models::DeviceWithConfigContextRequestSite,
195    ) -> DcimDevicesCreateRequest {
196        DcimDevicesCreateRequest {
197            name: None,
198            device_type: Box::new(device_type),
199            role: Box::new(role),
200            tenant: None,
201            platform: None,
202            serial: None,
203            asset_tag: None,
204            site: Box::new(site),
205            location: None,
206            rack: None,
207            position: None,
208            face: None,
209            latitude: None,
210            longitude: None,
211            status: None,
212            airflow: None,
213            primary_ip4: None,
214            primary_ip6: None,
215            oob_ip: None,
216            cluster: None,
217            virtual_chassis: None,
218            vc_position: None,
219            vc_priority: None,
220            description: None,
221            owner: None,
222            comments: None,
223            config_template: None,
224            local_context_data: None,
225            tags: None,
226            custom_fields: None,
227        }
228    }
229}
230
231/// * `front` - Front * `rear` - Rear
232#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
233pub enum Face {
234    #[serde(rename = "front")]
235    Front,
236    #[serde(rename = "rear")]
237    Rear,
238    #[serde(rename = "")]
239    Empty,
240    #[serde(rename = "null")]
241    Null,
242}
243
244impl Default for Face {
245    fn default() -> Face {
246        Self::Front
247    }
248}
249/// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `inventory` - Inventory * `decommissioning` - Decommissioning
250#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
251pub enum Status {
252    #[serde(rename = "offline")]
253    Offline,
254    #[serde(rename = "active")]
255    Active,
256    #[serde(rename = "planned")]
257    Planned,
258    #[serde(rename = "staged")]
259    Staged,
260    #[serde(rename = "failed")]
261    Failed,
262    #[serde(rename = "inventory")]
263    Inventory,
264    #[serde(rename = "decommissioning")]
265    Decommissioning,
266}
267
268impl Default for Status {
269    fn default() -> Status {
270        Self::Offline
271    }
272}
273/// * `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
274#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
275pub enum Airflow {
276    #[serde(rename = "front-to-rear")]
277    FrontToRear,
278    #[serde(rename = "rear-to-front")]
279    RearToFront,
280    #[serde(rename = "left-to-right")]
281    LeftToRight,
282    #[serde(rename = "right-to-left")]
283    RightToLeft,
284    #[serde(rename = "side-to-rear")]
285    SideToRear,
286    #[serde(rename = "rear-to-side")]
287    RearToSide,
288    #[serde(rename = "bottom-to-top")]
289    BottomToTop,
290    #[serde(rename = "top-to-bottom")]
291    TopToBottom,
292    #[serde(rename = "passive")]
293    Passive,
294    #[serde(rename = "mixed")]
295    Mixed,
296    #[serde(rename = "")]
297    Empty,
298    #[serde(rename = "null")]
299    Null,
300}
301
302impl Default for Airflow {
303    fn default() -> Airflow {
304        Self::FrontToRear
305    }
306}