proxmox_api/generated/cluster/sdn/dns/
dns.rs1#[derive(Debug, Clone)]
2pub struct DnsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> DnsClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str, dns: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}/{}", parent_path, dns),
14 }
15 }
16}
17impl<T> DnsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Delete sdn dns object configuration."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/sdn/dns\", [\"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> DnsClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Read sdn dns configuration."]
34 #[doc = ""]
35 #[doc = "Permission check: perm(\"/sdn/dns/{dns}\", [\"SDN.Allocate\"])"]
36 pub async fn get(&self) -> Result<GetOutput, T::Error> {
37 let path = self.path.to_string();
38 self.client.get(&path, &()).await
39 }
40}
41impl<T> DnsClient<T>
42where
43 T: crate::client::Client,
44{
45 #[doc = "Update sdn dns object configuration."]
46 #[doc = ""]
47 #[doc = "Permission check: perm(\"/sdn/dns\", [\"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}
53#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
54pub struct DeleteParams {
55 #[serde(rename = "lock-token")]
56 #[serde(skip_serializing_if = "Option::is_none", default)]
57 #[doc = "the token for unlocking the global SDN configuration"]
58 #[doc = ""]
59 pub lock_token: Option<String>,
60 #[serde(
61 flatten,
62 default,
63 skip_serializing_if = "::std::collections::HashMap::is_empty"
64 )]
65 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
66}
67#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
68pub struct GetOutput {
69 #[serde(
70 flatten,
71 default,
72 skip_serializing_if = "::std::collections::HashMap::is_empty"
73 )]
74 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
75}
76#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
77pub struct PutParams {
78 #[serde(skip_serializing_if = "Option::is_none", default)]
79 #[doc = "A list of settings you want to delete."]
80 #[doc = ""]
81 pub delete: Option<DeleteStr>,
82 #[serde(skip_serializing_if = "Option::is_none", default)]
83 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
84 #[doc = ""]
85 pub digest: Option<DigestStr>,
86 #[serde(skip_serializing_if = "Option::is_none", default)]
87 #[doc = "Certificate SHA 256 fingerprint."]
88 #[doc = ""]
89 pub fingerprint: Option<FingerprintStr>,
90 #[serde(skip_serializing_if = "Option::is_none", default)]
91 pub key: Option<String>,
92 #[serde(rename = "lock-token")]
93 #[serde(skip_serializing_if = "Option::is_none", default)]
94 #[doc = "the token for unlocking the global SDN configuration"]
95 #[doc = ""]
96 pub lock_token: Option<String>,
97 #[serde(
98 serialize_with = "crate::types::serialize_int_optional",
99 deserialize_with = "crate::types::deserialize_int_optional"
100 )]
101 #[serde(skip_serializing_if = "Option::is_none", default)]
102 pub reversemaskv6: Option<i64>,
103 #[serde(
104 serialize_with = "crate::types::serialize_int_optional",
105 deserialize_with = "crate::types::deserialize_int_optional"
106 )]
107 #[serde(skip_serializing_if = "Option::is_none", default)]
108 pub ttl: Option<i64>,
109 #[serde(skip_serializing_if = "Option::is_none", default)]
110 pub url: Option<String>,
111 #[serde(
112 flatten,
113 default,
114 skip_serializing_if = "::std::collections::HashMap::is_empty"
115 )]
116 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
117}
118#[derive(Debug, Clone, PartialEq, PartialOrd)]
119pub struct DeleteStr {
120 value: String,
121}
122impl crate::types::bounded_string::BoundedString for DeleteStr {
123 const MIN_LENGTH: Option<usize> = None::<usize>;
124 const MAX_LENGTH: Option<usize> = Some(4096usize);
125 const DEFAULT: Option<&'static str> = None::<&'static str>;
126 const PATTERN: Option<&'static str> = None::<&'static str>;
127 const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
128 fn get_value(&self) -> &str {
129 &self.value
130 }
131 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
132 Self::validate(&value)?;
133 Ok(Self { value })
134 }
135}
136impl std::convert::TryFrom<String> for DeleteStr {
137 type Error = crate::types::bounded_string::BoundedStringError;
138 fn try_from(value: String) -> Result<Self, Self::Error> {
139 crate::types::bounded_string::BoundedString::new(value)
140 }
141}
142impl ::serde::Serialize for DeleteStr {
143 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
144 where
145 S: ::serde::Serializer,
146 {
147 crate::types::bounded_string::serialize_bounded_string(self, serializer)
148 }
149}
150impl<'de> ::serde::Deserialize<'de> for DeleteStr {
151 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
152 where
153 D: ::serde::Deserializer<'de>,
154 {
155 crate::types::bounded_string::deserialize_bounded_string(deserializer)
156 }
157}
158#[derive(Debug, Clone, PartialEq, PartialOrd)]
159pub struct DigestStr {
160 value: String,
161}
162impl crate::types::bounded_string::BoundedString for DigestStr {
163 const MIN_LENGTH: Option<usize> = None::<usize>;
164 const MAX_LENGTH: Option<usize> = Some(64usize);
165 const DEFAULT: Option<&'static str> = None::<&'static str>;
166 const PATTERN: Option<&'static str> = None::<&'static str>;
167 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
168 fn get_value(&self) -> &str {
169 &self.value
170 }
171 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
172 Self::validate(&value)?;
173 Ok(Self { value })
174 }
175}
176impl std::convert::TryFrom<String> for DigestStr {
177 type Error = crate::types::bounded_string::BoundedStringError;
178 fn try_from(value: String) -> Result<Self, Self::Error> {
179 crate::types::bounded_string::BoundedString::new(value)
180 }
181}
182impl ::serde::Serialize for DigestStr {
183 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
184 where
185 S: ::serde::Serializer,
186 {
187 crate::types::bounded_string::serialize_bounded_string(self, serializer)
188 }
189}
190impl<'de> ::serde::Deserialize<'de> for DigestStr {
191 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
192 where
193 D: ::serde::Deserializer<'de>,
194 {
195 crate::types::bounded_string::deserialize_bounded_string(deserializer)
196 }
197}
198#[derive(Debug, Clone, PartialEq, PartialOrd)]
199pub struct FingerprintStr {
200 value: String,
201}
202impl crate::types::bounded_string::BoundedString for FingerprintStr {
203 const MIN_LENGTH: Option<usize> = None::<usize>;
204 const MAX_LENGTH: Option<usize> = None::<usize>;
205 const DEFAULT: Option<&'static str> = None::<&'static str>;
206 const PATTERN: Option<&'static str> = Some("([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}");
207 const TYPE_DESCRIPTION: &'static str =
208 "a string with pattern r\"([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}\" and no length constraints";
209 fn get_value(&self) -> &str {
210 &self.value
211 }
212 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
213 Self::validate(&value)?;
214 Ok(Self { value })
215 }
216}
217impl std::convert::TryFrom<String> for FingerprintStr {
218 type Error = crate::types::bounded_string::BoundedStringError;
219 fn try_from(value: String) -> Result<Self, Self::Error> {
220 crate::types::bounded_string::BoundedString::new(value)
221 }
222}
223impl ::serde::Serialize for FingerprintStr {
224 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
225 where
226 S: ::serde::Serializer,
227 {
228 crate::types::bounded_string::serialize_bounded_string(self, serializer)
229 }
230}
231impl<'de> ::serde::Deserialize<'de> for FingerprintStr {
232 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
233 where
234 D: ::serde::Deserializer<'de>,
235 {
236 crate::types::bounded_string::deserialize_bounded_string(deserializer)
237 }
238}