netbox_openapi/models/
power_port_template.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/// PowerPortTemplate : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct PowerPortTemplate {
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", skip_serializing_if = "Option::is_none")]
20    pub display: Option<String>,
21    #[serde(
22        rename = "device_type",
23        default,
24        with = "::serde_with::rust::double_option",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub device_type: Option<Option<Box<crate::models::BriefDeviceType>>>,
28    #[serde(
29        rename = "module_type",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub module_type: Option<Option<Box<crate::models::BriefModuleType>>>,
35    /// {module} is accepted as a substitution for the module bay position when attached to a module type.
36    #[serde(rename = "name")]
37    pub name: String,
38    /// Physical label
39    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
40    pub label: Option<String>,
41    #[serde(
42        rename = "type",
43        default,
44        with = "::serde_with::rust::double_option",
45        skip_serializing_if = "Option::is_none"
46    )]
47    pub r#type: Option<Option<Box<crate::models::PowerPortType>>>,
48    /// Maximum power draw (watts)
49    #[serde(
50        rename = "maximum_draw",
51        default,
52        with = "::serde_with::rust::double_option",
53        skip_serializing_if = "Option::is_none"
54    )]
55    pub maximum_draw: Option<Option<i32>>,
56    /// Allocated power draw (watts)
57    #[serde(
58        rename = "allocated_draw",
59        default,
60        with = "::serde_with::rust::double_option",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub allocated_draw: Option<Option<i32>>,
64    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
65    pub description: Option<String>,
66    #[serde(
67        rename = "created",
68        default,
69        with = "::serde_with::rust::double_option",
70        skip_serializing_if = "Option::is_none"
71    )]
72    pub created: Option<Option<String>>,
73    #[serde(
74        rename = "last_updated",
75        default,
76        with = "::serde_with::rust::double_option",
77        skip_serializing_if = "Option::is_none"
78    )]
79    pub last_updated: Option<Option<String>>,
80}
81
82impl PowerPortTemplate {
83    /// Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
84    pub fn new(name: String) -> PowerPortTemplate {
85        PowerPortTemplate {
86            id: None,
87            url: None,
88            display: None,
89            device_type: None,
90            module_type: None,
91            name,
92            label: None,
93            r#type: None,
94            maximum_draw: None,
95            allocated_draw: None,
96            description: None,
97            created: None,
98            last_updated: None,
99        }
100    }
101}