Skip to main content

netbox_openapi/models/
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.6.2 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// DeviceWithConfigContextRequest : Base serializer class for models inheriting from PrimaryModel.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct DeviceWithConfigContextRequest {
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(rename = "face", skip_serializing_if = "Option::is_none")]
76    pub face: Option<Face>,
77    /// GPS coordinate in decimal format (xx.yyyyyy)
78    #[serde(
79        rename = "latitude",
80        default,
81        with = "::serde_with::rust::double_option",
82        skip_serializing_if = "Option::is_none"
83    )]
84    pub latitude: Option<Option<f64>>,
85    /// GPS coordinate in decimal format (xx.yyyyyy)
86    #[serde(
87        rename = "longitude",
88        default,
89        with = "::serde_with::rust::double_option",
90        skip_serializing_if = "Option::is_none"
91    )]
92    pub longitude: Option<Option<f64>>,
93    /// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `inventory` - Inventory * `decommissioning` - Decommissioning
94    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
95    pub status: Option<Status>,
96    /// * `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
97    #[serde(rename = "airflow", skip_serializing_if = "Option::is_none")]
98    pub airflow: Option<Airflow>,
99    #[serde(
100        rename = "primary_ip4",
101        default,
102        with = "::serde_with::rust::double_option",
103        skip_serializing_if = "Option::is_none"
104    )]
105    pub primary_ip4: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
106    #[serde(
107        rename = "primary_ip6",
108        default,
109        with = "::serde_with::rust::double_option",
110        skip_serializing_if = "Option::is_none"
111    )]
112    pub primary_ip6: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
113    #[serde(
114        rename = "oob_ip",
115        default,
116        with = "::serde_with::rust::double_option",
117        skip_serializing_if = "Option::is_none"
118    )]
119    pub oob_ip: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
120    #[serde(
121        rename = "cluster",
122        default,
123        with = "::serde_with::rust::double_option",
124        skip_serializing_if = "Option::is_none"
125    )]
126    pub cluster: Option<Option<Box<crate::models::DeviceWithConfigContextRequestCluster>>>,
127    #[serde(
128        rename = "virtual_chassis",
129        default,
130        with = "::serde_with::rust::double_option",
131        skip_serializing_if = "Option::is_none"
132    )]
133    pub virtual_chassis:
134        Option<Option<Box<crate::models::DeviceWithConfigContextRequestVirtualChassis>>>,
135    #[serde(
136        rename = "vc_position",
137        default,
138        with = "::serde_with::rust::double_option",
139        skip_serializing_if = "Option::is_none"
140    )]
141    pub vc_position: Option<Option<i32>>,
142    /// Virtual chassis master election priority
143    #[serde(
144        rename = "vc_priority",
145        default,
146        with = "::serde_with::rust::double_option",
147        skip_serializing_if = "Option::is_none"
148    )]
149    pub vc_priority: Option<Option<i32>>,
150    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
151    pub description: Option<String>,
152    #[serde(
153        rename = "owner",
154        default,
155        with = "::serde_with::rust::double_option",
156        skip_serializing_if = "Option::is_none"
157    )]
158    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
159    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
160    pub comments: Option<String>,
161    #[serde(
162        rename = "config_template",
163        default,
164        with = "::serde_with::rust::double_option",
165        skip_serializing_if = "Option::is_none"
166    )]
167    pub config_template: Option<Option<Box<crate::models::DeviceRoleRequestConfigTemplate>>>,
168    /// Local config context data takes precedence over source contexts in the final rendered config context
169    #[serde(
170        rename = "local_context_data",
171        default,
172        with = "::serde_with::rust::double_option",
173        skip_serializing_if = "Option::is_none"
174    )]
175    pub local_context_data: Option<Option<serde_json::Value>>,
176    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
177    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
178    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
179    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
180}
181
182impl DeviceWithConfigContextRequest {
183    /// Base serializer class for models inheriting from PrimaryModel.
184    pub fn new(
185        device_type: crate::models::DeviceBayTemplateRequestDeviceType,
186        role: crate::models::DeviceWithConfigContextRequestRole,
187        site: crate::models::DeviceWithConfigContextRequestSite,
188    ) -> DeviceWithConfigContextRequest {
189        DeviceWithConfigContextRequest {
190            name: None,
191            device_type: Box::new(device_type),
192            role: Box::new(role),
193            tenant: None,
194            platform: None,
195            serial: None,
196            asset_tag: None,
197            site: Box::new(site),
198            location: None,
199            rack: None,
200            position: None,
201            face: None,
202            latitude: None,
203            longitude: None,
204            status: None,
205            airflow: None,
206            primary_ip4: None,
207            primary_ip6: None,
208            oob_ip: None,
209            cluster: None,
210            virtual_chassis: None,
211            vc_position: None,
212            vc_priority: None,
213            description: None,
214            owner: None,
215            comments: None,
216            config_template: None,
217            local_context_data: None,
218            tags: None,
219            custom_fields: None,
220        }
221    }
222}
223
224/// * `front` - Front * `rear` - Rear
225#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
226pub enum Face {
227    #[serde(rename = "front")]
228    Front,
229    #[serde(rename = "rear")]
230    Rear,
231    #[serde(rename = "")]
232    Empty,
233}
234
235impl Default for Face {
236    fn default() -> Face {
237        Self::Front
238    }
239}
240/// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `inventory` - Inventory * `decommissioning` - Decommissioning
241#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
242pub enum Status {
243    #[serde(rename = "offline")]
244    Offline,
245    #[serde(rename = "active")]
246    Active,
247    #[serde(rename = "planned")]
248    Planned,
249    #[serde(rename = "staged")]
250    Staged,
251    #[serde(rename = "failed")]
252    Failed,
253    #[serde(rename = "inventory")]
254    Inventory,
255    #[serde(rename = "decommissioning")]
256    Decommissioning,
257}
258
259impl Default for Status {
260    fn default() -> Status {
261        Self::Offline
262    }
263}
264/// * `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
265#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
266pub enum Airflow {
267    #[serde(rename = "front-to-rear")]
268    FrontToRear,
269    #[serde(rename = "rear-to-front")]
270    RearToFront,
271    #[serde(rename = "left-to-right")]
272    LeftToRight,
273    #[serde(rename = "right-to-left")]
274    RightToLeft,
275    #[serde(rename = "side-to-rear")]
276    SideToRear,
277    #[serde(rename = "rear-to-side")]
278    RearToSide,
279    #[serde(rename = "bottom-to-top")]
280    BottomToTop,
281    #[serde(rename = "top-to-bottom")]
282    TopToBottom,
283    #[serde(rename = "passive")]
284    Passive,
285    #[serde(rename = "mixed")]
286    Mixed,
287    #[serde(rename = "")]
288    Empty,
289}
290
291impl Default for Airflow {
292    fn default() -> Airflow {
293        Self::FrontToRear
294    }
295}