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