netbox_openapi/models/
writable_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/// WritableRackRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableRackRequest {
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    /// Rail-to-rail width  * `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<Width>,
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(
152        rename = "airflow",
153        default,
154        with = "::serde_with::rust::double_option",
155        skip_serializing_if = "Option::is_none"
156    )]
157    pub airflow: Option<Option<Airflow>>,
158    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
159    pub description: Option<String>,
160    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
161    pub comments: Option<String>,
162    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
163    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
164    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
165    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
166}
167
168impl WritableRackRequest {
169    /// Adds support for custom fields and tags.
170    pub fn new(
171        name: String,
172        site: crate::models::DeviceWithConfigContextRequestSite,
173    ) -> WritableRackRequest {
174        WritableRackRequest {
175            name,
176            facility_id: None,
177            site: Box::new(site),
178            location: None,
179            tenant: None,
180            status: None,
181            role: None,
182            serial: None,
183            asset_tag: None,
184            rack_type: None,
185            form_factor: None,
186            width: None,
187            u_height: None,
188            starting_unit: None,
189            weight: None,
190            max_weight: None,
191            weight_unit: None,
192            desc_units: None,
193            outer_width: None,
194            outer_height: None,
195            outer_depth: None,
196            outer_unit: None,
197            mounting_depth: None,
198            airflow: None,
199            description: None,
200            comments: None,
201            tags: None,
202            custom_fields: None,
203        }
204    }
205}
206
207/// * `reserved` - Reserved * `available` - Available * `planned` - Planned * `active` - Active * `deprecated` - Deprecated
208#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
209pub enum Status {
210    #[serde(rename = "reserved")]
211    Reserved,
212    #[serde(rename = "available")]
213    Available,
214    #[serde(rename = "planned")]
215    Planned,
216    #[serde(rename = "active")]
217    Active,
218    #[serde(rename = "deprecated")]
219    Deprecated,
220}
221
222impl Default for Status {
223    fn default() -> Status {
224        Self::Reserved
225    }
226}
227/// * `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)
228#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
229pub enum FormFactor {
230    #[serde(rename = "2-post-frame")]
231    Variant2PostFrame,
232    #[serde(rename = "4-post-frame")]
233    Variant4PostFrame,
234    #[serde(rename = "4-post-cabinet")]
235    Variant4PostCabinet,
236    #[serde(rename = "wall-frame")]
237    WallFrame,
238    #[serde(rename = "wall-frame-vertical")]
239    WallFrameVertical,
240    #[serde(rename = "wall-cabinet")]
241    WallCabinet,
242    #[serde(rename = "wall-cabinet-vertical")]
243    WallCabinetVertical,
244    #[serde(rename = "")]
245    Empty,
246    #[serde(rename = "null")]
247    Null,
248}
249
250impl Default for FormFactor {
251    fn default() -> FormFactor {
252        Self::Variant2PostFrame
253    }
254}
255/// Rail-to-rail width  * `10` - 10 inches * `19` - 19 inches * `21` - 21 inches * `23` - 23 inches
256#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
257pub enum Width {
258    #[serde(rename = "10")]
259    Variant10,
260    #[serde(rename = "19")]
261    Variant19,
262    #[serde(rename = "21")]
263    Variant21,
264    #[serde(rename = "23")]
265    Variant23,
266}
267
268impl Default for Width {
269    fn default() -> Width {
270        Self::Variant10
271    }
272}
273/// * `kg` - Kilograms * `g` - Grams * `lb` - Pounds * `oz` - Ounces
274#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
275pub enum WeightUnit {
276    #[serde(rename = "kg")]
277    Kg,
278    #[serde(rename = "g")]
279    G,
280    #[serde(rename = "lb")]
281    Lb,
282    #[serde(rename = "oz")]
283    Oz,
284    #[serde(rename = "")]
285    Empty,
286    #[serde(rename = "null")]
287    Null,
288}
289
290impl Default for WeightUnit {
291    fn default() -> WeightUnit {
292        Self::Kg
293    }
294}
295/// * `mm` - Millimeters * `in` - Inches
296#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
297pub enum OuterUnit {
298    #[serde(rename = "mm")]
299    Mm,
300    #[serde(rename = "in")]
301    In,
302    #[serde(rename = "")]
303    Empty,
304    #[serde(rename = "null")]
305    Null,
306}
307
308impl Default for OuterUnit {
309    fn default() -> OuterUnit {
310        Self::Mm
311    }
312}
313/// * `front-to-rear` - Front to rear * `rear-to-front` - Rear to front
314#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
315pub enum Airflow {
316    #[serde(rename = "front-to-rear")]
317    FrontToRear,
318    #[serde(rename = "rear-to-front")]
319    RearToFront,
320    #[serde(rename = "")]
321    Empty,
322    #[serde(rename = "null")]
323    Null,
324}
325
326impl Default for Airflow {
327    fn default() -> Airflow {
328        Self::FrontToRear
329    }
330}