Skip to main content

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.6.2 (4.6)
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 = "positions", skip_serializing_if = "Option::is_none")]
46    pub positions: Option<i32>,
47    #[serde(rename = "rear_ports", skip_serializing_if = "Option::is_none")]
48    pub rear_ports: Option<Vec<crate::models::FrontPortTemplateMapping>>,
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(name: String, r#type: crate::models::FrontPortType) -> FrontPortTemplate {
70        FrontPortTemplate {
71            id: None,
72            url: None,
73            display: None,
74            device_type: None,
75            module_type: None,
76            name,
77            label: None,
78            r#type: Box::new(r#type),
79            color: None,
80            positions: None,
81            rear_ports: None,
82            description: None,
83            created: None,
84            last_updated: None,
85        }
86    }
87}