Skip to main content

proxmox_api/generated/cluster/acme/
directories.rs

1#[derive(Debug, Clone)]
2pub struct DirectoriesClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> DirectoriesClient<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, "/directories"),
14        }
15    }
16}
17impl<T> DirectoriesClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Get named known ACME directory endpoints."]
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 GetOutputItems {
30    pub fn new(name: String, url: UrlStr) -> Self {
31        Self { name, url }
32    }
33}
34#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
35pub struct GetOutputItems {
36    pub name: String,
37    #[doc = "URL of ACME CA directory endpoint."]
38    #[doc = ""]
39    pub url: UrlStr,
40}
41#[derive(Debug, Clone, PartialEq, PartialOrd)]
42pub struct UrlStr {
43    value: String,
44}
45impl crate::types::bounded_string::BoundedString for UrlStr {
46    const MIN_LENGTH: Option<usize> = None::<usize>;
47    const MAX_LENGTH: Option<usize> = None::<usize>;
48    const DEFAULT: Option<&'static str> = None::<&'static str>;
49    const PATTERN: Option<&'static str> = Some("^https?://.*");
50    const TYPE_DESCRIPTION: &'static str =
51        "a string with pattern r\"^https?://.*\" and no length constraints";
52    fn get_value(&self) -> &str {
53        &self.value
54    }
55    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
56        Self::validate(&value)?;
57        Ok(Self { value })
58    }
59}
60impl std::convert::TryFrom<String> for UrlStr {
61    type Error = crate::types::bounded_string::BoundedStringError;
62    fn try_from(value: String) -> Result<Self, Self::Error> {
63        crate::types::bounded_string::BoundedString::new(value)
64    }
65}
66impl ::serde::Serialize for UrlStr {
67    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
68    where
69        S: ::serde::Serializer,
70    {
71        crate::types::bounded_string::serialize_bounded_string(self, serializer)
72    }
73}
74impl<'de> ::serde::Deserialize<'de> for UrlStr {
75    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
76    where
77        D: ::serde::Deserializer<'de>,
78    {
79        crate::types::bounded_string::deserialize_bounded_string(deserializer)
80    }
81}