netbox_openapi/models/
rear_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/// RearPortTemplate : 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 RearPortTemplate {
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(rename = "type")]
42    pub r#type: Box<crate::models::FrontPortType>,
43    #[serde(rename = "color", skip_serializing_if = "Option::is_none")]
44    pub color: Option<String>,
45    #[serde(rename = "positions", skip_serializing_if = "Option::is_none")]
46    pub positions: Option<i32>,
47    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
48    pub description: Option<String>,
49    #[serde(
50        rename = "created",
51        default,
52        with = "::serde_with::rust::double_option",
53        skip_serializing_if = "Option::is_none"
54    )]
55    pub created: Option<Option<String>>,
56    #[serde(
57        rename = "last_updated",
58        default,
59        with = "::serde_with::rust::double_option",
60        skip_serializing_if = "Option::is_none"
61    )]
62    pub last_updated: Option<Option<String>>,
63}
64
65impl RearPortTemplate {
66    /// 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>)
67    pub fn new(name: String, r#type: crate::models::FrontPortType) -> RearPortTemplate {
68        RearPortTemplate {
69            id: None,
70            url: None,
71            display: None,
72            device_type: None,
73            module_type: None,
74            name,
75            label: None,
76            r#type: Box::new(r#type),
77            color: None,
78            positions: None,
79            description: None,
80            created: None,
81            last_updated: None,
82        }
83    }
84}