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.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// DeviceWithConfigContextRequest : Adds support for custom fields and tags.
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(rename = "comments", skip_serializing_if = "Option::is_none")]
153    pub comments: Option<String>,
154    #[serde(
155        rename = "config_template",
156        default,
157        with = "::serde_with::rust::double_option",
158        skip_serializing_if = "Option::is_none"
159    )]
160    pub config_template: Option<Option<Box<crate::models::DeviceRoleRequestConfigTemplate>>>,
161    /// Local config context data takes precedence over source contexts in the final rendered config context
162    #[serde(
163        rename = "local_context_data",
164        default,
165        with = "::serde_with::rust::double_option",
166        skip_serializing_if = "Option::is_none"
167    )]
168    pub local_context_data: Option<Option<serde_json::Value>>,
169    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
170    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
171    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
172    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
173}
174
175impl DeviceWithConfigContextRequest {
176    /// Adds support for custom fields and tags.
177    pub fn new(
178        device_type: crate::models::DeviceBayTemplateRequestDeviceType,
179        role: crate::models::DeviceWithConfigContextRequestRole,
180        site: crate::models::DeviceWithConfigContextRequestSite,
181    ) -> DeviceWithConfigContextRequest {
182        DeviceWithConfigContextRequest {
183            name: None,
184            device_type: Box::new(device_type),
185            role: Box::new(role),
186            tenant: None,
187            platform: None,
188            serial: None,
189            asset_tag: None,
190            site: Box::new(site),
191            location: None,
192            rack: None,
193            position: None,
194            face: None,
195            latitude: None,
196            longitude: None,
197            status: None,
198            airflow: None,
199            primary_ip4: None,
200            primary_ip6: None,
201            oob_ip: None,
202            cluster: None,
203            virtual_chassis: None,
204            vc_position: None,
205            vc_priority: None,
206            description: None,
207            comments: None,
208            config_template: None,
209            local_context_data: None,
210            tags: None,
211            custom_fields: None,
212        }
213    }
214}
215
216/// * `front` - Front * `rear` - Rear
217#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
218pub enum Face {
219    #[serde(rename = "front")]
220    Front,
221    #[serde(rename = "rear")]
222    Rear,
223    #[serde(rename = "")]
224    Empty,
225}
226
227impl Default for Face {
228    fn default() -> Face {
229        Self::Front
230    }
231}
232/// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `inventory` - Inventory * `decommissioning` - Decommissioning
233#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
234pub enum Status {
235    #[serde(rename = "offline")]
236    Offline,
237    #[serde(rename = "active")]
238    Active,
239    #[serde(rename = "planned")]
240    Planned,
241    #[serde(rename = "staged")]
242    Staged,
243    #[serde(rename = "failed")]
244    Failed,
245    #[serde(rename = "inventory")]
246    Inventory,
247    #[serde(rename = "decommissioning")]
248    Decommissioning,
249}
250
251impl Default for Status {
252    fn default() -> Status {
253        Self::Offline
254    }
255}
256/// * `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
257#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
258pub enum Airflow {
259    #[serde(rename = "front-to-rear")]
260    FrontToRear,
261    #[serde(rename = "rear-to-front")]
262    RearToFront,
263    #[serde(rename = "left-to-right")]
264    LeftToRight,
265    #[serde(rename = "right-to-left")]
266    RightToLeft,
267    #[serde(rename = "side-to-rear")]
268    SideToRear,
269    #[serde(rename = "rear-to-side")]
270    RearToSide,
271    #[serde(rename = "bottom-to-top")]
272    BottomToTop,
273    #[serde(rename = "top-to-bottom")]
274    TopToBottom,
275    #[serde(rename = "passive")]
276    Passive,
277    #[serde(rename = "mixed")]
278    Mixed,
279    #[serde(rename = "")]
280    Empty,
281}
282
283impl Default for Airflow {
284    fn default() -> Airflow {
285        Self::FrontToRear
286    }
287}