netbox_openapi/models/
writable_vm_interface_request.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/// WritableVmInterfaceRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableVmInterfaceRequest {
15    #[serde(rename = "virtual_machine")]
16    pub virtual_machine: Box<crate::models::PatchedVirtualDiskRequestVirtualMachine>,
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
20    pub enabled: Option<bool>,
21    #[serde(
22        rename = "parent",
23        default,
24        with = "::serde_with::rust::double_option",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub parent: Option<Option<i32>>,
28    #[serde(
29        rename = "bridge",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub bridge: Option<Option<i32>>,
35    #[serde(
36        rename = "mtu",
37        default,
38        with = "::serde_with::rust::double_option",
39        skip_serializing_if = "Option::is_none"
40    )]
41    pub mtu: Option<Option<i32>>,
42    #[serde(
43        rename = "primary_mac_address",
44        default,
45        with = "::serde_with::rust::double_option",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub primary_mac_address: Option<Option<Box<crate::models::InterfaceRequestPrimaryMacAddress>>>,
49    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
50    pub description: Option<String>,
51    /// IEEE 802.1Q tagging strategy  * `access` - Access * `tagged` - Tagged * `tagged-all` - Tagged (All) * `q-in-q` - Q-in-Q (802.1ad)
52    #[serde(
53        rename = "mode",
54        default,
55        with = "::serde_with::rust::double_option",
56        skip_serializing_if = "Option::is_none"
57    )]
58    pub mode: Option<Option<Mode>>,
59    #[serde(
60        rename = "untagged_vlan",
61        default,
62        with = "::serde_with::rust::double_option",
63        skip_serializing_if = "Option::is_none"
64    )]
65    pub untagged_vlan: Option<Option<Box<crate::models::InterfaceRequestUntaggedVlan>>>,
66    #[serde(rename = "tagged_vlans", skip_serializing_if = "Option::is_none")]
67    pub tagged_vlans: Option<Vec<i32>>,
68    #[serde(
69        rename = "qinq_svlan",
70        default,
71        with = "::serde_with::rust::double_option",
72        skip_serializing_if = "Option::is_none"
73    )]
74    pub qinq_svlan: Option<Option<Box<crate::models::InterfaceRequestUntaggedVlan>>>,
75    #[serde(
76        rename = "vlan_translation_policy",
77        default,
78        with = "::serde_with::rust::double_option",
79        skip_serializing_if = "Option::is_none"
80    )]
81    pub vlan_translation_policy:
82        Option<Option<Box<crate::models::InterfaceRequestVlanTranslationPolicy>>>,
83    #[serde(
84        rename = "vrf",
85        default,
86        with = "::serde_with::rust::double_option",
87        skip_serializing_if = "Option::is_none"
88    )]
89    pub vrf: Option<Option<Box<crate::models::IpAddressRequestVrf>>>,
90    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
91    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
92    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
93    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
94}
95
96impl WritableVmInterfaceRequest {
97    /// Adds support for custom fields and tags.
98    pub fn new(
99        virtual_machine: crate::models::PatchedVirtualDiskRequestVirtualMachine,
100        name: String,
101    ) -> WritableVmInterfaceRequest {
102        WritableVmInterfaceRequest {
103            virtual_machine: Box::new(virtual_machine),
104            name,
105            enabled: None,
106            parent: None,
107            bridge: None,
108            mtu: None,
109            primary_mac_address: None,
110            description: None,
111            mode: None,
112            untagged_vlan: None,
113            tagged_vlans: None,
114            qinq_svlan: None,
115            vlan_translation_policy: None,
116            vrf: None,
117            tags: None,
118            custom_fields: None,
119        }
120    }
121}
122
123/// IEEE 802.1Q tagging strategy  * `access` - Access * `tagged` - Tagged * `tagged-all` - Tagged (All) * `q-in-q` - Q-in-Q (802.1ad)
124#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
125pub enum Mode {
126    #[serde(rename = "access")]
127    Access,
128    #[serde(rename = "tagged")]
129    Tagged,
130    #[serde(rename = "tagged-all")]
131    TaggedAll,
132    #[serde(rename = "q-in-q")]
133    QInQ,
134    #[serde(rename = "")]
135    Empty,
136    #[serde(rename = "null")]
137    Null,
138}
139
140impl Default for Mode {
141    fn default() -> Mode {
142        Self::Access
143    }
144}