DnsProvider

Trait DnsProvider 

Source
pub trait DnsProvider {
    // Required methods
    fn get_record<T>(&self, rtype: RecordType, host: &str) -> Result<Option<T>>
       where T: DeserializeOwned,
             Self: Sized;
    fn create_record<T>(
        &self,
        rtype: RecordType,
        host: &str,
        record: &T,
    ) -> Result<()>
       where T: Serialize + DeserializeOwned + Display + Clone,
             Self: Sized;
    fn update_record<T>(
        &self,
        rtype: RecordType,
        host: &str,
        record: &T,
    ) -> Result<()>
       where T: Serialize + DeserializeOwned + Display + Clone,
             Self: Sized;
    fn delete_record(&self, rtype: RecordType, host: &str) -> Result<()>
       where Self: Sized;
    fn get_txt_record(&self, host: &str) -> Result<Option<String>>;
    fn create_txt_record(&self, host: &str, record: &String) -> Result<()>;
    fn update_txt_record(&self, host: &str, record: &String) -> Result<()>;
    fn delete_txt_record(&self, host: &str) -> Result<()>;
    fn get_a_record(&self, host: &str) -> Result<Option<Ipv4Addr>>;
    fn create_a_record(&self, host: &str, record: &Ipv4Addr) -> Result<()>;
    fn update_a_record(&self, host: &str, record: &Ipv4Addr) -> Result<()>;
    fn delete_a_record(&self, host: &str) -> Result<()>;
}
Expand description

A trait for a DNS provider.

This trait defines the basic operations that a DNS provider must support.

The trait provides methods for creating, reading, updating, and deleting DNS records. It also provides default implementations for TXT and A records.

Required Methods§

Source

fn get_record<T>(&self, rtype: RecordType, host: &str) -> Result<Option<T>>
where T: DeserializeOwned, Self: Sized,

Get a DNS record by host and record type.

Source

fn create_record<T>( &self, rtype: RecordType, host: &str, record: &T, ) -> Result<()>

Create a new DNS record by host and record type.

Source

fn update_record<T>( &self, rtype: RecordType, host: &str, record: &T, ) -> Result<()>

Update a DNS record by host and record type.

Source

fn delete_record(&self, rtype: RecordType, host: &str) -> Result<()>
where Self: Sized,

Delete a DNS record by host and record type.

Source

fn get_txt_record(&self, host: &str) -> Result<Option<String>>

Get a TXT record.

This is a helper method that calls get_record with the TXT record type.

Source

fn create_txt_record(&self, host: &str, record: &String) -> Result<()>

Create a new TXT record.

This is a helper method that calls create_record with the TXT record type.

Source

fn update_txt_record(&self, host: &str, record: &String) -> Result<()>

Update a TXT record.

This is a helper method that calls update_record with the TXT record type.

Source

fn delete_txt_record(&self, host: &str) -> Result<()>

Delete a TXT record.

This is a helper method that calls delete_record with the TXT record type.

Source

fn get_a_record(&self, host: &str) -> Result<Option<Ipv4Addr>>

Get an A record.

This is a helper method that calls get_record with the A record type.

Source

fn create_a_record(&self, host: &str, record: &Ipv4Addr) -> Result<()>

Create a new A record.

This is a helper method that calls create_record with the A record type.

Source

fn update_a_record(&self, host: &str, record: &Ipv4Addr) -> Result<()>

Update an A record.

This is a helper method that calls update_record with the A record type.

Source

fn delete_a_record(&self, host: &str) -> Result<()>

Delete an A record.

This is a helper method that calls delete_record with the A record type.

Implementors§