netbox_openapi/models/
rack_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/// RackRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct RackRequest {
15    #[serde(rename = "name")]
16    pub name: String,
17    #[serde(
18        rename = "facility_id",
19        default,
20        with = "::serde_with::rust::double_option",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub facility_id: Option<Option<String>>,
24    #[serde(rename = "site")]
25    pub site: Box<crate::models::DeviceWithConfigContextRequestSite>,
26    #[serde(
27        rename = "location",
28        default,
29        with = "::serde_with::rust::double_option",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub location: Option<Option<Box<crate::models::DeviceWithConfigContextRequestLocation>>>,
33    #[serde(
34        rename = "tenant",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub tenant: Option<Option<Box<crate::models::AsnRangeRequestTenant>>>,
40    /// * `reserved` - Reserved * `available` - Available * `planned` - Planned * `active` - Active * `deprecated` - Deprecated
41    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
42    pub status: Option<Status>,
43    #[serde(
44        rename = "role",
45        default,
46        with = "::serde_with::rust::double_option",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub role: Option<Option<Box<crate::models::PatchedWritableRackRequestRole>>>,
50    #[serde(rename = "serial", skip_serializing_if = "Option::is_none")]
51    pub serial: Option<String>,
52    /// A unique tag used to identify this rack
53    #[serde(
54        rename = "asset_tag",
55        default,
56        with = "::serde_with::rust::double_option",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub asset_tag: Option<Option<String>>,
60    #[serde(
61        rename = "rack_type",
62        default,
63        with = "::serde_with::rust::double_option",
64        skip_serializing_if = "Option::is_none"
65    )]
66    pub rack_type: Option<Option<Box<crate::models::PatchedWritableRackRequestRackType>>>,
67    /// * `2-post-frame` - 2-post frame * `4-post-frame` - 4-post frame * `4-post-cabinet` - 4-post cabinet * `wall-frame` - Wall-mounted frame * `wall-frame-vertical` - Wall-mounted frame (vertical) * `wall-cabinet` - Wall-mounted cabinet * `wall-cabinet-vertical` - Wall-mounted cabinet (vertical)
68    #[serde(
69        rename = "form_factor",
70        default,
71        with = "::serde_with::rust::double_option",
72        skip_serializing_if = "Option::is_none"
73    )]
74    pub form_factor: Option<Option<FormFactor>>,
75    /// * `10` - 10 inches * `19` - 19 inches * `21` - 21 inches * `23` - 23 inches
76    #[serde(rename = "width", skip_serializing_if = "Option::is_none")]
77    pub width: Option<i32>,
78    /// Height in rack units
79    #[serde(rename = "u_height", skip_serializing_if = "Option::is_none")]
80    pub u_height: Option<i32>,
81    /// Starting unit for rack
82    #[serde(rename = "starting_unit", skip_serializing_if = "Option::is_none")]
83    pub starting_unit: Option<i32>,
84    #[serde(
85        rename = "weight",
86        default,
87        with = "::serde_with::rust::double_option",
88        skip_serializing_if = "Option::is_none"
89    )]
90    pub weight: Option<Option<f64>>,
91    /// Maximum load capacity for the rack
92    #[serde(
93        rename = "max_weight",
94        default,
95        with = "::serde_with::rust::double_option",
96        skip_serializing_if = "Option::is_none"
97    )]
98    pub max_weight: Option<Option<i32>>,
99    /// * `kg` - Kilograms * `g` - Grams * `lb` - Pounds * `oz` - Ounces
100    #[serde(
101        rename = "weight_unit",
102        default,
103        with = "::serde_with::rust::double_option",
104        skip_serializing_if = "Option::is_none"
105    )]
106    pub weight_unit: Option<Option<WeightUnit>>,
107    /// Units are numbered top-to-bottom
108    #[serde(rename = "desc_units", skip_serializing_if = "Option::is_none")]
109    pub desc_units: Option<bool>,
110    /// Outer dimension of rack (width)
111    #[serde(
112        rename = "outer_width",
113        default,
114        with = "::serde_with::rust::double_option",
115        skip_serializing_if = "Option::is_none"
116    )]
117    pub outer_width: Option<Option<i32>>,
118    /// Outer dimension of rack (height)
119    #[serde(
120        rename = "outer_height",
121        default,
122        with = "::serde_with::rust::double_option",
123        skip_serializing_if = "Option::is_none"
124    )]
125    pub outer_height: Option<Option<i32>>,
126    /// Outer dimension of rack (depth)
127    #[serde(
128        rename = "outer_depth",
129        default,
130        with = "::serde_with::rust::double_option",
131        skip_serializing_if = "Option::is_none"
132    )]
133    pub outer_depth: Option<Option<i32>>,
134    /// * `mm` - Millimeters * `in` - Inches
135    #[serde(
136        rename = "outer_unit",
137        default,
138        with = "::serde_with::rust::double_option",
139        skip_serializing_if = "Option::is_none"
140    )]
141    pub outer_unit: Option<Option<OuterUnit>>,
142    /// Maximum depth of a mounted device, in millimeters. For four-post racks, this is the distance between the front and rear rails.
143    #[serde(
144        rename = "mounting_depth",
145        default,
146        with = "::serde_with::rust::double_option",
147        skip_serializing_if = "Option::is_none"
148    )]
149    pub mounting_depth: Option<Option<i32>>,
150    /// * `front-to-rear` - Front to rear * `rear-to-front` - Rear to front
151    #[serde(rename = "airflow", skip_serializing_if = "Option::is_none")]
152    pub airflow: Option<Airflow>,
153    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
154    pub description: Option<String>,
155    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
156    pub comments: Option<String>,
157    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
158    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
159    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
160    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
161}
162
163impl RackRequest {
164    /// Adds support for custom fields and tags.
165    pub fn new(
166        name: String,
167        site: crate::models::DeviceWithConfigContextRequestSite,
168    ) -> RackRequest {
169        RackRequest {
170            name,
171            facility_id: None,
172            site: Box::new(site),
173            location: None,
174            tenant: None,
175            status: None,
176            role: None,
177            serial: None,
178            asset_tag: None,
179            rack_type: None,
180            form_factor: None,
181            width: None,
182            u_height: None,
183            starting_unit: None,
184            weight: None,
185            max_weight: None,
186            weight_unit: None,
187            desc_units: None,
188            outer_width: None,
189            outer_height: None,
190            outer_depth: None,
191            outer_unit: None,
192            mounting_depth: None,
193            airflow: None,
194            description: None,
195            comments: None,
196            tags: None,
197            custom_fields: None,
198        }
199    }
200}
201
202/// * `reserved` - Reserved * `available` - Available * `planned` - Planned * `active` - Active * `deprecated` - Deprecated
203#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
204pub enum Status {
205    #[serde(rename = "reserved")]
206    Reserved,
207    #[serde(rename = "available")]
208    Available,
209    #[serde(rename = "planned")]
210    Planned,
211    #[serde(rename = "active")]
212    Active,
213    #[serde(rename = "deprecated")]
214    Deprecated,
215}
216
217impl Default for Status {
218    fn default() -> Status {
219        Self::Reserved
220    }
221}
222/// * `2-post-frame` - 2-post frame * `4-post-frame` - 4-post frame * `4-post-cabinet` - 4-post cabinet * `wall-frame` - Wall-mounted frame * `wall-frame-vertical` - Wall-mounted frame (vertical) * `wall-cabinet` - Wall-mounted cabinet * `wall-cabinet-vertical` - Wall-mounted cabinet (vertical)
223#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
224pub enum FormFactor {
225    #[serde(rename = "2-post-frame")]
226    Variant2PostFrame,
227    #[serde(rename = "4-post-frame")]
228    Variant4PostFrame,
229    #[serde(rename = "4-post-cabinet")]
230    Variant4PostCabinet,
231    #[serde(rename = "wall-frame")]
232    WallFrame,
233    #[serde(rename = "wall-frame-vertical")]
234    WallFrameVertical,
235    #[serde(rename = "wall-cabinet")]
236    WallCabinet,
237    #[serde(rename = "wall-cabinet-vertical")]
238    WallCabinetVertical,
239    #[serde(rename = "")]
240    Empty,
241    #[serde(rename = "null")]
242    Null,
243}
244
245impl Default for FormFactor {
246    fn default() -> FormFactor {
247        Self::Variant2PostFrame
248    }
249}
250/// * `kg` - Kilograms * `g` - Grams * `lb` - Pounds * `oz` - Ounces
251#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
252pub enum WeightUnit {
253    #[serde(rename = "kg")]
254    Kg,
255    #[serde(rename = "g")]
256    G,
257    #[serde(rename = "lb")]
258    Lb,
259    #[serde(rename = "oz")]
260    Oz,
261    #[serde(rename = "")]
262    Empty,
263    #[serde(rename = "null")]
264    Null,
265}
266
267impl Default for WeightUnit {
268    fn default() -> WeightUnit {
269        Self::Kg
270    }
271}
272/// * `mm` - Millimeters * `in` - Inches
273#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
274pub enum OuterUnit {
275    #[serde(rename = "mm")]
276    Mm,
277    #[serde(rename = "in")]
278    In,
279    #[serde(rename = "")]
280    Empty,
281    #[serde(rename = "null")]
282    Null,
283}
284
285impl Default for OuterUnit {
286    fn default() -> OuterUnit {
287        Self::Mm
288    }
289}
290/// * `front-to-rear` - Front to rear * `rear-to-front` - Rear to front
291#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
292pub enum Airflow {
293    #[serde(rename = "front-to-rear")]
294    FrontToRear,
295    #[serde(rename = "rear-to-front")]
296    RearToFront,
297    #[serde(rename = "")]
298    Empty,
299}
300
301impl Default for Airflow {
302    fn default() -> Airflow {
303        Self::FrontToRear
304    }
305}