proxmox_api/generated/cluster/acme/
tos.rs1#[derive(Debug, Clone)]
2pub struct TosClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> TosClient<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, "/tos"),
14 }
15 }
16}
17impl<T> TosClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Retrieve ACME TermsOfService URL from CA. Deprecated, please use /cluster/acme/meta."]
22 #[doc = ""]
23 pub async fn get(&self, params: GetParams) -> Result<Option<String>, T::Error> {
24 let path = self.path.to_string();
25 self.client.get(&path, ¶ms).await
26 }
27}
28#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
29pub struct GetParams {
30 #[serde(skip_serializing_if = "Option::is_none", default)]
31 #[doc = "URL of ACME CA directory endpoint."]
32 #[doc = ""]
33 pub directory: Option<DirectoryStr>,
34 #[serde(
35 flatten,
36 default,
37 skip_serializing_if = "::std::collections::HashMap::is_empty"
38 )]
39 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
40}
41#[derive(Debug, Clone, PartialEq, PartialOrd)]
42pub struct DirectoryStr {
43 value: String,
44}
45impl crate::types::bounded_string::BoundedString for DirectoryStr {
46 const MIN_LENGTH: Option<usize> = None::<usize>;
47 const MAX_LENGTH: Option<usize> = None::<usize>;
48 const DEFAULT: Option<&'static str> = Some("https://acme-v02.api.letsencrypt.org/directory");
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 DirectoryStr {
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 DirectoryStr {
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 DirectoryStr {
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}