pub struct Domains<'a> {
pub client: &'a Client,
}
Expand description
The Domains Service handles the domains endpoint of the DNSimple API.
Fields§
§client: &'a Client
Implementations§
source§impl Domains<'_>
impl Domains<'_>
sourcepub fn list_domains(
&self,
account_id: u64,
options: Option<RequestOptions>
) -> Result<DNSimpleResponse<Vec<Domain>>, DNSimpleError>
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
sourcepub fn create_domain(
&self,
account_id: u64,
name: String
) -> Result<DNSimpleResponse<Domain>, DNSimpleError>
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
sourcepub fn get_domain(
&self,
account_id: u64,
domain_id: u64
) -> Result<DNSimpleResponse<Domain>, DNSimpleError>
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
sourcepub fn delete_domain(
&self,
account_id: u64,
domain_id: u64
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
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<'_>
impl Domains<'_>
The domains collaborators set of endpoints
sourcepub fn list_collaborators(
&self,
account_id: u64,
domain_id: u64,
options: Option<RequestOptions>
) -> Result<DNSimpleResponse<Vec<Collaborator>>, DNSimpleError>
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
sourcepub fn add_collaborator(
&self,
account_id: u64,
domain_id: u64,
email: &str
) -> Result<DNSimpleResponse<Collaborator>, DNSimpleError>
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
sourcepub fn remove_collaborator(
&self,
account_id: u64,
domain_id: u64,
collaborator_id: u64
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
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<'_>
impl Domains<'_>
The domains dnssec set of endpoints
sourcepub fn enable_dnssec(
&self,
account_id: u64,
domain: &str
) -> Result<DNSimpleResponse<Dnssec>, DNSimpleError>
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
sourcepub fn disable_dnssec(
&self,
account_id: u64,
domain: &str
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
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
sourcepub fn get_dnssec(
&self,
account_id: u64,
domain: &str
) -> Result<DNSimpleResponse<Dnssec>, DNSimpleError>
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<'_>
impl Domains<'_>
The domains email forwards set of endpoints
sourcepub fn list_email_forwards(
&self,
account_id: u64,
domain: &str,
options: Option<RequestOptions>
) -> Result<DNSimpleResponse<Vec<EmailForwardsInList>>, DNSimpleError>
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
sourcepub fn create_email_forward(
&self,
account_id: u64,
domain: &str,
payload: EmailForwardPayload
) -> Result<DNSimpleResponse<EmailForward>, DNSimpleError>
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
sourcepub fn get_email_forward(
&self,
account_id: u64,
domain: &str,
email_forward: u64
) -> Result<DNSimpleResponse<EmailForward>, DNSimpleError>
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
sourcepub fn delete_email_forward(
&self,
account_id: u64,
domain: &str,
email_forward: i32
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
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<'_>
impl Domains<'_>
The domains push set of endpoints
sourcepub fn initiate_push(
&self,
account_id: u64,
domain: &str,
payload: InitiatePushPayload
) -> Result<DNSimpleResponse<DomainPush>, DNSimpleError>
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
sourcepub fn list_pushes(
&self,
account_id: u64,
options: Option<RequestOptions>
) -> Result<DNSimpleResponse<Vec<DomainPush>>, DNSimpleError>
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
sourcepub fn accept_push(
&self,
account_id: u64,
push_id: u64
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
pub fn accept_push( &self, account_id: u64, push_id: u64 ) -> Result<DNSimpleEmptyResponse, DNSimpleError>
sourcepub fn reject_push(
&self,
account_id: u64,
push_id: u64
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
pub fn reject_push( &self, account_id: u64, push_id: u64 ) -> Result<DNSimpleEmptyResponse, DNSimpleError>
source§impl Domains<'_>
impl Domains<'_>
The domains signer records set of endpoints
sourcepub fn list_delegation_signer_records(
&self,
account_id: u64,
domain: &str,
options: Option<RequestOptions>
) -> Result<DNSimpleResponse<Vec<DelegationSignerRecord>>, DNSimpleError>
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
sourcepub fn create_delegation_signer_record(
&self,
account_id: u64,
domain: &str,
payload: DelegationSignerRecordPayload
) -> Result<DNSimpleResponse<DelegationSignerRecord>, DNSimpleError>
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
sourcepub fn get_delegation_signer_record(
&self,
account_id: u64,
domain: &str
) -> Result<DNSimpleResponse<DelegationSignerRecord>, DNSimpleError>
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
sourcepub fn delete_delegation_signer_record(
&self,
account_id: u64,
domain: &str,
delegation_signer_record_id: i32
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
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