1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//! # dns-orchestrator-provider
//!
//! A unified DNS provider abstraction library for managing DNS records across
//! multiple cloud platforms.
//!
//! ## Supported Providers
//!
//! | Provider | Feature Flag | Auth Method |
//! |----------|-------------|-------------|
//! | [Cloudflare](https://www.cloudflare.com/) | `cloudflare` | Bearer Token |
//! | [Aliyun DNS](https://www.aliyun.com/product/dns) | `aliyun` | HMAC-SHA256 (V3) |
//! | [DNSPod (Tencent Cloud)](https://www.dnspod.cn/) | `dnspod` | TC3-HMAC-SHA256 |
//! | [Huawei Cloud DNS](https://www.huaweicloud.com/product/dns.html) | `huaweicloud` | AK/SK Signing |
//!
//! ## Feature Flags
//!
//! ### Provider Selection
//!
//! - **`all-providers`** *(default)* — Enable all providers listed above.
//! - **`cloudflare`** — Enable only the Cloudflare provider.
//! - **`aliyun`** — Enable only the Aliyun DNS provider.
//! - **`dnspod`** — Enable only the Tencent Cloud `DNSPod` provider.
//! - **`huaweicloud`** — Enable only the Huawei Cloud DNS provider.
//!
//! ### TLS Backend
//!
//! - **`native-tls`** — Use the platform's native TLS implementation.
//! - **`rustls`** *(default)* — Use rustls, a pure-Rust TLS implementation.
//!
//! ## Quick Start
//!
//! Add to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! dns-orchestrator-provider = { version = "0.1", features = ["all-providers"] }
//! ```
//!
//! Or enable only the providers you need:
//!
//! ```toml
//! [dependencies]
//! dns-orchestrator-provider = { version = "0.1", default-features = false, features = ["cloudflare", "rustls"] }
//! ```
//!
//! ## Usage
//!
//! ```rust,no_run
//! use dns_orchestrator_provider::{
//! create_provider, DnsProvider, PaginationParams, ProviderCredentials,
//! };
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // 1. Create a provider from credentials
//! let credentials = ProviderCredentials::Cloudflare {
//! api_token: "your-token".to_string(),
//! };
//! let provider = create_provider(credentials)?;
//!
//! // 2. Validate credentials against the remote API
//! provider.validate_credentials().await?;
//!
//! // 3. List domains
//! let domains = provider.list_domains(&PaginationParams::default()).await?;
//! for domain in &domains.items {
//! println!("{} ({:?})", domain.name, domain.status);
//! }
//!
//! // 4. List DNS records for the first domain
//! let records = provider
//! .list_records(&domains.items[0].id, &Default::default())
//! .await?;
//! for record in &records.items {
//! println!(
//! "{} {:?} -> {}",
//! record.name,
//! record.data.record_type(),
//! record.data.display_value()
//! );
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Creating Records
//!
//! ```rust,no_run
//! # use dns_orchestrator_provider::*;
//! # async fn example(provider: std::sync::Arc<dyn DnsProvider>) -> Result<()> {
//! let request = CreateDnsRecordRequest {
//! domain_id: "example.com".to_string(),
//! name: "www".to_string(),
//! ttl: 600,
//! data: RecordData::A { address: "1.2.3.4".to_string() },
//! proxied: None,
//! };
//! let record = provider.create_record(&request).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Error Handling
//!
//! All provider operations return [`Result<T, ProviderError>`](ProviderError).
//! The error enum provides structured variants for common failure modes:
//!
//! - [`ProviderError::InvalidCredentials`] — authentication failed
//! - [`ProviderError::RecordNotFound`] — DNS record not found
//! - [`ProviderError::RateLimited`] — API rate limit exceeded (retryable)
//! - [`ProviderError::NetworkError`] — network connectivity issue (retryable)
//!
//! Transient errors (`NetworkError`, `Timeout`, `RateLimited`) are automatically
//! retried with exponential backoff. See [`ProviderError`] for the full list.
// Re-export error types
pub use ;
// Re-export factory functions
pub use ;
// Re-export core trait only (internal traits are not exported)
pub use DnsProvider;
// Re-export types
pub use ;
// Re-export utils module
pub use datetime;
// Re-export concrete providers (behind feature flags)
pub use CloudflareProvider;
pub use AliyunProvider;
pub use DnspodProvider;
pub use HuaweicloudProvider;