pub async fn add_zones(
client: &Arc<Client>,
token: &Arc<String>,
zone_name: &str,
zone_type: &str,
server: &str,
key_data: &RndcKeyData,
soa_record: Option<&SOARecord>,
name_server_ips: Option<&HashMap<String, String>>,
secondary_ips: Option<&[String]>,
primary_ips: Option<&[String]>,
) -> Result<bool>Expand description
Add a zone via HTTP API (primary or secondary).
This is the centralized zone addition function that dispatches to either
add_primary_zone or add_secondary_zone based on the zone type.
This operation is idempotent - if the zone already exists, it returns success without attempting to re-add it.
§Arguments
client- HTTP clienttoken- Authentication tokenzone_name- Name of the zone (e.g., “example.com”)zone_type- Zone type (useZONE_TYPE_PRIMARYorZONE_TYPE_SECONDARYconstants)server- API endpoint (e.g., “bind9-primary-api:8080” or “bind9-secondary-api:8080”)key_data- RNDC key datasoa_record- Optional SOA record data (required for primary zones, ignored for secondary)name_server_ips- Optional map of nameserver hostnames to IP addresses (for primary zones)secondary_ips- Optional list of secondary server IPs for also-notify and allow-transfer (for primary zones)primary_ips- Optional list of primary server IPs to transfer from (for secondary zones)
§Returns
Returns Ok(true) if the zone was added, Ok(false) if it already existed.
§Errors
Returns an error if:
- The HTTP request fails
- The zone cannot be added
- For primary zones: SOA record is None
- For secondary zones:
primary_ipsis None or empty