Crate desec_api

Source
Expand description

Unofficial Rust client for the deSEC DNS API.

§Supported endpoints

  • Manage accounts

    • Obtain a Captcha
    • Register Account with optional domain creation
    • Log In (Retrieve API token using email & password)
    • Log Out (When client was created from credentials)
    • Retrieve account information
    • Modify account settings (only updating outreach_preference is supported by the API)
    • Password reset (Request for password reset & confirmation, but handling of approval via mail needs to be handled)
    • Password change
    • Change of email address
    • Delete account
  • Manage domains

    • Creating a domain
    • List domains
    • Retrieve a specific domain
    • Identifying the responsible domain for a DNS name
    • Exporting a domain as zonefile
    • Deleting a domain
  • Manage DNS records

    • Creating an RRset
    • Retrieving all RRsets in a Zone
    • Retrieving all RRsets in a Zone filtered by type
    • Retrieving all RRsets in a Zone filtered by subname
    • Retrieving a Specific RRset
    • Modifying an RRset
    • Deleting an RRset
  • Manage Tokens

    • Create a token
    • Modify a token
    • List all tokens
    • Retrieve a specific token
    • Delete a token
  • Manage Token Policies

    • Create a token policy (including default policy)
    • Modify a token policy
    • List all token policies
    • Delete a token policy

§Currently not supported

  • Pagination when over 500 items exist
  • Manage DNS records
    • Bulk operations when modifying or deleting RRsets

§General errors for all clients

There are some error which can occure for every client (account, domain, rrset, token).

This method fails with:

§Usage example

§With existing API token

use desec_api::Client;

#[tokio::main]
async fn main() {

   let client = Client::new("i-T3b1h_OI-H9ab8tRS98stGtURe".to_string())
       .unwrap();

   // Retrieve account informations
   let account_info = client
       .account()
       .get_account_info()
       .await
       .unwrap();
   
   println!("{:#?}", account_info);
}

§With login credentials

use desec_api::Client;

#[tokio::main]
async fn main() {

   let client = Client::new_from_credentials("info@example.com", "mysecret")
       .await
       .unwrap();

   // Retrieve all RRsets of domain `example.com`
   let rrsets = client
       .rrset()
       .get_rrsets("example.com")
       .await
       .unwrap();
   
   println!("{:#?}", rrsets);
}

Modules§

account
domain
rrset
token

Structs§

Client

Enums§

Error

Constants§

API_URL
USERAGENT