Skip to main content

Records

Struct Records 

Source
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>

Source

pub async fn list( &self, zone_id: Uuid, filter: &RecordFilter, page: PageRequest, ) -> Result<Page<RecordValue>>

One page of the zone’s record values, ordered by name, type and creation, so the values of a group are next to each other. A page boundary can split a group: fetch every page (list_all) or read one group with get.

GET /api/v1/records?zone_id=...

Source

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());
}
Source

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)).

Source

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::Validation for bad data, a name outside the zone, or a missing ttl for a new group.
  • ErrorCode::Conflict for a duplicate value, a TTL different from the group’s, or a violated zone rule (listed in details).
Source

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
Source

pub async fn set_ttl( &self, zone_id: Uuid, name: &str, record_type: &str, ttl: u32, ) -> Result<RecordSet>

Sets the TTL shared by every value of the group (0 to 2^31-1 seconds).

PATCH /api/v1/records/:name/ttl?zone_id=...

§Errors

ErrorCode::NotFound if the group does not exist.

Source

pub async fn delete(&self, uuid: Uuid) -> Result<()>

Deletes one value, with its geo bans and health check; the group goes with its last value (a new first value then needs a ttl again).

DELETE /api/v1/records/:uuid

§Errors

ErrorCode::NotFound if there is no such value.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Records<'a>

§

impl<'a> !UnwindSafe for Records<'a>

§

impl<'a> Freeze for Records<'a>

§

impl<'a> Send for Records<'a>

§

impl<'a> Sync for Records<'a>

§

impl<'a> Unpin for Records<'a>

§

impl<'a> UnsafeUnpin for Records<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more