netbox_openapi/models/
power_outlet_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/// PowerOutletTemplate : 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 PowerOutletTemplate {
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::PowerOutletType>>>,
48    #[serde(
49        rename = "power_port",
50        default,
51        with = "::serde_with::rust::double_option",
52        skip_serializing_if = "Option::is_none"
53    )]
54    pub power_port: Option<Option<Box<crate::models::BriefPowerPortTemplate>>>,
55    #[serde(
56        rename = "feed_leg",
57        default,
58        with = "::serde_with::rust::double_option",
59        skip_serializing_if = "Option::is_none"
60    )]
61    pub feed_leg: Option<Option<Box<crate::models::PowerOutletFeedLeg>>>,
62    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
63    pub description: Option<String>,
64    #[serde(
65        rename = "created",
66        default,
67        with = "::serde_with::rust::double_option",
68        skip_serializing_if = "Option::is_none"
69    )]
70    pub created: Option<Option<String>>,
71    #[serde(
72        rename = "last_updated",
73        default,
74        with = "::serde_with::rust::double_option",
75        skip_serializing_if = "Option::is_none"
76    )]
77    pub last_updated: Option<Option<String>>,
78}
79
80impl PowerOutletTemplate {
81    /// 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>)
82    pub fn new(name: String) -> PowerOutletTemplate {
83        PowerOutletTemplate {
84            id: None,
85            url: None,
86            display: None,
87            device_type: None,
88            module_type: None,
89            name,
90            label: None,
91            r#type: None,
92            power_port: None,
93            feed_leg: None,
94            description: None,
95            created: None,
96            last_updated: None,
97        }
98    }
99}