Skip to main content

add_value

Function add_value 

Source
pub async fn add_value(
    client: &Client,
    zone: &Zone,
    name: &str,
    record_type: &str,
    add: AddValue,
) -> Result<Added>
Expand description

Adds a value to a group, creating the group if needed. name is the full owner name (crate::ops::qualify_name).

A new group gets add.ttl or DEFAULT_TTL. An existing group keeps its TTL, so add.ttl must then be None or equal to it.

§Errors

  • Error::InvalidInput if add.ttl differs from an existing group’s TTL, or add.host_health is Auto (create a health check for the value instead).
  • Any error of Records::create, e.g. invalid data or a duplicate value.

§Examples

use dinio_sdk::ops::{self, AddValue};

let name = ops::qualify_name("@", &zone.name)?;
let add = AddValue { data: "10 mail.example.com".into(), ..Default::default() };
let added = ops::add_value(client, zone, &name, "MX", add).await?;
if added.new_group {
    println!("new MX group with TTL {}", added.ttl);
}