Skip to main content

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.5.9-Docker-4.0.2 (4.5)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// Rack : Base serializer class for models inheriting from PrimaryModel.
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(
158        rename = "owner",
159        default,
160        with = "::serde_with::rust::double_option",
161        skip_serializing_if = "Option::is_none"
162    )]
163    pub owner: Option<Option<Box<crate::models::BriefOwner>>>,
164    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
165    pub comments: Option<String>,
166    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
167    pub tags: Option<Vec<crate::models::NestedTag>>,
168    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
169    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
170    #[serde(
171        rename = "created",
172        default,
173        with = "::serde_with::rust::double_option",
174        skip_serializing_if = "Option::is_none"
175    )]
176    pub created: Option<Option<String>>,
177    #[serde(
178        rename = "last_updated",
179        default,
180        with = "::serde_with::rust::double_option",
181        skip_serializing_if = "Option::is_none"
182    )]
183    pub last_updated: Option<Option<String>>,
184    #[serde(rename = "device_count", skip_serializing_if = "Option::is_none")]
185    pub device_count: Option<i64>,
186    #[serde(rename = "powerfeed_count", skip_serializing_if = "Option::is_none")]
187    pub powerfeed_count: Option<i64>,
188}
189
190impl Rack {
191    /// Base serializer class for models inheriting from PrimaryModel.
192    pub fn new(name: String, site: crate::models::BriefSite) -> Rack {
193        Rack {
194            id: None,
195            url: None,
196            display_url: None,
197            display: None,
198            name,
199            facility_id: None,
200            site: Box::new(site),
201            location: None,
202            tenant: None,
203            status: None,
204            role: None,
205            serial: None,
206            asset_tag: None,
207            rack_type: None,
208            form_factor: None,
209            width: None,
210            u_height: None,
211            starting_unit: None,
212            weight: None,
213            max_weight: None,
214            weight_unit: None,
215            desc_units: None,
216            outer_width: None,
217            outer_height: None,
218            outer_depth: None,
219            outer_unit: None,
220            mounting_depth: None,
221            airflow: None,
222            description: None,
223            owner: None,
224            comments: None,
225            tags: None,
226            custom_fields: None,
227            created: None,
228            last_updated: None,
229            device_count: None,
230            powerfeed_count: None,
231        }
232    }
233}