proxmox_api/generated/cluster/acme/account/
name.rs1#[derive(Debug, Clone)]
2pub struct NameClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> NameClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str, name: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}/{}", parent_path, name),
14 }
15 }
16}
17impl<T> NameClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Deactivate existing ACME account at CA."]
22 #[doc = ""]
23 pub async fn delete(&self) -> Result<String, T::Error> {
24 let path = self.path.to_string();
25 self.client.delete(&path, &()).await
26 }
27}
28impl<T> NameClient<T>
29where
30 T: crate::client::Client,
31{
32 #[doc = "Return existing ACME account information."]
33 #[doc = ""]
34 pub async fn get(&self) -> Result<GetOutput, T::Error> {
35 let path = self.path.to_string();
36 self.client.get(&path, &()).await
37 }
38}
39impl<T> NameClient<T>
40where
41 T: crate::client::Client,
42{
43 #[doc = "Update existing ACME account information with CA. Note: not specifying any new account information triggers a refresh."]
44 #[doc = ""]
45 pub async fn put(&self, params: PutParams) -> Result<String, T::Error> {
46 let path = self.path.to_string();
47 self.client.put(&path, ¶ms).await
48 }
49}
50#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
51pub struct AccountGetOutputAccount {
52 #[serde(
53 flatten,
54 default,
55 skip_serializing_if = "::std::collections::HashMap::is_empty"
56 )]
57 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
58}
59#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
60pub struct GetOutput {
61 #[serde(skip_serializing_if = "Option::is_none", default)]
62 pub account: Option<AccountGetOutputAccount>,
63 #[serde(skip_serializing_if = "Option::is_none", default)]
64 #[doc = "URL of ACME CA directory endpoint."]
65 #[doc = ""]
66 pub directory: Option<DirectoryStr>,
67 #[serde(skip_serializing_if = "Option::is_none", default)]
68 pub location: Option<String>,
69 #[serde(skip_serializing_if = "Option::is_none", default)]
70 pub tos: Option<String>,
71}
72#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
73pub struct PutParams {
74 #[serde(skip_serializing_if = "Option::is_none", default)]
75 #[doc = "Contact email addresses."]
76 #[doc = ""]
77 pub contact: Option<String>,
78 #[serde(
79 flatten,
80 default,
81 skip_serializing_if = "::std::collections::HashMap::is_empty"
82 )]
83 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
84}
85#[derive(Debug, Clone, PartialEq, PartialOrd)]
86pub struct DirectoryStr {
87 value: String,
88}
89impl crate::types::bounded_string::BoundedString for DirectoryStr {
90 const MIN_LENGTH: Option<usize> = None::<usize>;
91 const MAX_LENGTH: Option<usize> = None::<usize>;
92 const DEFAULT: Option<&'static str> = None::<&'static str>;
93 const PATTERN: Option<&'static str> = Some("^https?://.*");
94 const TYPE_DESCRIPTION: &'static str =
95 "a string with pattern r\"^https?://.*\" and no length constraints";
96 fn get_value(&self) -> &str {
97 &self.value
98 }
99 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
100 Self::validate(&value)?;
101 Ok(Self { value })
102 }
103}
104impl std::convert::TryFrom<String> for DirectoryStr {
105 type Error = crate::types::bounded_string::BoundedStringError;
106 fn try_from(value: String) -> Result<Self, Self::Error> {
107 crate::types::bounded_string::BoundedString::new(value)
108 }
109}
110impl ::serde::Serialize for DirectoryStr {
111 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
112 where
113 S: ::serde::Serializer,
114 {
115 crate::types::bounded_string::serialize_bounded_string(self, serializer)
116 }
117}
118impl<'de> ::serde::Deserialize<'de> for DirectoryStr {
119 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
120 where
121 D: ::serde::Deserializer<'de>,
122 {
123 crate::types::bounded_string::deserialize_bounded_string(deserializer)
124 }
125}