netbox_openapi/models/
writable_device_with_config_context_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.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// WritableDeviceWithConfigContextRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableDeviceWithConfigContextRequest {
15    #[serde(
16        rename = "name",
17        default,
18        with = "::serde_with::rust::double_option",
19        skip_serializing_if = "Option::is_none"
20    )]
21    pub name: Option<Option<String>>,
22    #[serde(rename = "device_type")]
23    pub device_type: Box<crate::models::DeviceBayTemplateRequestDeviceType>,
24    #[serde(rename = "role")]
25    pub role: Box<crate::models::DeviceWithConfigContextRequestRole>,
26    #[serde(
27        rename = "tenant",
28        default,
29        with = "::serde_with::rust::double_option",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub tenant: Option<Option<Box<crate::models::AsnRangeRequestTenant>>>,
33    #[serde(
34        rename = "platform",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub platform: Option<Option<Box<crate::models::DeviceTypeRequestDefaultPlatform>>>,
40    /// Chassis serial number, assigned by the manufacturer
41    #[serde(rename = "serial", skip_serializing_if = "Option::is_none")]
42    pub serial: Option<String>,
43    /// A unique tag used to identify this device
44    #[serde(
45        rename = "asset_tag",
46        default,
47        with = "::serde_with::rust::double_option",
48        skip_serializing_if = "Option::is_none"
49    )]
50    pub asset_tag: Option<Option<String>>,
51    #[serde(rename = "site")]
52    pub site: Box<crate::models::DeviceWithConfigContextRequestSite>,
53    #[serde(
54        rename = "location",
55        default,
56        with = "::serde_with::rust::double_option",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub location: Option<Option<Box<crate::models::DeviceWithConfigContextRequestLocation>>>,
60    #[serde(
61        rename = "rack",
62        default,
63        with = "::serde_with::rust::double_option",
64        skip_serializing_if = "Option::is_none"
65    )]
66    pub rack: Option<Option<Box<crate::models::DeviceWithConfigContextRequestRack>>>,
67    #[serde(
68        rename = "position",
69        default,
70        with = "::serde_with::rust::double_option",
71        skip_serializing_if = "Option::is_none"
72    )]
73    pub position: Option<Option<f64>>,
74    /// * `front` - Front * `rear` - Rear
75    #[serde(
76        rename = "face",
77        default,
78        with = "::serde_with::rust::double_option",
79        skip_serializing_if = "Option::is_none"
80    )]
81    pub face: Option<Option<Face>>,
82    /// GPS coordinate in decimal format (xx.yyyyyy)
83    #[serde(
84        rename = "latitude",
85        default,
86        with = "::serde_with::rust::double_option",
87        skip_serializing_if = "Option::is_none"
88    )]
89    pub latitude: Option<Option<f64>>,
90    /// GPS coordinate in decimal format (xx.yyyyyy)
91    #[serde(
92        rename = "longitude",
93        default,
94        with = "::serde_with::rust::double_option",
95        skip_serializing_if = "Option::is_none"
96    )]
97    pub longitude: Option<Option<f64>>,
98    /// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `inventory` - Inventory * `decommissioning` - Decommissioning
99    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
100    pub status: Option<Status>,
101    /// * `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
102    #[serde(
103        rename = "airflow",
104        default,
105        with = "::serde_with::rust::double_option",
106        skip_serializing_if = "Option::is_none"
107    )]
108    pub airflow: Option<Option<Airflow>>,
109    #[serde(
110        rename = "primary_ip4",
111        default,
112        with = "::serde_with::rust::double_option",
113        skip_serializing_if = "Option::is_none"
114    )]
115    pub primary_ip4: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
116    #[serde(
117        rename = "primary_ip6",
118        default,
119        with = "::serde_with::rust::double_option",
120        skip_serializing_if = "Option::is_none"
121    )]
122    pub primary_ip6: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
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::DeviceWithConfigContextRequestPrimaryIp4>>>,
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::DeviceWithConfigContextRequestCluster>>>,
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::DeviceWithConfigContextRequestVirtualChassis>>>,
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(rename = "comments", skip_serializing_if = "Option::is_none")]
163    pub comments: Option<String>,
164    #[serde(
165        rename = "config_template",
166        default,
167        with = "::serde_with::rust::double_option",
168        skip_serializing_if = "Option::is_none"
169    )]
170    pub config_template: Option<Option<Box<crate::models::DeviceRoleRequestConfigTemplate>>>,
171    /// Local config context data takes precedence over source contexts in the final rendered config context
172    #[serde(
173        rename = "local_context_data",
174        default,
175        with = "::serde_with::rust::double_option",
176        skip_serializing_if = "Option::is_none"
177    )]
178    pub local_context_data: Option<Option<serde_json::Value>>,
179    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
180    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
181    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
182    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
183}
184
185impl WritableDeviceWithConfigContextRequest {
186    /// Adds support for custom fields and tags.
187    pub fn new(
188        device_type: crate::models::DeviceBayTemplateRequestDeviceType,
189        role: crate::models::DeviceWithConfigContextRequestRole,
190        site: crate::models::DeviceWithConfigContextRequestSite,
191    ) -> WritableDeviceWithConfigContextRequest {
192        WritableDeviceWithConfigContextRequest {
193            name: None,
194            device_type: Box::new(device_type),
195            role: Box::new(role),
196            tenant: None,
197            platform: None,
198            serial: None,
199            asset_tag: None,
200            site: Box::new(site),
201            location: None,
202            rack: None,
203            position: None,
204            face: None,
205            latitude: None,
206            longitude: None,
207            status: None,
208            airflow: None,
209            primary_ip4: None,
210            primary_ip6: None,
211            oob_ip: None,
212            cluster: None,
213            virtual_chassis: None,
214            vc_position: None,
215            vc_priority: None,
216            description: None,
217            comments: None,
218            config_template: None,
219            local_context_data: None,
220            tags: None,
221            custom_fields: None,
222        }
223    }
224}
225
226/// * `front` - Front * `rear` - Rear
227#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
228pub enum Face {
229    #[serde(rename = "front")]
230    Front,
231    #[serde(rename = "rear")]
232    Rear,
233    #[serde(rename = "")]
234    Empty,
235    #[serde(rename = "null")]
236    Null,
237}
238
239impl Default for Face {
240    fn default() -> Face {
241        Self::Front
242    }
243}
244/// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `inventory` - Inventory * `decommissioning` - Decommissioning
245#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
246pub enum Status {
247    #[serde(rename = "offline")]
248    Offline,
249    #[serde(rename = "active")]
250    Active,
251    #[serde(rename = "planned")]
252    Planned,
253    #[serde(rename = "staged")]
254    Staged,
255    #[serde(rename = "failed")]
256    Failed,
257    #[serde(rename = "inventory")]
258    Inventory,
259    #[serde(rename = "decommissioning")]
260    Decommissioning,
261}
262
263impl Default for Status {
264    fn default() -> Status {
265        Self::Offline
266    }
267}
268/// * `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
269#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
270pub enum Airflow {
271    #[serde(rename = "front-to-rear")]
272    FrontToRear,
273    #[serde(rename = "rear-to-front")]
274    RearToFront,
275    #[serde(rename = "left-to-right")]
276    LeftToRight,
277    #[serde(rename = "right-to-left")]
278    RightToLeft,
279    #[serde(rename = "side-to-rear")]
280    SideToRear,
281    #[serde(rename = "rear-to-side")]
282    RearToSide,
283    #[serde(rename = "bottom-to-top")]
284    BottomToTop,
285    #[serde(rename = "top-to-bottom")]
286    TopToBottom,
287    #[serde(rename = "passive")]
288    Passive,
289    #[serde(rename = "mixed")]
290    Mixed,
291    #[serde(rename = "")]
292    Empty,
293    #[serde(rename = "null")]
294    Null,
295}
296
297impl Default for Airflow {
298    fn default() -> Airflow {
299        Self::FrontToRear
300    }
301}