proxmox_api/generated/cluster/sdn/vnets/vnet/
ips.rs1#[derive(Debug, Clone)]
2pub struct IpsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> IpsClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}{}", parent_path, "/ips"),
14 }
15 }
16}
17impl<T> IpsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Delete IP Mappings in a VNet"]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/sdn/zones/{zone}/{vnet}\", [\"SDN.Allocate\"])"]
24 pub async fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
25 let path = self.path.to_string();
26 self.client.delete(&path, ¶ms).await
27 }
28}
29impl<T> IpsClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Create IP Mapping in a VNet"]
34 #[doc = ""]
35 #[doc = "Permission check: perm(\"/sdn/zones/{zone}/{vnet}\", [\"SDN.Allocate\"])"]
36 pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
37 let path = self.path.to_string();
38 self.client.post(&path, ¶ms).await
39 }
40}
41impl<T> IpsClient<T>
42where
43 T: crate::client::Client,
44{
45 #[doc = "Update IP Mapping in a VNet"]
46 #[doc = ""]
47 #[doc = "Permission check: perm(\"/sdn/zones/{zone}/{vnet}\", [\"SDN.Allocate\"])"]
48 pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
49 let path = self.path.to_string();
50 self.client.put(&path, ¶ms).await
51 }
52}
53impl DeleteParams {
54 pub fn new(ip: ::std::net::IpAddr, zone: String) -> Self {
55 Self {
56 ip,
57 zone,
58 mac: ::std::default::Default::default(),
59 additional_properties: ::std::default::Default::default(),
60 }
61 }
62}
63#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
64pub struct DeleteParams {
65 #[doc = "The IP address to delete"]
66 #[doc = ""]
67 pub ip: ::std::net::IpAddr,
68 #[serde(skip_serializing_if = "Option::is_none", default)]
69 #[doc = "Unicast MAC address."]
70 #[doc = ""]
71 #[doc = "A common MAC address with the I/G (Individual/Group) bit not set."]
72 #[doc = ""]
73 pub mac: Option<crate::types::MacAddr<false>>,
74 #[doc = "The SDN zone object identifier."]
75 #[doc = ""]
76 pub zone: String,
77 #[serde(
78 flatten,
79 default,
80 skip_serializing_if = "::std::collections::HashMap::is_empty"
81 )]
82 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
83}
84impl PostParams {
85 pub fn new(ip: ::std::net::IpAddr, zone: String) -> Self {
86 Self {
87 ip,
88 zone,
89 mac: ::std::default::Default::default(),
90 additional_properties: ::std::default::Default::default(),
91 }
92 }
93}
94#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
95pub struct PostParams {
96 #[doc = "The IP address to associate with the given MAC address"]
97 #[doc = ""]
98 pub ip: ::std::net::IpAddr,
99 #[serde(skip_serializing_if = "Option::is_none", default)]
100 #[doc = "Unicast MAC address."]
101 #[doc = ""]
102 #[doc = "A common MAC address with the I/G (Individual/Group) bit not set."]
103 #[doc = ""]
104 pub mac: Option<crate::types::MacAddr<false>>,
105 #[doc = "The SDN zone object identifier."]
106 #[doc = ""]
107 pub zone: String,
108 #[serde(
109 flatten,
110 default,
111 skip_serializing_if = "::std::collections::HashMap::is_empty"
112 )]
113 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
114}
115impl PutParams {
116 pub fn new(ip: ::std::net::IpAddr, zone: String) -> Self {
117 Self {
118 ip,
119 zone,
120 mac: ::std::default::Default::default(),
121 vmid: ::std::default::Default::default(),
122 additional_properties: ::std::default::Default::default(),
123 }
124 }
125}
126#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
127pub struct PutParams {
128 #[doc = "The IP address to associate with the given MAC address"]
129 #[doc = ""]
130 pub ip: ::std::net::IpAddr,
131 #[serde(skip_serializing_if = "Option::is_none", default)]
132 #[doc = "Unicast MAC address."]
133 #[doc = ""]
134 #[doc = "A common MAC address with the I/G (Individual/Group) bit not set."]
135 #[doc = ""]
136 pub mac: Option<crate::types::MacAddr<false>>,
137 #[serde(skip_serializing_if = "Option::is_none", default)]
138 #[doc = "The (unique) ID of the VM."]
139 #[doc = ""]
140 pub vmid: Option<VmidInt>,
141 #[doc = "The SDN zone object identifier."]
142 #[doc = ""]
143 pub zone: String,
144 #[serde(
145 flatten,
146 default,
147 skip_serializing_if = "::std::collections::HashMap::is_empty"
148 )]
149 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
150}
151#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
152pub struct VmidInt(i128);
153impl crate::types::bounded_integer::BoundedInteger for VmidInt {
154 const MIN: Option<i128> = Some(100i128);
155 const MAX: Option<i128> = Some(999999999i128);
156 const DEFAULT: Option<i128> = None::<i128>;
157 const TYPE_DESCRIPTION: &'static str = "an integer between 100 and 999999999";
158 fn get(&self) -> i128 {
159 self.0
160 }
161 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
162 Self::validate(value)?;
163 Ok(Self(value))
164 }
165}
166impl std::convert::TryFrom<i128> for VmidInt {
167 type Error = crate::types::bounded_integer::BoundedIntegerError;
168 fn try_from(value: i128) -> Result<Self, Self::Error> {
169 crate::types::bounded_integer::BoundedInteger::new(value)
170 }
171}
172impl ::serde::Serialize for VmidInt {
173 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
174 where
175 S: ::serde::Serializer,
176 {
177 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
178 }
179}
180impl<'de> ::serde::Deserialize<'de> for VmidInt {
181 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
182 where
183 D: ::serde::Deserializer<'de>,
184 {
185 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
186 }
187}