pub struct Domains<'a> {
    pub client: &'a Client,
}
Expand description

The Domains Service handles the domains endpoint of the DNSimple API.

See API Documentation: domains

Fields§

§client: &'a Client

Implementations§

source§

impl Domains<'_>

source

pub fn list_domains( &self, account_id: u64, options: Option<RequestOptions> ) -> Result<DNSimpleResponse<Vec<Domain>>, DNSimpleError>

Lists the domains in the account

Examples
use std::collections::HashMap;
use dnsimple::dnsimple::{Client, new_client};

let client = new_client(true, String::from("AUTH_TOKEN"));
let domains = client.domains().list_domains(1234, None).unwrap().data.unwrap();
Arguments

account_id: The account ID options: The RequestOptions - Filters: name_like, registrant_id - Sorting: id, name, expiration

source

pub fn create_domain( &self, account_id: u64, name: String ) -> Result<DNSimpleResponse<Domain>, DNSimpleError>

Adds a domain to the account.

Examples
use dnsimple::dnsimple::{Client, new_client};
use dnsimple::dnsimple::domains::DomainCreationPayload;

let client = new_client(true, String::from("AUTH_TOKEN"));
let domain_name = String::from("example-beta.com");

let domains_response = client.domains().create_domain(1234, domain_name);
Arguments

account_id: The account ID name: The name of the domain we want to create

source

pub fn get_domain( &self, account_id: u64, domain_id: u64 ) -> Result<DNSimpleResponse<Domain>, DNSimpleError>

Retrieves the details of an existing domain.

Examples
use dnsimple::dnsimple::{Client, new_client};
use dnsimple::dnsimple::domains::DomainCreationPayload;

let client = new_client(true, String::from("AUTH_TOKEN"));
let domains_response = client.domains().get_domain(1234, 42);
Arguments

account_id: The account ID domain_id: The ID of the domain we want to retrieve

source

pub fn delete_domain( &self, account_id: u64, domain_id: u64 ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Permanently deletes a domain from the account. It cannot be undone.

Examples
use dnsimple::dnsimple::{Client, new_client};
use dnsimple::dnsimple::domains::DomainCreationPayload;

let client = new_client(true, String::from("AUTH_TOKEN"));
let domains_response = client.domains().delete_domain(1234, 42);
Arguments

account_id: The account ID domain_id: The ID of the domain we want to permanently delete

source§

impl Domains<'_>

The domains collaborators set of endpoints

See API Documentation: domains/collaborators

source

pub fn list_collaborators( &self, account_id: u64, domain_id: u64, options: Option<RequestOptions> ) -> Result<DNSimpleResponse<Vec<Collaborator>>, DNSimpleError>

List collaborators for the domain in the account.

Examples
use dnsimple::dnsimple::{Filters, new_client, Paginate, Sort};
use std::collections::HashMap;

let client = new_client(true, String::from("AUTH_TOKEN"));
let collaborators = client.domains().list_collaborators(1234, 1, None).unwrap().data.unwrap();
Arguments

account_id: The account ID domain_id: The ID of the domain we want to list the collaborators from options: The RequestOptions - Pagination

source

pub fn add_collaborator( &self, account_id: u64, domain_id: u64, email: &str ) -> Result<DNSimpleResponse<Collaborator>, DNSimpleError>

At the time of the add, a collaborator may or may not have a DNSimple account.

In case the collaborator doesn’t have a DNSimple account, the system will invite them to register to DNSimple first and then to accept the collaboration invitation.

In the other case, they are automatically added to the domain as collaborator. They can decide to reject the invitation later.

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let email = "existing-user@example.com";

let collaborator = client.domains().add_collaborator(1234, 1, email).unwrap().data.unwrap();
Arguments

account_id: The account ID domain_id: The ID of the domain we want to list the collaborators of email: The email of the collaborator to be added

source

pub fn remove_collaborator( &self, account_id: u64, domain_id: u64, collaborator_id: u64 ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Removes a collaborator from a domain

Examples
use dnsimple::dnsimple::{Client, new_client};
use dnsimple::dnsimple::domains::DomainCreationPayload;

let client = new_client(true, String::from("AUTH_TOKEN"));
let response = client.domains().remove_collaborator(1234, 42, 100);
Arguments

account_id: The account ID domain_id: The ID of the domain we want to permanently delete collaborator_id: The id of the collaborator we want to remove from the domain

source§

impl Domains<'_>

The domains dnssec set of endpoints

See API Documentation: domains/dnssec

source

pub fn enable_dnssec( &self, account_id: u64, domain: &str ) -> Result<DNSimpleResponse<Dnssec>, DNSimpleError>

Enable DNSSEC for the domain in the account. This will sign the zone. If the domain is registered it will also add the DS record to the corresponding registry.

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let dnssec = client.domains().enable_dnssec(1234, "example.com").unwrap().data.unwrap();
Arguments

account_id: The account ID domain: The ID or name of the domain we want to enable DNSSEC on

source

pub fn disable_dnssec( &self, account_id: u64, domain: &str ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Disable DNSSEC for the domain in the account.

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let response = client.domains().disable_dnssec(1234, "example.com");
Arguments

account_id: The account ID domain: The ID or name of the domain we want to disable DNSSEC on

source

pub fn get_dnssec( &self, account_id: u64, domain: &str ) -> Result<DNSimpleResponse<Dnssec>, DNSimpleError>

Get the status of DNSSEC, indicating whether it is currently enabled or disabled.

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let dnssec = client.domains().get_dnssec(1234, "example.com").unwrap().data.unwrap();
Arguments

account_id: The account ID domain: The ID or name of the domain we want retrieve the DNSSEC status from

source§

impl Domains<'_>

The domains email forwards set of endpoints

See API Documentation: domains/email-forwards

source

pub fn list_email_forwards( &self, account_id: u64, domain: &str, options: Option<RequestOptions> ) -> Result<DNSimpleResponse<Vec<EmailForwardsInList>>, DNSimpleError>

List email forwards for the domain in the account.

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let email_forwards_list = client.domains().list_email_forwards(1234, "example.com", None).unwrap().data.unwrap();
Arguments

account_id: The account ID domain: The ID or name of the domain we want list the email forwards options: The RequestOptions - Sort: id, from, to - Pagination

source

pub fn create_email_forward( &self, account_id: u64, domain: &str, payload: EmailForwardPayload ) -> Result<DNSimpleResponse<EmailForward>, DNSimpleError>

Create an email forward

Examples
use dnsimple::dnsimple::domains_email_forwards::EmailForwardPayload;
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let payload = EmailForwardPayload {
    alias_name: "My forward".to_string(),
    destination_email: "some@example.com".to_string(),
};
let email_forwards = client.domains().create_email_forward(1234, "example.com", payload).unwrap().data.unwrap();
Arguments

account_id: The account ID domain: The ID or name of the domain we want list the email forwards payload: The EmailForwardPayload with the data needed to create the email forward

source

pub fn get_email_forward( &self, account_id: u64, domain: &str, email_forward: u64 ) -> Result<DNSimpleResponse<EmailForward>, DNSimpleError>

Retrieve an email forward

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let email_forwards = client.domains().get_email_forward(1234, "example.com", 42).unwrap().data.unwrap();
Arguments

account_id: The account ID domain: The ID or name of the domain we want list the email forwards email_forward: The email forward id

source

pub fn delete_email_forward( &self, account_id: u64, domain: &str, email_forward: i32 ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Delete the email forward from the domain.

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let response = client.domains().delete_email_forward(1234, "example.com", 42);
Arguments

account_id: The account ID domain: The ID or name of the domain we want list the email forwards email_forward: The email forward id

source§

impl Domains<'_>

The domains push set of endpoints

See API Documentation: domains/pushes

source

pub fn initiate_push( &self, account_id: u64, domain: &str, payload: InitiatePushPayload ) -> Result<DNSimpleResponse<DomainPush>, DNSimpleError>

Initiate a push

Examples
use dnsimple::dnsimple::domains_push::InitiatePushPayload;
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let payload = InitiatePushPayload {
    new_account_email: String::from("admin@target-account.test"),
};
let push = client.domains().initiate_push(1234, "example.com", payload).unwrap().data.unwrap();
Arguments

account_id: The account id domain: The domain name or id payload: The InitiatePushPayload used to initiate a push

source

pub fn list_pushes( &self, account_id: u64, options: Option<RequestOptions> ) -> Result<DNSimpleResponse<Vec<DomainPush>>, DNSimpleError>

List pending pushes for the target account.

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let pushes = client.domains().list_pushes(1234, None).unwrap().data.unwrap();
Arguments

account_id: The account id options: The RequestOptions - Pagination

source

pub fn accept_push( &self, account_id: u64, push_id: u64 ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Accept a push

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let response = client.domains().accept_push(1234, 42);
Arguments

account_id: The account id push_id: The push id

source

pub fn reject_push( &self, account_id: u64, push_id: u64 ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Reject a push

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let response = client.domains().reject_push(1234, 42);
Arguments

account_id: The account id push_id: The push id

source§

impl Domains<'_>

The domains signer records set of endpoints

See API Documentation: domains/dnssec

source

pub fn list_delegation_signer_records( &self, account_id: u64, domain: &str, options: Option<RequestOptions> ) -> Result<DNSimpleResponse<Vec<DelegationSignerRecord>>, DNSimpleError>

List delegation signer records for the domain in the account.

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let signer_records = client.domains().list_delegation_signer_records(1234, "example.com", None).unwrap().data.unwrap();
Arguments

account_id: The account ID domain: The ID or name of the domain we want list the signer records from options The RequestOptions - Sort: id, created_at - Pagination

source

pub fn create_delegation_signer_record( &self, account_id: u64, domain: &str, payload: DelegationSignerRecordPayload ) -> Result<DNSimpleResponse<DelegationSignerRecord>, DNSimpleError>

Creates a delegation signer record

You only need to create a delegation signer record manually if your domain is registered with DNSimple but hosted with another DNS provider that is signing your zone. To enable DNSSEC on a domain that is hosted with DNSimple, use the DNSSEC enable endpoint.

Examples
use dnsimple::dnsimple::domains_signer_records::DelegationSignerRecordPayload;
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let payload = DelegationSignerRecordPayload {
    algorithm: String::from("13"),
    digest: String::from("684a1f049d7d082b7f98691657da5a65764913df7f065f6f8c36edf62d66ca03"),
    digest_type: String::from("2"),
    keytag: String::from("2371"),
    public_key: None,
};
let signer_record = client.domains().create_delegation_signer_record(1234, "example.com", payload).unwrap().data.unwrap();
Arguments

account_id: The account ID domain: The ID or name of the domain we want list the signer records from payload: The SignerRecordPayload with the data needed to create the delegation signer record

source

pub fn get_delegation_signer_record( &self, account_id: u64, domain: &str ) -> Result<DNSimpleResponse<DelegationSignerRecord>, DNSimpleError>

Get the delegation signer record under the domain for the account

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let signer_records = client.domains().get_delegation_signer_record(1234, "example.com").unwrap().data.unwrap();
Arguments

account_id: The account ID domain: The ID or name of the domain we want list the signer records from

source

pub fn delete_delegation_signer_record( &self, account_id: u64, domain: &str, delegation_signer_record_id: i32 ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Delete a Delegation Signer record

Examples
use dnsimple::dnsimple::new_client;

let client = new_client(true, String::from("AUTH_TOKEN"));
let response = client.domains().delete_delegation_signer_record(1234, "example.com", 42);
Arguments

account_id: The account ID domain: The ID or name of the domain we want list the signer records from ds_record_id: The delegation signer record id

Auto Trait Implementations§

§

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

§

impl<'a> Send for Domains<'a>

§

impl<'a> Sync for Domains<'a>

§

impl<'a> Unpin for Domains<'a>

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.