pub struct Order { /* private fields */ }
Expand description
An ACME order as described in RFC 8555 (section 7.1.3)
An order is created from an Account
by calling
Account::new_order()
. The Order
type represents the stable
identity of an order, while the Order::state()
method gives you access to the current
state of the order according to the server.
Implementations§
Source§impl Order
impl Order
Retrieve the authorizations for this order
An order contains one authorization to complete per identifier in the order. After creating an order, you’ll need to retrieve the authorizations so that you can set up a challenge response for each authorization.
This method will retrieve the authorizations attached to this order if they have not been retrieved yet. If you have already consumed the stream generated by this method before, processing it again will not involve any network activity.
Sourcepub async fn finalize(&mut self) -> Result<String, Error>
Available on crate feature rcgen
only.
pub async fn finalize(&mut self) -> Result<String, Error>
rcgen
only.Generate a Certificate Signing Request for the order’s identifiers and request finalization
Uses the rcgen crate to generate a Certificate Signing Request (CSR) converting the order’s
identifiers to Subject Alternative Names, then calls Order::finalize_csr()
with it.
Returns the generated private key, serialized as PEM.
After this succeeds, call Order::certificate()
to retrieve the certificate chain once
the order is in the appropriate state.
Sourcepub async fn finalize_csr(&mut self, csr_der: &[u8]) -> Result<(), Error>
pub async fn finalize_csr(&mut self, csr_der: &[u8]) -> Result<(), Error>
Request a certificate from the given Certificate Signing Request (CSR)
csr_der
contains the CSR representation serialized in DER encoding. If you don’t need
custom certificate parameters, Order::finalize()
can generate the CSR for you.
After this succeeds, call Order::certificate()
to retrieve the certificate chain once
the order is in the appropriate state.
Sourcepub async fn certificate(&mut self) -> Result<Option<String>, Error>
pub async fn certificate(&mut self) -> Result<Option<String>, Error>
Get the certificate for this order
If the cached order state is in ready
or processing
state, this will poll the server
for the latest state. If the order is still in processing
state after that, this will
return Ok(None)
. If the order is in valid
state, this will attempt to retrieve
the certificate from the server and return it as a String
. If the order contains
an error or ends up in any state other than valid
or processing
, return an error.
Sourcepub fn identifiers(&mut self) -> Identifiers<'_>
pub fn identifiers(&mut self) -> Identifiers<'_>
Retrieve the identifiers for this order
This method will retrieve the identifiers attached to the authorizations for this order
if they have not been retrieved yet. If you have already consumed the stream generated
by Order::authorizations()
, this will not involve any network activity.
Sourcepub async fn poll_ready(
&mut self,
retries: &RetryPolicy,
) -> Result<OrderStatus, Error>
pub async fn poll_ready( &mut self, retries: &RetryPolicy, ) -> Result<OrderStatus, Error>
Poll the order with the given RetryPolicy
Yields the OrderStatus
immediately if Ready
or Invalid
, or yields an
Error::Timeout
if the RetryPolicy::timeout
has been reached.
Sourcepub async fn poll_certificate(
&mut self,
retries: &RetryPolicy,
) -> Result<String, Error>
pub async fn poll_certificate( &mut self, retries: &RetryPolicy, ) -> Result<String, Error>
Poll the certificate with the given RetryPolicy
Yields the PEM encoded certificate chain for this order if the order state becomes
Valid
. The function keeps polling as long as the order state is Processing
.
An error is returned immediately: if the order state is Invalid
, if polling runs
into a timeout, or if the ACME CA suggest to retry at a later time.
Sourcepub async fn refresh(&mut self) -> Result<&OrderState, Error>
pub async fn refresh(&mut self) -> Result<&OrderState, Error>
Refresh the current state of the order
Sourcepub fn into_parts(self) -> (String, OrderState)
pub fn into_parts(self) -> (String, OrderState)
Extract the URL and last known state from the Order
Sourcepub fn state(&mut self) -> &OrderState
pub fn state(&mut self) -> &OrderState
Get the last known state of the order
Call refresh()
to get the latest state from the server.