Skip to main content

proxmox_api/generated/nodes/node/sdn/
zones.rs

1pub mod zone;
2#[derive(Debug, Clone)]
3pub struct ZonesClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> ZonesClient<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, "/zones"),
15        }
16    }
17}
18impl<T> ZonesClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "Get status for all zones."]
23    #[doc = ""]
24    #[doc = "Only list entries where you have 'SDN.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 GetOutputItems {
32    pub fn new(status: Status, zone: String) -> Self {
33        Self {
34            status,
35            zone,
36            additional_properties: ::std::default::Default::default(),
37        }
38    }
39}
40#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
41pub struct GetOutputItems {
42    #[doc = "Status of zone"]
43    #[doc = ""]
44    pub status: Status,
45    #[doc = "The SDN zone object identifier."]
46    #[doc = ""]
47    pub zone: 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}
55#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
56#[doc = "Status of zone"]
57#[doc = ""]
58pub enum Status {
59    #[serde(rename = "available")]
60    Available,
61    #[serde(rename = "error")]
62    Error,
63    #[serde(rename = "pending")]
64    Pending,
65}
66impl TryFrom<&str> for Status {
67    type Error = String;
68    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
69        match value {
70            "available" => Ok(Self::Available),
71            "error" => Ok(Self::Error),
72            "pending" => Ok(Self::Pending),
73            v => Err(format!("Unknown variant {v}")),
74        }
75    }
76}
77impl<T> ZonesClient<T>
78where
79    T: crate::client::Client,
80{
81    pub fn zone(&self, zone: &str) -> zone::ZoneClient<T> {
82        zone::ZoneClient::<T>::new(self.client.clone(), &self.path, zone)
83    }
84}