proxmox_api/generated/nodes/node/certificates/
info.rs1#[derive(Debug, Clone)]
2pub struct InfoClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> InfoClient<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, "/info"),
14 }
15 }
16}
17impl<T> InfoClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Get information about node's certificates."]
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}
29#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
30pub struct GetOutputItems {
31 #[serde(skip_serializing_if = "Option::is_none", default)]
32 pub filename: Option<String>,
33 #[serde(skip_serializing_if = "Option::is_none", default)]
34 #[doc = "Certificate SHA 256 fingerprint."]
35 #[doc = ""]
36 pub fingerprint: Option<FingerprintStr>,
37 #[serde(skip_serializing_if = "Option::is_none", default)]
38 #[doc = "Certificate issuer name."]
39 #[doc = ""]
40 pub issuer: Option<String>,
41 #[serde(
42 serialize_with = "crate::types::serialize_int_optional",
43 deserialize_with = "crate::types::deserialize_int_optional"
44 )]
45 #[serde(skip_serializing_if = "Option::is_none", default)]
46 #[doc = "Certificate's notAfter timestamp (UNIX epoch)."]
47 #[doc = ""]
48 pub notafter: Option<i64>,
49 #[serde(
50 serialize_with = "crate::types::serialize_int_optional",
51 deserialize_with = "crate::types::deserialize_int_optional"
52 )]
53 #[serde(skip_serializing_if = "Option::is_none", default)]
54 #[doc = "Certificate's notBefore timestamp (UNIX epoch)."]
55 #[doc = ""]
56 pub notbefore: Option<i64>,
57 #[serde(skip_serializing_if = "Option::is_none", default)]
58 #[doc = "Certificate in PEM format"]
59 #[doc = ""]
60 pub pem: Option<String>,
61 #[serde(rename = "public-key-bits")]
62 #[serde(
63 serialize_with = "crate::types::serialize_int_optional",
64 deserialize_with = "crate::types::deserialize_int_optional"
65 )]
66 #[serde(skip_serializing_if = "Option::is_none", default)]
67 #[doc = "Certificate's public key size"]
68 #[doc = ""]
69 pub public_key_bits: Option<i64>,
70 #[serde(rename = "public-key-type")]
71 #[serde(skip_serializing_if = "Option::is_none", default)]
72 #[doc = "Certificate's public key algorithm"]
73 #[doc = ""]
74 pub public_key_type: Option<String>,
75 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
76 #[doc = "List of Certificate's SubjectAlternativeName entries."]
77 #[doc = ""]
78 pub san: Vec<String>,
79 #[serde(skip_serializing_if = "Option::is_none", default)]
80 #[doc = "Certificate subject name."]
81 #[doc = ""]
82 pub subject: Option<String>,
83 #[serde(
84 flatten,
85 default,
86 skip_serializing_if = "::std::collections::HashMap::is_empty"
87 )]
88 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
89}
90#[derive(Debug, Clone, PartialEq, PartialOrd)]
91pub struct FingerprintStr {
92 value: String,
93}
94impl crate::types::bounded_string::BoundedString for FingerprintStr {
95 const MIN_LENGTH: Option<usize> = None::<usize>;
96 const MAX_LENGTH: Option<usize> = None::<usize>;
97 const DEFAULT: Option<&'static str> = None::<&'static str>;
98 const PATTERN: Option<&'static str> = Some("([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}");
99 const TYPE_DESCRIPTION: &'static str =
100 "a string with pattern r\"([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}\" and no length constraints";
101 fn get_value(&self) -> &str {
102 &self.value
103 }
104 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
105 Self::validate(&value)?;
106 Ok(Self { value })
107 }
108}
109impl std::convert::TryFrom<String> for FingerprintStr {
110 type Error = crate::types::bounded_string::BoundedStringError;
111 fn try_from(value: String) -> Result<Self, Self::Error> {
112 crate::types::bounded_string::BoundedString::new(value)
113 }
114}
115impl ::serde::Serialize for FingerprintStr {
116 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
117 where
118 S: ::serde::Serializer,
119 {
120 crate::types::bounded_string::serialize_bounded_string(self, serializer)
121 }
122}
123impl<'de> ::serde::Deserialize<'de> for FingerprintStr {
124 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
125 where
126 D: ::serde::Deserializer<'de>,
127 {
128 crate::types::bounded_string::deserialize_bounded_string(deserializer)
129 }
130}