proxmox_api/generated/cluster/acme/
account.rs1pub mod name;
2#[derive(Debug, Clone)]
3pub struct AccountClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> AccountClient<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, "/account"),
15 }
16 }
17}
18impl<T> AccountClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "ACMEAccount index."]
23 #[doc = ""]
24 pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
25 let path = self.path.to_string();
26 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
27 Ok(optional_vec.unwrap_or_default())
28 }
29}
30impl<T> AccountClient<T>
31where
32 T: crate::client::Client,
33{
34 #[doc = "Register a new ACME account with CA."]
35 #[doc = ""]
36 pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
37 let path = self.path.to_string();
38 self.client.post(&path, ¶ms).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(contact: String) -> Self {
52 Self {
53 contact,
54 directory: ::std::default::Default::default(),
55 eab_hmac_key: ::std::default::Default::default(),
56 eab_kid: ::std::default::Default::default(),
57 name: ::std::default::Default::default(),
58 tos_url: ::std::default::Default::default(),
59 additional_properties: ::std::default::Default::default(),
60 }
61 }
62}
63#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
64pub struct PostParams {
65 #[doc = "Contact email addresses."]
66 #[doc = ""]
67 pub contact: String,
68 #[serde(skip_serializing_if = "Option::is_none", default)]
69 #[doc = "URL of ACME CA directory endpoint."]
70 #[doc = ""]
71 pub directory: Option<DirectoryStr>,
72 #[serde(rename = "eab-hmac-key")]
73 #[serde(skip_serializing_if = "Option::is_none", default)]
74 #[doc = "HMAC key for External Account Binding."]
75 #[doc = ""]
76 pub eab_hmac_key: Option<String>,
77 #[serde(rename = "eab-kid")]
78 #[serde(skip_serializing_if = "Option::is_none", default)]
79 #[doc = "Key Identifier for External Account Binding."]
80 #[doc = ""]
81 pub eab_kid: Option<String>,
82 #[serde(skip_serializing_if = "Option::is_none", default)]
83 #[doc = "ACME account config file name."]
84 #[doc = ""]
85 pub name: Option<String>,
86 #[serde(skip_serializing_if = "Option::is_none", default)]
87 #[doc = "URL of CA TermsOfService - setting this indicates agreement."]
88 #[doc = ""]
89 pub tos_url: Option<String>,
90 #[serde(
91 flatten,
92 default,
93 skip_serializing_if = "::std::collections::HashMap::is_empty"
94 )]
95 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
96}
97#[derive(Debug, Clone, PartialEq, PartialOrd)]
98pub struct DirectoryStr {
99 value: String,
100}
101impl crate::types::bounded_string::BoundedString for DirectoryStr {
102 const MIN_LENGTH: Option<usize> = None::<usize>;
103 const MAX_LENGTH: Option<usize> = None::<usize>;
104 const DEFAULT: Option<&'static str> = Some("https://acme-v02.api.letsencrypt.org/directory");
105 const PATTERN: Option<&'static str> = Some("^https?://.*");
106 const TYPE_DESCRIPTION: &'static str =
107 "a string with pattern r\"^https?://.*\" and no length constraints";
108 fn get_value(&self) -> &str {
109 &self.value
110 }
111 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
112 Self::validate(&value)?;
113 Ok(Self { value })
114 }
115}
116impl std::convert::TryFrom<String> for DirectoryStr {
117 type Error = crate::types::bounded_string::BoundedStringError;
118 fn try_from(value: String) -> Result<Self, Self::Error> {
119 crate::types::bounded_string::BoundedString::new(value)
120 }
121}
122impl ::serde::Serialize for DirectoryStr {
123 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
124 where
125 S: ::serde::Serializer,
126 {
127 crate::types::bounded_string::serialize_bounded_string(self, serializer)
128 }
129}
130impl<'de> ::serde::Deserialize<'de> for DirectoryStr {
131 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
132 where
133 D: ::serde::Deserializer<'de>,
134 {
135 crate::types::bounded_string::deserialize_bounded_string(deserializer)
136 }
137}
138impl<T> AccountClient<T>
139where
140 T: crate::client::Client,
141{
142 pub fn name(&self, name: &str) -> name::NameClient<T> {
143 name::NameClient::<T>::new(self.client.clone(), &self.path, name)
144 }
145}