Skip to main content

proxmox_api/generated/nodes/node/
aplinfo.rs

1#[derive(Debug, Clone)]
2pub struct AplinfoClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> AplinfoClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}{}", parent_path, "/aplinfo"),
14        }
15    }
16}
17impl<T> AplinfoClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Get list of appliances."]
22    #[doc = ""]
23    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
24        let path = self.path.to_string();
25        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
26        Ok(optional_vec.unwrap_or_default())
27    }
28}
29impl<T> AplinfoClient<T>
30where
31    T: crate::client::Client,
32{
33    #[doc = "Download appliance templates."]
34    #[doc = ""]
35    #[doc = "Permission check: perm(\"/storage/{storage}\", [\"Datastore.AllocateTemplate\"])"]
36    pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
37        let path = self.path.to_string();
38        self.client.post(&path, &params).await
39    }
40}
41#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
42pub struct GetOutputItems {
43    #[serde(
44        flatten,
45        default,
46        skip_serializing_if = "::std::collections::HashMap::is_empty"
47    )]
48    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
49}
50impl PostParams {
51    pub fn new(storage: String, template: TemplateStr) -> Self {
52        Self {
53            storage,
54            template,
55            additional_properties: ::std::default::Default::default(),
56        }
57    }
58}
59#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
60pub struct PostParams {
61    #[doc = "The storage where the template will be stored"]
62    #[doc = ""]
63    pub storage: String,
64    #[doc = "The template which will downloaded"]
65    #[doc = ""]
66    pub template: TemplateStr,
67    #[serde(
68        flatten,
69        default,
70        skip_serializing_if = "::std::collections::HashMap::is_empty"
71    )]
72    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
73}
74#[derive(Debug, Clone, PartialEq, PartialOrd)]
75pub struct TemplateStr {
76    value: String,
77}
78impl crate::types::bounded_string::BoundedString for TemplateStr {
79    const MIN_LENGTH: Option<usize> = None::<usize>;
80    const MAX_LENGTH: Option<usize> = Some(255usize);
81    const DEFAULT: Option<&'static str> = None::<&'static str>;
82    const PATTERN: Option<&'static str> = None::<&'static str>;
83    const TYPE_DESCRIPTION: &'static str = "a string with length at most 255";
84    fn get_value(&self) -> &str {
85        &self.value
86    }
87    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
88        Self::validate(&value)?;
89        Ok(Self { value })
90    }
91}
92impl std::convert::TryFrom<String> for TemplateStr {
93    type Error = crate::types::bounded_string::BoundedStringError;
94    fn try_from(value: String) -> Result<Self, Self::Error> {
95        crate::types::bounded_string::BoundedString::new(value)
96    }
97}
98impl ::serde::Serialize for TemplateStr {
99    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
100    where
101        S: ::serde::Serializer,
102    {
103        crate::types::bounded_string::serialize_bounded_string(self, serializer)
104    }
105}
106impl<'de> ::serde::Deserialize<'de> for TemplateStr {
107    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
108    where
109        D: ::serde::Deserializer<'de>,
110    {
111        crate::types::bounded_string::deserialize_bounded_string(deserializer)
112    }
113}