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;

    // Provided methods
    fn get_txt_record(&self, host: &str) -> Result<Option<String>>
       where Self: Sized { ... }
    fn create_txt_record(&self, host: &str, record: &String) -> Result<()>
       where Self: Sized { ... }
    fn update_txt_record(&self, host: &str, record: &String) -> Result<()>
       where Self: Sized { ... }
    fn delete_txt_record(&self, host: &str) -> Result<()>
       where Self: Sized { ... }
    fn get_a_record(&self, host: &str) -> Result<Option<Ipv4Addr>>
       where Self: Sized { ... }
    fn create_a_record(&self, host: &str, record: &Ipv4Addr) -> Result<()>
       where Self: Sized { ... }
    fn update_a_record(&self, host: &str, record: &Ipv4Addr) -> Result<()>
       where Self: Sized { ... }
    fn delete_a_record(&self, host: &str) -> Result<()>
       where Self: Sized { ... }
}
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.

Provided Methods§

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Implementors§