Skip to main content

netbox_openapi/models/
power_port.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.6.2 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// PowerPort : Adds an `owner` field for models which have a ForeignKey to users.Owner.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct PowerPort {
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 = "device")]
24    pub device: Box<crate::models::BriefDevice>,
25    #[serde(
26        rename = "module",
27        default,
28        with = "::serde_with::rust::double_option",
29        skip_serializing_if = "Option::is_none"
30    )]
31    pub module: Option<Option<Box<crate::models::BriefModule>>>,
32    #[serde(rename = "name")]
33    pub name: String,
34    /// Physical label
35    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
36    pub label: Option<String>,
37    #[serde(
38        rename = "type",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub r#type: Option<Option<Box<crate::models::PowerPortType>>>,
44    /// Maximum power draw (watts)
45    #[serde(
46        rename = "maximum_draw",
47        default,
48        with = "::serde_with::rust::double_option",
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub maximum_draw: Option<Option<i32>>,
52    /// Allocated power draw (watts)
53    #[serde(
54        rename = "allocated_draw",
55        default,
56        with = "::serde_with::rust::double_option",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub allocated_draw: Option<Option<i32>>,
60    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
61    pub description: Option<String>,
62    /// Treat as if a cable is connected
63    #[serde(rename = "mark_connected", skip_serializing_if = "Option::is_none")]
64    pub mark_connected: Option<bool>,
65    #[serde(
66        rename = "cable",
67        default,
68        with = "::serde_with::rust::double_option",
69        skip_serializing_if = "Option::is_none"
70    )]
71    pub cable: Option<Option<Box<crate::models::BriefCable>>>,
72    /// * `A` - A * `B` - B
73    #[serde(
74        rename = "cable_end",
75        default,
76        with = "::serde_with::rust::double_option",
77        skip_serializing_if = "Option::is_none"
78    )]
79    pub cable_end: Option<Option<CableEnd>>,
80    #[serde(rename = "link_peers", skip_serializing_if = "Option::is_none")]
81    pub link_peers: Option<Vec<serde_json::Value>>,
82    /// Return the type of the peer link terminations, or None.
83    #[serde(
84        rename = "link_peers_type",
85        default,
86        with = "::serde_with::rust::double_option",
87        skip_serializing_if = "Option::is_none"
88    )]
89    pub link_peers_type: Option<Option<String>>,
90    #[serde(
91        rename = "connected_endpoints",
92        default,
93        with = "::serde_with::rust::double_option",
94        skip_serializing_if = "Option::is_none"
95    )]
96    pub connected_endpoints: Option<Option<Vec<serde_json::Value>>>,
97    #[serde(
98        rename = "connected_endpoints_type",
99        default,
100        with = "::serde_with::rust::double_option",
101        skip_serializing_if = "Option::is_none"
102    )]
103    pub connected_endpoints_type: Option<Option<String>>,
104    #[serde(
105        rename = "connected_endpoints_reachable",
106        skip_serializing_if = "Option::is_none"
107    )]
108    pub connected_endpoints_reachable: Option<bool>,
109    #[serde(
110        rename = "owner",
111        default,
112        with = "::serde_with::rust::double_option",
113        skip_serializing_if = "Option::is_none"
114    )]
115    pub owner: Option<Option<Box<crate::models::BriefOwner>>>,
116    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
117    pub tags: Option<Vec<crate::models::NestedTag>>,
118    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
119    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
120    #[serde(
121        rename = "created",
122        default,
123        with = "::serde_with::rust::double_option",
124        skip_serializing_if = "Option::is_none"
125    )]
126    pub created: Option<Option<String>>,
127    #[serde(
128        rename = "last_updated",
129        default,
130        with = "::serde_with::rust::double_option",
131        skip_serializing_if = "Option::is_none"
132    )]
133    pub last_updated: Option<Option<String>>,
134    #[serde(rename = "_occupied", skip_serializing_if = "Option::is_none")]
135    pub _occupied: Option<bool>,
136}
137
138impl PowerPort {
139    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
140    pub fn new(device: crate::models::BriefDevice, name: String) -> PowerPort {
141        PowerPort {
142            id: None,
143            url: None,
144            display_url: None,
145            display: None,
146            device: Box::new(device),
147            module: None,
148            name,
149            label: None,
150            r#type: None,
151            maximum_draw: None,
152            allocated_draw: None,
153            description: None,
154            mark_connected: None,
155            cable: None,
156            cable_end: None,
157            link_peers: None,
158            link_peers_type: None,
159            connected_endpoints: None,
160            connected_endpoints_type: None,
161            connected_endpoints_reachable: None,
162            owner: None,
163            tags: None,
164            custom_fields: None,
165            created: None,
166            last_updated: None,
167            _occupied: None,
168        }
169    }
170}
171
172/// * `A` - A * `B` - B
173#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
174pub enum CableEnd {
175    #[serde(rename = "A")]
176    A,
177    #[serde(rename = "B")]
178    B,
179    #[serde(rename = "null")]
180    Null,
181}
182
183impl Default for CableEnd {
184    fn default() -> CableEnd {
185        Self::A
186    }
187}