pub struct Records<'a> { /* private fields */ }Expand description
Record routes, from Client::records.
With a zone key, Core always uses the key’s own zone, whatever zone_id is passed.
For name-based work (a value by its data), see ops.
Implementations§
Source§impl<'a> Records<'a>
impl<'a> Records<'a>
Sourcepub async fn list(
&self,
zone_id: Uuid,
filter: &RecordFilter,
page: PageRequest,
) -> Result<Page<RecordValue>>
pub async fn list( &self, zone_id: Uuid, filter: &RecordFilter, page: PageRequest, ) -> Result<Page<RecordValue>>
Sourcepub async fn list_all(
&self,
zone_id: Uuid,
filter: &RecordFilter,
) -> Result<Vec<RecordValue>>
pub async fn list_all( &self, zone_id: Uuid, filter: &RecordFilter, ) -> Result<Vec<RecordValue>>
All record values of a zone matching filter, following pagination. For a grouped
view, pass the result to ops::group_values.
GET /api/v1/records?zone_id=..., as many times as there are pages.
§Examples
use dinio_sdk::api::RecordFilter;
use dinio_sdk::ops;
let filter = RecordFilter { record_type: Some("MX".into()), ..Default::default() };
let values = client.records().list_all(zone.uuid, &filter).await?;
for group in ops::group_values(values) {
println!("{} {} {} ({} values)", group.name, group.ttl, group.record_type, group.values.len());
}Sourcepub async fn get(
&self,
zone_id: Uuid,
name: &str,
record_type: &str,
with_geo_bans: bool,
) -> Result<RecordSet>
pub async fn get( &self, zone_id: Uuid, name: &str, record_type: &str, with_geo_bans: bool, ) -> Result<RecordSet>
One group with its values. name is the full owner name. With with_geo_bans,
each value’s geo_bans is filled in.
GET /api/v1/records/:name?zone_id=...&type=...
§Errors
ErrorCode::NotFound if the group does not exist
(ops::find_group turns that into Ok(None)).
Sourcepub async fn create(&self, value: &NewRecordValue) -> Result<RecordValue>
pub async fn create(&self, value: &NewRecordValue) -> Result<RecordValue>
Adds a value (returned with the group’s ttl); creates the group if it does not
exist. Core validates and
canonicalizes data and checks the zone rules (e.g. CNAME next to other types).
ops::add_value handles the TTL rule for you.
POST /api/v1/records
§Errors
ErrorCode::Validationfor bad data, a name outside the zone, or a missingttlfor a new group.ErrorCode::Conflictfor a duplicate value, a TTL different from the group’s, or a violated zone rule (listed indetails).
Sourcepub async fn update(
&self,
uuid: Uuid,
patch: &RecordValuePatch,
) -> Result<RecordValue>
pub async fn update( &self, uuid: Uuid, patch: &RecordValuePatch, ) -> Result<RecordValue>
Changes one value; fields left None stay as they are.
PATCH /api/v1/records/:uuid
§Errors
ErrorCode::NotFoundif there is no such value.ErrorCode::ValidationorErrorCode::Conflictfor new data, as increate.