proxmox_api/generated/nodes/node/qemu/vmid/
cloudinit.rs1pub mod dump;
2#[derive(Debug, Clone)]
3pub struct CloudinitClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> CloudinitClient<T>
8where
9 T: crate::client::Client,
10{
11 pub fn new(client: T, parent_path: &str) -> Self {
12 Self {
13 client,
14 path: format!("{}{}", parent_path, "/cloudinit"),
15 }
16 }
17}
18impl<T> CloudinitClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "Get the cloudinit configuration with both current and pending values."]
23 #[doc = ""]
24 #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.Audit\"])"]
25 pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
26 let path = self.path.to_string();
27 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
28 Ok(optional_vec.unwrap_or_default())
29 }
30}
31impl<T> CloudinitClient<T>
32where
33 T: crate::client::Client,
34{
35 #[doc = "Regenerate and change cloudinit config drive."]
36 #[doc = ""]
37 #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.Config.Cloudinit\"])"]
38 pub async fn put(&self) -> Result<(), T::Error> {
39 let path = self.path.to_string();
40 self.client.put(&path, &()).await
41 }
42}
43impl GetOutputItems {
44 pub fn new(key: String) -> Self {
45 Self {
46 key,
47 delete: ::std::default::Default::default(),
48 pending: ::std::default::Default::default(),
49 value: ::std::default::Default::default(),
50 additional_properties: ::std::default::Default::default(),
51 }
52 }
53}
54#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
55pub struct GetOutputItems {
56 #[serde(skip_serializing_if = "Option::is_none", default)]
57 #[doc = "Indicates a pending delete request if present and not 0."]
58 #[doc = ""]
59 pub delete: Option<DeleteInt>,
60 #[doc = "Configuration option name."]
61 #[doc = ""]
62 pub key: String,
63 #[serde(skip_serializing_if = "Option::is_none", default)]
64 #[doc = "The new pending value."]
65 #[doc = ""]
66 pub pending: Option<String>,
67 #[serde(skip_serializing_if = "Option::is_none", default)]
68 #[doc = "Value as it was used to generate the current cloudinit image."]
69 #[doc = ""]
70 pub value: Option<String>,
71 #[serde(
72 flatten,
73 default,
74 skip_serializing_if = "::std::collections::HashMap::is_empty"
75 )]
76 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
77}
78#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
79pub struct DeleteInt(i128);
80impl crate::types::bounded_integer::BoundedInteger for DeleteInt {
81 const MIN: Option<i128> = Some(0i128);
82 const MAX: Option<i128> = Some(1i128);
83 const DEFAULT: Option<i128> = None::<i128>;
84 const TYPE_DESCRIPTION: &'static str = "an integer between 0 and 1";
85 fn get(&self) -> i128 {
86 self.0
87 }
88 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
89 Self::validate(value)?;
90 Ok(Self(value))
91 }
92}
93impl std::convert::TryFrom<i128> for DeleteInt {
94 type Error = crate::types::bounded_integer::BoundedIntegerError;
95 fn try_from(value: i128) -> Result<Self, Self::Error> {
96 crate::types::bounded_integer::BoundedInteger::new(value)
97 }
98}
99impl ::serde::Serialize for DeleteInt {
100 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
101 where
102 S: ::serde::Serializer,
103 {
104 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
105 }
106}
107impl<'de> ::serde::Deserialize<'de> for DeleteInt {
108 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
109 where
110 D: ::serde::Deserializer<'de>,
111 {
112 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
113 }
114}
115impl<T> CloudinitClient<T>
116where
117 T: crate::client::Client,
118{
119 pub fn dump(&self) -> dump::DumpClient<T> {
120 dump::DumpClient::<T>::new(self.client.clone(), &self.path)
121 }
122}