dnsimple v1.2.0 Dnsimple.Certificates

Provides functions to interact with the SSL certificate endpoints.

Summary

Functions

download_certificate(client, account_id, domain_id, certificate_id, options \\ [])

Specs

download_certificate(Dnsimple.Client.t, String.t | integer, String.t | integer, integer, Keyword.t) :: {:ok | :error, Dnsimple.Response.t}

Get the PEM-encoded certificate, along with the root certificate and intermediate chain.

See:

Examples

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.download_certificate(client, account_id = "1010", domain_id = "example.com")
get_certificate(client, account_id, domain_id, certificate_id, options \\ [])

Specs

get_certificate(Dnsimple.Client.t, String.t | integer, String.t | integer, integer, Keyword.t) :: {:ok | :error, Dnsimple.Response.t}

Get the details of a certificate.

See:

Examples

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.get_certificate(client, account_id = "1010", domain_id = "example.com")
get_certificate_private_key(client, account_id, domain_id, certificate_id, options \\ [])

Specs

get_certificate_private_key(Dnsimple.Client.t, String.t | integer, String.t | integer, integer, Keyword.t) :: {:ok | :error, Dnsimple.Response.t}

Get the PEM-encoded certificate private key.

See:

Examples

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.get_certificate_private_key(client, account_id = "1010", domain_id = "example.com")
issue_letsencrypt_certificate(client, account_id, domain_id, certificate_id, options \\ [])

Specs

issue_letsencrypt_certificate(Dnsimple.Client.t, String.t | integer, String.t | integer, integer, Keyword.t) :: {:ok | :error, Dnsimple.Response.t}

Issue a pending Let’s Encrypt certificate order.

Note that the issuance process is async. A successful response means the issuance request has been successfully acknowledged and queued for processing.

See:

Examples

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.issue_letsencrypt_certificate(client, account_id = "1010", domain_id = "example.com", purchase_id = 100)
issue_letsencrypt_certificate_renewal(client, account_id, domain_id, certificate_id, certificate_renewal_id, options \\ [])

Specs

issue_letsencrypt_certificate_renewal(Dnsimple.Client.t, String.t | integer, String.t | integer, integer, integer, Keyword.t) :: {:ok | :error, Dnsimple.Response.t}

Issue a pending Let’s Encrypt certificate renewal order.

Note that the issuance process is async. A successful response means the issuance request has been successfully acknowledged and queued for processing.

See:

Examples

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.issue_letsencrypt_certificate(client, account_id = "1010", domain_id = "example.com", certificate_id = 100, renewal_id: 200)
list_certificates(client, account_id, domain_id, options \\ [])

Specs

list_certificates(Dnsimple.Client.t, String.t | integer, String.t | integer, Keyword.t) :: {:ok | :error, Dnsimple.Response.t}

List certificates for a domain in the account.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.list_certificates(client, account_id = "1010", domain_id = "example.com")
{:ok, response} = Dnsimple.Certificates.list_certificates(client, account_id = "1010", domain_id = "example.com", page: 2, per_page: 10)
{:ok, response} = Dnsimple.Certificates.list_certificates(client, account_id = "1010", domain_id = "example.com", sort: "expires_on:desc")
purchase_letsencrypt_certificate(client, account_id, domain_id, attributes, options \\ [])

Specs

purchase_letsencrypt_certificate(Dnsimple.Client.t, String.t | integer, String.t | integer, Keyword.t, Keyword.t) :: {:ok | :error, Dnsimple.Response.t}

Purchase a Let’s Encrypt certificate.

This method creates a new purchase order. The order ID should be used to request the issuance of the certificate using #issue_letsencrypt_certificate.

See:

Examples

# Purchase a certificate for a single name
client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.purchase_letsencrypt_certificate(client, account_id = "1010", domain_id = "example.com", contact_id: 1, name: "www")
purchase_id     = response.data.id

# Purchase a certificate for multiple names (SAN)
client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.purchase_letsencrypt_certificate(client, account_id = "1010", domain_id = "example.com", contact_id: 1, alternate_names: ["example.com", "www.example.com", "status.example.com"])

# Enable auto-renew on purchase
client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.purchase_letsencrypt_certificate(client, account_id = "1010", domain_id = "example.com", contact_id: 1, auto_renew: true)
purchase_letsencrypt_certificate_renewal(client, account_id, domain_id, certificate_id, attributes \\ %{}, options \\ [])

Specs

purchase_letsencrypt_certificate_renewal(Dnsimple.Client.t, String.t | integer, String.t | integer, integer, Keyword.t, Keyword.t) :: {:ok | :error, Dnsimple.Response.t}

Purchase a Let’s Encrypt certificate renewal.

This method creates a new renewal order. The order ID should be used to request the issuance of the certificate using #issue_letsencrypt_certificate_renewal.

See:

Examples

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.purchase_letsencrypt_certificate_renewal(client, account_id = "1010", domain_id = "example.com", certificate_id = 100)
renewal_id      = response.data.id

# Enable auto-renew on purchase
client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Certificates.purchase_letsencrypt_certificate_renewal(client, account_id = "1010", domain_id = "example.com", certificate_id = 100, auto_renew: true)