Skip to main content

proxmox_api/generated/cluster/mapping/pci/
id.rs

1#[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/pci\", [\"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 PCI Mapping."]
34    #[doc = ""]
35    #[doc = "Permission check: or(perm(\"/mapping/pci/{id}\", [\"Mapping.Use\"]), perm(\"/mapping/pci/{id}\", [\"Mapping.Modify\"]), perm(\"/mapping/pci/{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 hardware mapping."]
46    #[doc = ""]
47    #[doc = "Permission check: perm(\"/mapping/pci/{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, &params).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 logical PCI device."]
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(rename = "live-migration-capable")]
77    #[serde(
78        serialize_with = "crate::types::serialize_bool_optional",
79        deserialize_with = "crate::types::deserialize_bool_optional"
80    )]
81    #[serde(skip_serializing_if = "Option::is_none", default)]
82    #[doc = "Marks the device(s) as being able to be live-migrated (Experimental). This needs hardware and driver support to work."]
83    #[doc = ""]
84    pub live_migration_capable: Option<bool>,
85    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
86    #[doc = "A list of maps for the cluster nodes."]
87    #[doc = ""]
88    pub map: Vec<String>,
89    #[serde(
90        serialize_with = "crate::types::serialize_bool_optional",
91        deserialize_with = "crate::types::deserialize_bool_optional"
92    )]
93    #[serde(skip_serializing_if = "Option::is_none", default)]
94    #[doc = "Marks the device(s) as being capable of providing mediated devices."]
95    #[doc = ""]
96    pub mdev: Option<bool>,
97    #[serde(
98        flatten,
99        default,
100        skip_serializing_if = "::std::collections::HashMap::is_empty"
101    )]
102    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
103}
104#[derive(Debug, Clone, PartialEq, PartialOrd)]
105pub struct DeleteStr {
106    value: String,
107}
108impl crate::types::bounded_string::BoundedString for DeleteStr {
109    const MIN_LENGTH: Option<usize> = None::<usize>;
110    const MAX_LENGTH: Option<usize> = Some(4096usize);
111    const DEFAULT: Option<&'static str> = None::<&'static str>;
112    const PATTERN: Option<&'static str> = None::<&'static str>;
113    const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
114    fn get_value(&self) -> &str {
115        &self.value
116    }
117    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
118        Self::validate(&value)?;
119        Ok(Self { value })
120    }
121}
122impl std::convert::TryFrom<String> for DeleteStr {
123    type Error = crate::types::bounded_string::BoundedStringError;
124    fn try_from(value: String) -> Result<Self, Self::Error> {
125        crate::types::bounded_string::BoundedString::new(value)
126    }
127}
128impl ::serde::Serialize for DeleteStr {
129    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
130    where
131        S: ::serde::Serializer,
132    {
133        crate::types::bounded_string::serialize_bounded_string(self, serializer)
134    }
135}
136impl<'de> ::serde::Deserialize<'de> for DeleteStr {
137    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
138    where
139        D: ::serde::Deserializer<'de>,
140    {
141        crate::types::bounded_string::deserialize_bounded_string(deserializer)
142    }
143}
144#[derive(Debug, Clone, PartialEq, PartialOrd)]
145pub struct DescriptionStr {
146    value: String,
147}
148impl crate::types::bounded_string::BoundedString for DescriptionStr {
149    const MIN_LENGTH: Option<usize> = None::<usize>;
150    const MAX_LENGTH: Option<usize> = Some(4096usize);
151    const DEFAULT: Option<&'static str> = None::<&'static str>;
152    const PATTERN: Option<&'static str> = None::<&'static str>;
153    const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
154    fn get_value(&self) -> &str {
155        &self.value
156    }
157    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
158        Self::validate(&value)?;
159        Ok(Self { value })
160    }
161}
162impl std::convert::TryFrom<String> for DescriptionStr {
163    type Error = crate::types::bounded_string::BoundedStringError;
164    fn try_from(value: String) -> Result<Self, Self::Error> {
165        crate::types::bounded_string::BoundedString::new(value)
166    }
167}
168impl ::serde::Serialize for DescriptionStr {
169    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
170    where
171        S: ::serde::Serializer,
172    {
173        crate::types::bounded_string::serialize_bounded_string(self, serializer)
174    }
175}
176impl<'de> ::serde::Deserialize<'de> for DescriptionStr {
177    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
178    where
179        D: ::serde::Deserializer<'de>,
180    {
181        crate::types::bounded_string::deserialize_bounded_string(deserializer)
182    }
183}
184#[derive(Debug, Clone, PartialEq, PartialOrd)]
185pub struct DigestStr {
186    value: String,
187}
188impl crate::types::bounded_string::BoundedString for DigestStr {
189    const MIN_LENGTH: Option<usize> = None::<usize>;
190    const MAX_LENGTH: Option<usize> = Some(64usize);
191    const DEFAULT: Option<&'static str> = None::<&'static str>;
192    const PATTERN: Option<&'static str> = None::<&'static str>;
193    const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
194    fn get_value(&self) -> &str {
195        &self.value
196    }
197    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
198        Self::validate(&value)?;
199        Ok(Self { value })
200    }
201}
202impl std::convert::TryFrom<String> for DigestStr {
203    type Error = crate::types::bounded_string::BoundedStringError;
204    fn try_from(value: String) -> Result<Self, Self::Error> {
205        crate::types::bounded_string::BoundedString::new(value)
206    }
207}
208impl ::serde::Serialize for DigestStr {
209    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
210    where
211        S: ::serde::Serializer,
212    {
213        crate::types::bounded_string::serialize_bounded_string(self, serializer)
214    }
215}
216impl<'de> ::serde::Deserialize<'de> for DigestStr {
217    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
218    where
219        D: ::serde::Deserializer<'de>,
220    {
221        crate::types::bounded_string::deserialize_bounded_string(deserializer)
222    }
223}