proxmox_api/generated/cluster/mapping/dir/
id.rs1#[derive(Debug, Clone)]
2pub struct IdClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> IdClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str, id: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}/{}", parent_path, id),
14 }
15 }
16}
17impl<T> IdClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Remove directory mapping."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/mapping/dir\", [\"Mapping.Modify\"])"]
24 pub async fn delete(&self) -> Result<(), T::Error> {
25 let path = self.path.to_string();
26 self.client.delete(&path, &()).await
27 }
28}
29impl<T> IdClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Get directory mapping."]
34 #[doc = ""]
35 #[doc = "Permission check: or(perm(\"/mapping/dir/{id}\", [\"Mapping.Use\"]), perm(\"/mapping/dir/{id}\", [\"Mapping.Modify\"]), perm(\"/mapping/dir/{id}\", [\"Mapping.Audit\"]))"]
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> IdClient<T>
42where
43 T: crate::client::Client,
44{
45 #[doc = "Update a directory mapping."]
46 #[doc = ""]
47 #[doc = "Permission check: perm(\"/mapping/dir/{id}\", [\"Mapping.Modify\"])"]
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 GetOutput {
55 #[serde(
56 flatten,
57 default,
58 skip_serializing_if = "::std::collections::HashMap::is_empty"
59 )]
60 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
61}
62#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
63pub struct PutParams {
64 #[serde(skip_serializing_if = "Option::is_none", default)]
65 #[doc = "A list of settings you want to delete."]
66 #[doc = ""]
67 pub delete: Option<DeleteStr>,
68 #[serde(skip_serializing_if = "Option::is_none", default)]
69 #[doc = "Description of the directory mapping"]
70 #[doc = ""]
71 pub description: Option<DescriptionStr>,
72 #[serde(skip_serializing_if = "Option::is_none", default)]
73 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
74 #[doc = ""]
75 pub digest: Option<DigestStr>,
76 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
77 #[doc = "A list of maps for the cluster nodes."]
78 #[doc = ""]
79 pub map: Vec<String>,
80 #[serde(
81 flatten,
82 default,
83 skip_serializing_if = "::std::collections::HashMap::is_empty"
84 )]
85 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
86}
87#[derive(Debug, Clone, PartialEq, PartialOrd)]
88pub struct DeleteStr {
89 value: String,
90}
91impl crate::types::bounded_string::BoundedString for DeleteStr {
92 const MIN_LENGTH: Option<usize> = None::<usize>;
93 const MAX_LENGTH: Option<usize> = Some(4096usize);
94 const DEFAULT: Option<&'static str> = None::<&'static str>;
95 const PATTERN: Option<&'static str> = None::<&'static str>;
96 const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
97 fn get_value(&self) -> &str {
98 &self.value
99 }
100 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
101 Self::validate(&value)?;
102 Ok(Self { value })
103 }
104}
105impl std::convert::TryFrom<String> for DeleteStr {
106 type Error = crate::types::bounded_string::BoundedStringError;
107 fn try_from(value: String) -> Result<Self, Self::Error> {
108 crate::types::bounded_string::BoundedString::new(value)
109 }
110}
111impl ::serde::Serialize for DeleteStr {
112 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
113 where
114 S: ::serde::Serializer,
115 {
116 crate::types::bounded_string::serialize_bounded_string(self, serializer)
117 }
118}
119impl<'de> ::serde::Deserialize<'de> for DeleteStr {
120 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
121 where
122 D: ::serde::Deserializer<'de>,
123 {
124 crate::types::bounded_string::deserialize_bounded_string(deserializer)
125 }
126}
127#[derive(Debug, Clone, PartialEq, PartialOrd)]
128pub struct DescriptionStr {
129 value: String,
130}
131impl crate::types::bounded_string::BoundedString for DescriptionStr {
132 const MIN_LENGTH: Option<usize> = None::<usize>;
133 const MAX_LENGTH: Option<usize> = Some(4096usize);
134 const DEFAULT: Option<&'static str> = None::<&'static str>;
135 const PATTERN: Option<&'static str> = None::<&'static str>;
136 const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
137 fn get_value(&self) -> &str {
138 &self.value
139 }
140 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
141 Self::validate(&value)?;
142 Ok(Self { value })
143 }
144}
145impl std::convert::TryFrom<String> for DescriptionStr {
146 type Error = crate::types::bounded_string::BoundedStringError;
147 fn try_from(value: String) -> Result<Self, Self::Error> {
148 crate::types::bounded_string::BoundedString::new(value)
149 }
150}
151impl ::serde::Serialize for DescriptionStr {
152 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
153 where
154 S: ::serde::Serializer,
155 {
156 crate::types::bounded_string::serialize_bounded_string(self, serializer)
157 }
158}
159impl<'de> ::serde::Deserialize<'de> for DescriptionStr {
160 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
161 where
162 D: ::serde::Deserializer<'de>,
163 {
164 crate::types::bounded_string::deserialize_bounded_string(deserializer)
165 }
166}
167#[derive(Debug, Clone, PartialEq, PartialOrd)]
168pub struct DigestStr {
169 value: String,
170}
171impl crate::types::bounded_string::BoundedString for DigestStr {
172 const MIN_LENGTH: Option<usize> = None::<usize>;
173 const MAX_LENGTH: Option<usize> = Some(64usize);
174 const DEFAULT: Option<&'static str> = None::<&'static str>;
175 const PATTERN: Option<&'static str> = None::<&'static str>;
176 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
177 fn get_value(&self) -> &str {
178 &self.value
179 }
180 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
181 Self::validate(&value)?;
182 Ok(Self { value })
183 }
184}
185impl std::convert::TryFrom<String> for DigestStr {
186 type Error = crate::types::bounded_string::BoundedStringError;
187 fn try_from(value: String) -> Result<Self, Self::Error> {
188 crate::types::bounded_string::BoundedString::new(value)
189 }
190}
191impl ::serde::Serialize for DigestStr {
192 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
193 where
194 S: ::serde::Serializer,
195 {
196 crate::types::bounded_string::serialize_bounded_string(self, serializer)
197 }
198}
199impl<'de> ::serde::Deserialize<'de> for DigestStr {
200 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
201 where
202 D: ::serde::Deserializer<'de>,
203 {
204 crate::types::bounded_string::deserialize_bounded_string(deserializer)
205 }
206}