netbox_openapi/models/
rack_type.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/// RackType : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct RackType {
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 = "manufacturer")]
24    pub manufacturer: Box<crate::models::BriefManufacturer>,
25    #[serde(rename = "model")]
26    pub model: String,
27    #[serde(rename = "slug")]
28    pub slug: String,
29    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
30    pub description: Option<String>,
31    #[serde(
32        rename = "form_factor",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub form_factor: Option<Option<Box<crate::models::RackFormFactor>>>,
38    #[serde(rename = "width", skip_serializing_if = "Option::is_none")]
39    pub width: Option<Box<crate::models::RackWidth>>,
40    /// Height in rack units
41    #[serde(rename = "u_height", skip_serializing_if = "Option::is_none")]
42    pub u_height: Option<i32>,
43    /// Starting unit for rack
44    #[serde(rename = "starting_unit", skip_serializing_if = "Option::is_none")]
45    pub starting_unit: Option<i32>,
46    /// Units are numbered top-to-bottom
47    #[serde(rename = "desc_units", skip_serializing_if = "Option::is_none")]
48    pub desc_units: Option<bool>,
49    /// Outer dimension of rack (width)
50    #[serde(
51        rename = "outer_width",
52        default,
53        with = "::serde_with::rust::double_option",
54        skip_serializing_if = "Option::is_none"
55    )]
56    pub outer_width: Option<Option<i32>>,
57    /// Outer dimension of rack (height)
58    #[serde(
59        rename = "outer_height",
60        default,
61        with = "::serde_with::rust::double_option",
62        skip_serializing_if = "Option::is_none"
63    )]
64    pub outer_height: Option<Option<i32>>,
65    /// Outer dimension of rack (depth)
66    #[serde(
67        rename = "outer_depth",
68        default,
69        with = "::serde_with::rust::double_option",
70        skip_serializing_if = "Option::is_none"
71    )]
72    pub outer_depth: Option<Option<i32>>,
73    #[serde(
74        rename = "outer_unit",
75        default,
76        with = "::serde_with::rust::double_option",
77        skip_serializing_if = "Option::is_none"
78    )]
79    pub outer_unit: Option<Option<Box<crate::models::RackOuterUnit>>>,
80    #[serde(
81        rename = "weight",
82        default,
83        with = "::serde_with::rust::double_option",
84        skip_serializing_if = "Option::is_none"
85    )]
86    pub weight: Option<Option<f64>>,
87    /// Maximum load capacity for the rack
88    #[serde(
89        rename = "max_weight",
90        default,
91        with = "::serde_with::rust::double_option",
92        skip_serializing_if = "Option::is_none"
93    )]
94    pub max_weight: Option<Option<i32>>,
95    #[serde(
96        rename = "weight_unit",
97        default,
98        with = "::serde_with::rust::double_option",
99        skip_serializing_if = "Option::is_none"
100    )]
101    pub weight_unit: Option<Option<Box<crate::models::DeviceTypeWeightUnit>>>,
102    /// Maximum depth of a mounted device, in millimeters. For four-post racks, this is the distance between the front and rear rails.
103    #[serde(
104        rename = "mounting_depth",
105        default,
106        with = "::serde_with::rust::double_option",
107        skip_serializing_if = "Option::is_none"
108    )]
109    pub mounting_depth: Option<Option<i32>>,
110    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
111    pub comments: Option<String>,
112    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
113    pub tags: Option<Vec<crate::models::NestedTag>>,
114    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
115    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
116    #[serde(
117        rename = "created",
118        default,
119        with = "::serde_with::rust::double_option",
120        skip_serializing_if = "Option::is_none"
121    )]
122    pub created: Option<Option<String>>,
123    #[serde(
124        rename = "last_updated",
125        default,
126        with = "::serde_with::rust::double_option",
127        skip_serializing_if = "Option::is_none"
128    )]
129    pub last_updated: Option<Option<String>>,
130}
131
132impl RackType {
133    /// Adds support for custom fields and tags.
134    pub fn new(
135        manufacturer: crate::models::BriefManufacturer,
136        model: String,
137        slug: String,
138    ) -> RackType {
139        RackType {
140            id: None,
141            url: None,
142            display_url: None,
143            display: None,
144            manufacturer: Box::new(manufacturer),
145            model,
146            slug,
147            description: None,
148            form_factor: None,
149            width: None,
150            u_height: None,
151            starting_unit: None,
152            desc_units: None,
153            outer_width: None,
154            outer_height: None,
155            outer_depth: None,
156            outer_unit: None,
157            weight: None,
158            max_weight: None,
159            weight_unit: None,
160            mounting_depth: None,
161            comments: None,
162            tags: None,
163            custom_fields: None,
164            created: None,
165            last_updated: None,
166        }
167    }
168}