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