Skip to main content

proxmox_api/generated/nodes/node/scan/
pbs.rs

1#[derive(Debug, Clone)]
2pub struct PbsClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> PbsClient<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, "/pbs"),
14        }
15    }
16}
17impl<T> PbsClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Scan remote Proxmox Backup Server."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/storage\", [\"Datastore.Allocate\"])"]
24    pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
25        let path = self.path.to_string();
26        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &params).await?;
27        Ok(optional_vec.unwrap_or_default())
28    }
29}
30impl GetOutputItems {
31    pub fn new(store: String) -> Self {
32        Self {
33            store,
34            comment: ::std::default::Default::default(),
35            additional_properties: ::std::default::Default::default(),
36        }
37    }
38}
39#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
40pub struct GetOutputItems {
41    #[serde(skip_serializing_if = "Option::is_none", default)]
42    #[doc = "Comment from server."]
43    #[doc = ""]
44    pub comment: Option<String>,
45    #[doc = "The datastore name."]
46    #[doc = ""]
47    pub store: String,
48    #[serde(
49        flatten,
50        default,
51        skip_serializing_if = "::std::collections::HashMap::is_empty"
52    )]
53    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
54}
55impl GetParams {
56    pub fn new(password: String, server: String, username: String) -> Self {
57        Self {
58            password,
59            server,
60            username,
61            fingerprint: ::std::default::Default::default(),
62            port: ::std::default::Default::default(),
63            additional_properties: ::std::default::Default::default(),
64        }
65    }
66}
67#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
68pub struct GetParams {
69    #[serde(skip_serializing_if = "Option::is_none", default)]
70    #[doc = "Certificate SHA 256 fingerprint."]
71    #[doc = ""]
72    pub fingerprint: Option<FingerprintStr>,
73    #[doc = "User password or API token secret."]
74    #[doc = ""]
75    pub password: String,
76    #[serde(skip_serializing_if = "Option::is_none", default)]
77    #[doc = "Optional port."]
78    #[doc = ""]
79    pub port: Option<PortInt>,
80    #[doc = "The server address (name or IP)."]
81    #[doc = ""]
82    pub server: String,
83    #[doc = "User-name or API token-ID."]
84    #[doc = ""]
85    pub username: String,
86    #[serde(
87        flatten,
88        default,
89        skip_serializing_if = "::std::collections::HashMap::is_empty"
90    )]
91    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
92}
93#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
94pub struct PortInt(i128);
95impl crate::types::bounded_integer::BoundedInteger for PortInt {
96    const MIN: Option<i128> = Some(1i128);
97    const MAX: Option<i128> = Some(65535i128);
98    const DEFAULT: Option<i128> = Some(8007i128);
99    const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 65535";
100    fn get(&self) -> i128 {
101        self.0
102    }
103    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
104        Self::validate(value)?;
105        Ok(Self(value))
106    }
107}
108impl std::convert::TryFrom<i128> for PortInt {
109    type Error = crate::types::bounded_integer::BoundedIntegerError;
110    fn try_from(value: i128) -> Result<Self, Self::Error> {
111        crate::types::bounded_integer::BoundedInteger::new(value)
112    }
113}
114impl ::serde::Serialize for PortInt {
115    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
116    where
117        S: ::serde::Serializer,
118    {
119        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
120    }
121}
122impl<'de> ::serde::Deserialize<'de> for PortInt {
123    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
124    where
125        D: ::serde::Deserializer<'de>,
126    {
127        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
128    }
129}
130#[derive(Debug, Clone, PartialEq, PartialOrd)]
131pub struct FingerprintStr {
132    value: String,
133}
134impl crate::types::bounded_string::BoundedString for FingerprintStr {
135    const MIN_LENGTH: Option<usize> = None::<usize>;
136    const MAX_LENGTH: Option<usize> = None::<usize>;
137    const DEFAULT: Option<&'static str> = None::<&'static str>;
138    const PATTERN: Option<&'static str> = Some("([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}");
139    const TYPE_DESCRIPTION: &'static str =
140        "a string with pattern r\"([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}\" and no length constraints";
141    fn get_value(&self) -> &str {
142        &self.value
143    }
144    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
145        Self::validate(&value)?;
146        Ok(Self { value })
147    }
148}
149impl std::convert::TryFrom<String> for FingerprintStr {
150    type Error = crate::types::bounded_string::BoundedStringError;
151    fn try_from(value: String) -> Result<Self, Self::Error> {
152        crate::types::bounded_string::BoundedString::new(value)
153    }
154}
155impl ::serde::Serialize for FingerprintStr {
156    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
157    where
158        S: ::serde::Serializer,
159    {
160        crate::types::bounded_string::serialize_bounded_string(self, serializer)
161    }
162}
163impl<'de> ::serde::Deserialize<'de> for FingerprintStr {
164    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
165    where
166        D: ::serde::Deserializer<'de>,
167    {
168        crate::types::bounded_string::deserialize_bounded_string(deserializer)
169    }
170}