Skip to main content

Certificates

Struct Certificates 

Source
pub struct Certificates<'a> { /* private fields */ }
Expand description

TLS certificates of zones, from Client::certificates.

Access is the zone’s: its key, a member of the zone, or an Admin. Every name in a zone certificate must be served by that zone. Certificates Core issues for redirects (source = Acme) can be read here but not replaced or deleted.

Implementations§

Source§

impl<'a> Certificates<'a>

Source

pub async fn list( &self, zone_id: Option<Uuid>, page: PageRequest, ) -> Result<Page<Certificate>>

One page of the certificates of zone_id, or of every zone the caller can access when None (an Admin also sees platform certificates).

GET /api/v1/certificates[?zone_id=...]

§Errors

ErrorCode::Forbidden if the caller has no access to zone_id.

Source

pub async fn list_all(&self, zone_id: Option<Uuid>) -> Result<Vec<Certificate>>

All certificates list would return, following pagination.

GET /api/v1/certificates, as many times as there are pages.

§Errors

As list.

Source

pub async fn covering(&self, name: &str) -> Result<Vec<Certificate>>

The visible certificates that cover a host name the way Relay picks them (exact name, or a wildcard one label up). Core allows one certificate per name, so this is normally zero or one.

GET /api/v1/certificates?name=...

Source

pub async fn get(&self, uuid: Uuid) -> Result<Certificate>

One certificate by uuid.

GET /api/v1/certificates/:uuid

§Errors

ErrorCode::NotFound if there is no such certificate.

Source

pub async fn create(&self, certificate: &NewCertificate) -> Result<Certificate>

Uploads a certificate for names of a zone; every Relay gets it. Zone members and the zone key may do this.

POST /api/v1/certificates

§Errors
  • ErrorCode::Validation if the PEM cannot be parsed, is expired, the key does not match, the chain is broken, or there are no SAN names.
  • ErrorCode::Conflict if a name is not served by the zone, has a redirect with tls = Auto (switch it to Manual first), or is already covered by another certificate.
§Examples
use dinio_sdk::models::NewCertificate;

let zone = client.zones().get("example.com").await?;
let cert = client
    .certificates()
    .create(&NewCertificate {
        chain_pem: std::fs::read_to_string("fullchain.pem").unwrap(),
        key_pem: std::fs::read_to_string("privkey.pem").unwrap(),
        zone_id: zone.uuid,
    })
    .await?;
println!("{} valid until {}", cert.names.join(", "), cert.valid_to);
Source

pub async fn replace( &self, uuid: Uuid, renewal: &CertificateRenewal, ) -> Result<Certificate>

Replaces chain and key under the same id (renewal). The same name rules as create apply to the new chain.

PUT /api/v1/certificates/:uuid

§Errors
Source

pub async fn delete(&self, uuid: Uuid) -> Result<()>

Deletes a certificate. Relays fall back to the next match or their default.

DELETE /api/v1/certificates/:uuid

§Errors

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Certificates<'a>

§

impl<'a> !UnwindSafe for Certificates<'a>

§

impl<'a> Freeze for Certificates<'a>

§

impl<'a> Send for Certificates<'a>

§

impl<'a> Sync for Certificates<'a>

§

impl<'a> Unpin for Certificates<'a>

§

impl<'a> UnsafeUnpin for Certificates<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more