netbox_openapi/models/
rack.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/// Rack : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct Rack {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<i32>,
17    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
18    pub url: Option<String>,
19    #[serde(rename = "display_url", skip_serializing_if = "Option::is_none")]
20    pub display_url: Option<String>,
21    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
22    pub display: Option<String>,
23    #[serde(rename = "name")]
24    pub name: String,
25    #[serde(
26        rename = "facility_id",
27        default,
28        with = "::serde_with::rust::double_option",
29        skip_serializing_if = "Option::is_none"
30    )]
31    pub facility_id: Option<Option<String>>,
32    #[serde(rename = "site")]
33    pub site: Box<crate::models::BriefSite>,
34    #[serde(
35        rename = "location",
36        default,
37        with = "::serde_with::rust::double_option",
38        skip_serializing_if = "Option::is_none"
39    )]
40    pub location: Option<Option<Box<crate::models::BriefLocation>>>,
41    #[serde(
42        rename = "tenant",
43        default,
44        with = "::serde_with::rust::double_option",
45        skip_serializing_if = "Option::is_none"
46    )]
47    pub tenant: Option<Option<Box<crate::models::BriefTenant>>>,
48    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
49    pub status: Option<Box<crate::models::RackStatus>>,
50    #[serde(
51        rename = "role",
52        default,
53        with = "::serde_with::rust::double_option",
54        skip_serializing_if = "Option::is_none"
55    )]
56    pub role: Option<Option<Box<crate::models::BriefRackRole>>>,
57    #[serde(rename = "serial", skip_serializing_if = "Option::is_none")]
58    pub serial: Option<String>,
59    /// A unique tag used to identify this rack
60    #[serde(
61        rename = "asset_tag",
62        default,
63        with = "::serde_with::rust::double_option",
64        skip_serializing_if = "Option::is_none"
65    )]
66    pub asset_tag: Option<Option<String>>,
67    #[serde(
68        rename = "rack_type",
69        default,
70        with = "::serde_with::rust::double_option",
71        skip_serializing_if = "Option::is_none"
72    )]
73    pub rack_type: Option<Option<Box<crate::models::BriefRackType>>>,
74    #[serde(
75        rename = "form_factor",
76        default,
77        with = "::serde_with::rust::double_option",
78        skip_serializing_if = "Option::is_none"
79    )]
80    pub form_factor: Option<Option<Box<crate::models::RackFormFactor>>>,
81    #[serde(rename = "width", skip_serializing_if = "Option::is_none")]
82    pub width: Option<Box<crate::models::RackWidth>>,
83    /// Height in rack units
84    #[serde(rename = "u_height", skip_serializing_if = "Option::is_none")]
85    pub u_height: Option<i32>,
86    /// Starting unit for rack
87    #[serde(rename = "starting_unit", skip_serializing_if = "Option::is_none")]
88    pub starting_unit: Option<i32>,
89    #[serde(
90        rename = "weight",
91        default,
92        with = "::serde_with::rust::double_option",
93        skip_serializing_if = "Option::is_none"
94    )]
95    pub weight: Option<Option<f64>>,
96    /// Maximum load capacity for the rack
97    #[serde(
98        rename = "max_weight",
99        default,
100        with = "::serde_with::rust::double_option",
101        skip_serializing_if = "Option::is_none"
102    )]
103    pub max_weight: Option<Option<i32>>,
104    #[serde(
105        rename = "weight_unit",
106        default,
107        with = "::serde_with::rust::double_option",
108        skip_serializing_if = "Option::is_none"
109    )]
110    pub weight_unit: Option<Option<Box<crate::models::DeviceTypeWeightUnit>>>,
111    /// Units are numbered top-to-bottom
112    #[serde(rename = "desc_units", skip_serializing_if = "Option::is_none")]
113    pub desc_units: Option<bool>,
114    /// Outer dimension of rack (width)
115    #[serde(
116        rename = "outer_width",
117        default,
118        with = "::serde_with::rust::double_option",
119        skip_serializing_if = "Option::is_none"
120    )]
121    pub outer_width: Option<Option<i32>>,
122    /// Outer dimension of rack (height)
123    #[serde(
124        rename = "outer_height",
125        default,
126        with = "::serde_with::rust::double_option",
127        skip_serializing_if = "Option::is_none"
128    )]
129    pub outer_height: Option<Option<i32>>,
130    /// Outer dimension of rack (depth)
131    #[serde(
132        rename = "outer_depth",
133        default,
134        with = "::serde_with::rust::double_option",
135        skip_serializing_if = "Option::is_none"
136    )]
137    pub outer_depth: Option<Option<i32>>,
138    #[serde(
139        rename = "outer_unit",
140        default,
141        with = "::serde_with::rust::double_option",
142        skip_serializing_if = "Option::is_none"
143    )]
144    pub outer_unit: Option<Option<Box<crate::models::RackOuterUnit>>>,
145    /// Maximum depth of a mounted device, in millimeters. For four-post racks, this is the distance between the front and rear rails.
146    #[serde(
147        rename = "mounting_depth",
148        default,
149        with = "::serde_with::rust::double_option",
150        skip_serializing_if = "Option::is_none"
151    )]
152    pub mounting_depth: Option<Option<i32>>,
153    #[serde(rename = "airflow", skip_serializing_if = "Option::is_none")]
154    pub airflow: Option<Box<crate::models::RackAirflow>>,
155    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
156    pub description: Option<String>,
157    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
158    pub comments: Option<String>,
159    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
160    pub tags: Option<Vec<crate::models::NestedTag>>,
161    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
162    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
163    #[serde(
164        rename = "created",
165        default,
166        with = "::serde_with::rust::double_option",
167        skip_serializing_if = "Option::is_none"
168    )]
169    pub created: Option<Option<String>>,
170    #[serde(
171        rename = "last_updated",
172        default,
173        with = "::serde_with::rust::double_option",
174        skip_serializing_if = "Option::is_none"
175    )]
176    pub last_updated: Option<Option<String>>,
177    #[serde(rename = "device_count", skip_serializing_if = "Option::is_none")]
178    pub device_count: Option<i64>,
179    #[serde(rename = "powerfeed_count", skip_serializing_if = "Option::is_none")]
180    pub powerfeed_count: Option<i64>,
181}
182
183impl Rack {
184    /// Adds support for custom fields and tags.
185    pub fn new(name: String, site: crate::models::BriefSite) -> Rack {
186        Rack {
187            id: None,
188            url: None,
189            display_url: None,
190            display: None,
191            name,
192            facility_id: None,
193            site: Box::new(site),
194            location: None,
195            tenant: None,
196            status: None,
197            role: None,
198            serial: None,
199            asset_tag: None,
200            rack_type: None,
201            form_factor: None,
202            width: None,
203            u_height: None,
204            starting_unit: None,
205            weight: None,
206            max_weight: None,
207            weight_unit: None,
208            desc_units: None,
209            outer_width: None,
210            outer_height: None,
211            outer_depth: None,
212            outer_unit: None,
213            mounting_depth: None,
214            airflow: None,
215            description: None,
216            comments: None,
217            tags: None,
218            custom_fields: None,
219            created: None,
220            last_updated: None,
221            device_count: None,
222            powerfeed_count: None,
223        }
224    }
225}