netbox_openapi/models/
writable_ip_address_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/// WritableIpAddressRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableIpAddressRequest {
15    #[serde(rename = "address")]
16    pub address: String,
17    #[serde(
18        rename = "vrf",
19        default,
20        with = "::serde_with::rust::double_option",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub vrf: Option<Option<Box<crate::models::IpAddressRequestVrf>>>,
24    #[serde(
25        rename = "tenant",
26        default,
27        with = "::serde_with::rust::double_option",
28        skip_serializing_if = "Option::is_none"
29    )]
30    pub tenant: Option<Option<Box<crate::models::AsnRangeRequestTenant>>>,
31    /// The operational status of this IP  * `active` - Active * `reserved` - Reserved * `deprecated` - Deprecated * `dhcp` - DHCP * `slaac` - SLAAC
32    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
33    pub status: Option<Status>,
34    /// The functional role of this IP  * `loopback` - Loopback * `secondary` - Secondary * `anycast` - Anycast * `vip` - VIP * `vrrp` - VRRP * `hsrp` - HSRP * `glbp` - GLBP * `carp` - CARP
35    #[serde(
36        rename = "role",
37        default,
38        with = "::serde_with::rust::double_option",
39        skip_serializing_if = "Option::is_none"
40    )]
41    pub role: Option<Option<Role>>,
42    #[serde(
43        rename = "assigned_object_type",
44        default,
45        with = "::serde_with::rust::double_option",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub assigned_object_type: Option<Option<String>>,
49    #[serde(
50        rename = "assigned_object_id",
51        default,
52        with = "::serde_with::rust::double_option",
53        skip_serializing_if = "Option::is_none"
54    )]
55    pub assigned_object_id: Option<Option<i64>>,
56    /// The IP for which this address is the \"outside\" IP
57    #[serde(
58        rename = "nat_inside",
59        default,
60        with = "::serde_with::rust::double_option",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub nat_inside: Option<Option<i32>>,
64    /// Hostname or FQDN (not case-sensitive)
65    #[serde(rename = "dns_name", skip_serializing_if = "Option::is_none")]
66    pub dns_name: Option<String>,
67    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
68    pub description: Option<String>,
69    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
70    pub comments: Option<String>,
71    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
72    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
73    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
74    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
75}
76
77impl WritableIpAddressRequest {
78    /// Adds support for custom fields and tags.
79    pub fn new(address: String) -> WritableIpAddressRequest {
80        WritableIpAddressRequest {
81            address,
82            vrf: None,
83            tenant: None,
84            status: None,
85            role: None,
86            assigned_object_type: None,
87            assigned_object_id: None,
88            nat_inside: None,
89            dns_name: None,
90            description: None,
91            comments: None,
92            tags: None,
93            custom_fields: None,
94        }
95    }
96}
97
98/// The operational status of this IP  * `active` - Active * `reserved` - Reserved * `deprecated` - Deprecated * `dhcp` - DHCP * `slaac` - SLAAC
99#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
100pub enum Status {
101    #[serde(rename = "active")]
102    Active,
103    #[serde(rename = "reserved")]
104    Reserved,
105    #[serde(rename = "deprecated")]
106    Deprecated,
107    #[serde(rename = "dhcp")]
108    Dhcp,
109    #[serde(rename = "slaac")]
110    Slaac,
111}
112
113impl Default for Status {
114    fn default() -> Status {
115        Self::Active
116    }
117}
118/// The functional role of this IP  * `loopback` - Loopback * `secondary` - Secondary * `anycast` - Anycast * `vip` - VIP * `vrrp` - VRRP * `hsrp` - HSRP * `glbp` - GLBP * `carp` - CARP
119#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
120pub enum Role {
121    #[serde(rename = "loopback")]
122    Loopback,
123    #[serde(rename = "secondary")]
124    Secondary,
125    #[serde(rename = "anycast")]
126    Anycast,
127    #[serde(rename = "vip")]
128    Vip,
129    #[serde(rename = "vrrp")]
130    Vrrp,
131    #[serde(rename = "hsrp")]
132    Hsrp,
133    #[serde(rename = "glbp")]
134    Glbp,
135    #[serde(rename = "carp")]
136    Carp,
137    #[serde(rename = "")]
138    Empty,
139    #[serde(rename = "null")]
140    Null,
141}
142
143impl Default for Role {
144    fn default() -> Role {
145        Self::Loopback
146    }
147}