proxmox_api/generated/cluster/mapping/usb/
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 Hardware Mapping."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/mapping/usb\", [\"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 USB Mapping."]
34 #[doc = ""]
35 #[doc = "Permission check: or(perm(\"/mapping/usb/{id}\", [\"Mapping.Audit\"]), perm(\"/mapping/usb/{id}\", [\"Mapping.Use\"]), perm(\"/mapping/usb/{id}\", [\"Mapping.Modify\"]))"]
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 hardware mapping."]
46 #[doc = ""]
47 #[doc = "Permission check: perm(\"/mapping/usb/{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}
62impl PutParams {
63 pub fn new(map: Vec<String>) -> Self {
64 Self {
65 map,
66 delete: ::std::default::Default::default(),
67 description: ::std::default::Default::default(),
68 digest: ::std::default::Default::default(),
69 additional_properties: ::std::default::Default::default(),
70 }
71 }
72}
73#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
74pub struct PutParams {
75 #[serde(skip_serializing_if = "Option::is_none", default)]
76 #[doc = "A list of settings you want to delete."]
77 #[doc = ""]
78 pub delete: Option<DeleteStr>,
79 #[serde(skip_serializing_if = "Option::is_none", default)]
80 #[doc = "Description of the logical USB device."]
81 #[doc = ""]
82 pub description: Option<DescriptionStr>,
83 #[serde(skip_serializing_if = "Option::is_none", default)]
84 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
85 #[doc = ""]
86 pub digest: Option<DigestStr>,
87 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
88 #[doc = "A list of maps for the cluster nodes."]
89 #[doc = ""]
90 pub map: Vec<String>,
91 #[serde(
92 flatten,
93 default,
94 skip_serializing_if = "::std::collections::HashMap::is_empty"
95 )]
96 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
97}
98#[derive(Debug, Clone, PartialEq, PartialOrd)]
99pub struct DeleteStr {
100 value: String,
101}
102impl crate::types::bounded_string::BoundedString for DeleteStr {
103 const MIN_LENGTH: Option<usize> = None::<usize>;
104 const MAX_LENGTH: Option<usize> = Some(4096usize);
105 const DEFAULT: Option<&'static str> = None::<&'static str>;
106 const PATTERN: Option<&'static str> = None::<&'static str>;
107 const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
108 fn get_value(&self) -> &str {
109 &self.value
110 }
111 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
112 Self::validate(&value)?;
113 Ok(Self { value })
114 }
115}
116impl std::convert::TryFrom<String> for DeleteStr {
117 type Error = crate::types::bounded_string::BoundedStringError;
118 fn try_from(value: String) -> Result<Self, Self::Error> {
119 crate::types::bounded_string::BoundedString::new(value)
120 }
121}
122impl ::serde::Serialize for DeleteStr {
123 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
124 where
125 S: ::serde::Serializer,
126 {
127 crate::types::bounded_string::serialize_bounded_string(self, serializer)
128 }
129}
130impl<'de> ::serde::Deserialize<'de> for DeleteStr {
131 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
132 where
133 D: ::serde::Deserializer<'de>,
134 {
135 crate::types::bounded_string::deserialize_bounded_string(deserializer)
136 }
137}
138#[derive(Debug, Clone, PartialEq, PartialOrd)]
139pub struct DescriptionStr {
140 value: String,
141}
142impl crate::types::bounded_string::BoundedString for DescriptionStr {
143 const MIN_LENGTH: Option<usize> = None::<usize>;
144 const MAX_LENGTH: Option<usize> = Some(4096usize);
145 const DEFAULT: Option<&'static str> = None::<&'static str>;
146 const PATTERN: Option<&'static str> = None::<&'static str>;
147 const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
148 fn get_value(&self) -> &str {
149 &self.value
150 }
151 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
152 Self::validate(&value)?;
153 Ok(Self { value })
154 }
155}
156impl std::convert::TryFrom<String> for DescriptionStr {
157 type Error = crate::types::bounded_string::BoundedStringError;
158 fn try_from(value: String) -> Result<Self, Self::Error> {
159 crate::types::bounded_string::BoundedString::new(value)
160 }
161}
162impl ::serde::Serialize for DescriptionStr {
163 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
164 where
165 S: ::serde::Serializer,
166 {
167 crate::types::bounded_string::serialize_bounded_string(self, serializer)
168 }
169}
170impl<'de> ::serde::Deserialize<'de> for DescriptionStr {
171 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
172 where
173 D: ::serde::Deserializer<'de>,
174 {
175 crate::types::bounded_string::deserialize_bounded_string(deserializer)
176 }
177}
178#[derive(Debug, Clone, PartialEq, PartialOrd)]
179pub struct DigestStr {
180 value: String,
181}
182impl crate::types::bounded_string::BoundedString for DigestStr {
183 const MIN_LENGTH: Option<usize> = None::<usize>;
184 const MAX_LENGTH: Option<usize> = Some(64usize);
185 const DEFAULT: Option<&'static str> = None::<&'static str>;
186 const PATTERN: Option<&'static str> = None::<&'static str>;
187 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
188 fn get_value(&self) -> &str {
189 &self.value
190 }
191 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
192 Self::validate(&value)?;
193 Ok(Self { value })
194 }
195}
196impl std::convert::TryFrom<String> for DigestStr {
197 type Error = crate::types::bounded_string::BoundedStringError;
198 fn try_from(value: String) -> Result<Self, Self::Error> {
199 crate::types::bounded_string::BoundedString::new(value)
200 }
201}
202impl ::serde::Serialize for DigestStr {
203 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
204 where
205 S: ::serde::Serializer,
206 {
207 crate::types::bounded_string::serialize_bounded_string(self, serializer)
208 }
209}
210impl<'de> ::serde::Deserialize<'de> for DigestStr {
211 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
212 where
213 D: ::serde::Deserializer<'de>,
214 {
215 crate::types::bounded_string::deserialize_bounded_string(deserializer)
216 }
217}