]> git.proxmox.com Git - proxmox.git/blame - src/request.rs
expand helper function by eab credentials
[proxmox.git] / src / request.rs
CommitLineData
aa230682
WB
1use serde::Deserialize;
2
5f0ba968
WB
3pub(crate) const JSON_CONTENT_TYPE: &str = "application/jose+json";
4pub(crate) const CREATED: u16 = 201;
aa230682
WB
5
6/// A request which should be performed on the ACME provider.
7pub struct Request {
5f0ba968 8 /// The complete URL to send the request to.
aa230682 9 pub url: String,
5f0ba968
WB
10
11 /// The HTTP method name to use.
aa230682 12 pub method: &'static str,
5f0ba968
WB
13
14 /// The `Content-Type` header to pass along.
aa230682 15 pub content_type: &'static str,
5f0ba968
WB
16
17 /// The body to pass along with request, or an empty string.
aa230682
WB
18 pub body: String,
19
5f0ba968 20 /// The expected status code a compliant ACME provider will return on success.
aa230682
WB
21 pub expected: u16,
22}
23
5f0ba968
WB
24/// An ACME error response contains a specially formatted type string, and can optionally
25/// contain textual details and a set of sub problems.
aa230682
WB
26#[derive(Clone, Debug, Deserialize)]
27pub struct ErrorResponse {
5f0ba968
WB
28 /// The ACME error type string.
29 ///
30 /// Most of the time we're only interested in the "bad nonce" or "user action required"
31 /// errors. When an [`Error`](crate::Error) is built from this error response, it will map
32 /// to the corresponding enum values (eg. [`Error::BadNonce`](crate::Error::BadNonce)).
aa230682
WB
33 #[serde(rename = "type")]
34 pub ty: String,
5f0ba968
WB
35
36 /// A textual detail string optionally provided by the ACME provider to inform the user more
37 /// verbosely about why the error occurred.
aa230682 38 pub detail: Option<String>,
5f0ba968
WB
39
40 /// Additional json data containing information as to why the error occurred.
aa230682
WB
41 pub subproblems: Option<serde_json::Value>,
42}