netbox_openapi/models/
interface_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/// InterfaceTemplate : 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 InterfaceTemplate {
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::InterfaceType>,
43    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
44    pub enabled: Option<bool>,
45    #[serde(rename = "mgmt_only", skip_serializing_if = "Option::is_none")]
46    pub mgmt_only: Option<bool>,
47    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
48    pub description: Option<String>,
49    #[serde(
50        rename = "bridge",
51        default,
52        with = "::serde_with::rust::double_option",
53        skip_serializing_if = "Option::is_none"
54    )]
55    pub bridge: Option<Option<Box<crate::models::NestedInterfaceTemplate>>>,
56    #[serde(
57        rename = "poe_mode",
58        default,
59        with = "::serde_with::rust::double_option",
60        skip_serializing_if = "Option::is_none"
61    )]
62    pub poe_mode: Option<Option<Box<crate::models::InterfaceTemplatePoeMode>>>,
63    #[serde(
64        rename = "poe_type",
65        default,
66        with = "::serde_with::rust::double_option",
67        skip_serializing_if = "Option::is_none"
68    )]
69    pub poe_type: Option<Option<Box<crate::models::InterfaceTemplatePoeType>>>,
70    #[serde(
71        rename = "rf_role",
72        default,
73        with = "::serde_with::rust::double_option",
74        skip_serializing_if = "Option::is_none"
75    )]
76    pub rf_role: Option<Option<Box<crate::models::InterfaceTemplateRfRole>>>,
77    #[serde(
78        rename = "created",
79        default,
80        with = "::serde_with::rust::double_option",
81        skip_serializing_if = "Option::is_none"
82    )]
83    pub created: Option<Option<String>>,
84    #[serde(
85        rename = "last_updated",
86        default,
87        with = "::serde_with::rust::double_option",
88        skip_serializing_if = "Option::is_none"
89    )]
90    pub last_updated: Option<Option<String>>,
91}
92
93impl InterfaceTemplate {
94    /// 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>)
95    pub fn new(name: String, r#type: crate::models::InterfaceType) -> InterfaceTemplate {
96        InterfaceTemplate {
97            id: None,
98            url: None,
99            display: None,
100            device_type: None,
101            module_type: None,
102            name,
103            label: None,
104            r#type: Box::new(r#type),
105            enabled: None,
106            mgmt_only: None,
107            description: None,
108            bridge: None,
109            poe_mode: None,
110            poe_type: None,
111            rf_role: None,
112            created: None,
113            last_updated: None,
114        }
115    }
116}