Skip to main content

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.6.2 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// WritableVmInterfaceRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.
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(
91        rename = "owner",
92        default,
93        with = "::serde_with::rust::double_option",
94        skip_serializing_if = "Option::is_none"
95    )]
96    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
97    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
98    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
99    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
100    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
101}
102
103impl WritableVmInterfaceRequest {
104    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
105    pub fn new(
106        virtual_machine: crate::models::PatchedVirtualDiskRequestVirtualMachine,
107        name: String,
108    ) -> WritableVmInterfaceRequest {
109        WritableVmInterfaceRequest {
110            virtual_machine: Box::new(virtual_machine),
111            name,
112            enabled: None,
113            parent: None,
114            bridge: None,
115            mtu: None,
116            primary_mac_address: None,
117            description: None,
118            mode: None,
119            untagged_vlan: None,
120            tagged_vlans: None,
121            qinq_svlan: None,
122            vlan_translation_policy: None,
123            vrf: None,
124            owner: None,
125            tags: None,
126            custom_fields: None,
127        }
128    }
129}
130
131/// IEEE 802.1Q tagging strategy  * `access` - Access * `tagged` - Tagged * `tagged-all` - Tagged (All) * `q-in-q` - Q-in-Q (802.1ad)
132#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
133pub enum Mode {
134    #[serde(rename = "access")]
135    Access,
136    #[serde(rename = "tagged")]
137    Tagged,
138    #[serde(rename = "tagged-all")]
139    TaggedAll,
140    #[serde(rename = "q-in-q")]
141    QInQ,
142    #[serde(rename = "")]
143    Empty,
144    #[serde(rename = "null")]
145    Null,
146}
147
148impl Default for Mode {
149    fn default() -> Mode {
150        Self::Access
151    }
152}