]>
git.proxmox.com Git - proxmox.git/blob - src/directory.rs
755ea8c0d33b75e87e79ec79683034786583f995
1 //! ACME Directory information.
3 use serde
::{Deserialize, Serialize}
;
5 /// An ACME Directory. This contains the base URL and the directory data as received via a `GET`
6 /// request to the URL.
8 /// The main entry point URL to the ACME directory.
11 /// The json structure received via a `GET` request to the directory URL. This contains the
12 /// URLs for various API entry points.
13 pub data
: DirectoryData
,
16 /// The ACME Directory object structure.
18 /// The data in here is typically not relevant to the user of this crate.
19 #[derive(Deserialize, Serialize)]
20 #[serde(rename_all = "camelCase")]
21 pub struct DirectoryData
{
22 /// The entry point to create a new account.
23 pub new_account
: String
,
25 /// The entry point to retrieve a new nonce, should be used with a `HEAD` request.
26 pub new_nonce
: String
,
28 /// URL to post new orders to.
29 pub new_order
: String
,
31 /// URL to use for certificate revocation.
32 pub revoke_cert
: String
,
34 /// Account key rollover URL.
35 pub key_change
: String
,
37 /// Metadata object, for additional information which aren't directly part of the API
38 /// itself, such as the terms of service.
39 #[serde(skip_serializing_if = "Option::is_none")]
40 pub meta
: Option
<Meta
>,
43 /// The directory's "meta" object.
44 #[derive(Clone, Debug, Deserialize, Serialize)]
45 #[serde(rename_all = "camelCase")]
47 /// The terms of service. This is typically in the form of an URL.
48 #[serde(skip_serializing_if = "Option::is_none")]
49 pub terms_of_service
: Option
<String
>,
53 /// Create a `Directory` given the parsed `DirectoryData` of a `GET` request to the directory
55 pub fn from_parts(url
: String
, data
: DirectoryData
) -> Self {
60 pub fn terms_of_service_url(&self) -> Option
<&str> {
61 match &self.data
.meta
{
62 Some(meta
) => meta
.terms_of_service
.as_deref(),
67 /// Get the "newNonce" URL. Use `HEAD` requests on this to get a new nonce.
68 pub fn new_nonce_url(&self) -> &str {
72 pub(crate) fn new_account_url(&self) -> &str {
73 &self.data
.new_account
76 pub(crate) fn new_order_url(&self) -> &str {
80 /// Access to the in the Acme spec defined metadata structure.
81 /// Currently only contains the ToS URL already exposed via the `terms_of_service_url()`
83 pub fn meta(&self) -> Option
<&Meta
> {
84 self.data
.meta
.as_ref()