pub struct Client { /* private fields */ }Expand description
A configured connection to one Core endpoint; the entry point of the SDK.
Built with Client::builder. Cheap to clone and safe to share between tasks: clones
share one connection pool. Resource groups are reached through methods such as
zones and records.
§Errors
Every call can fail with:
Error::Transport: no response (DNS, TLS, refused connection, timeout).Error::Decode: the response is not Core’s envelope (e.g. a proxy error page).Error::ApiwithErrorCode::UnauthenticatedorErrorCode::InvalidApiKeyon/api/v1routes (ErrorCode::InvalidTokenfor a key without thedz_/du_prefix, seeApiKeyKind::of), andErrorCode::Forbiddenwhen the key lacks access.
The method docs list only the errors specific to that call.
§Examples
let client = dinio_sdk::Client::builder()
.base_url("https://api-dinio.bitelex.com")
.api_key("du_...")
.build()?;
for zone in client.zones().list_all().await? {
println!("{}", zone.name);
}Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Starts configuring a client; only the base URL is required.
Sourcepub fn zones(&self) -> Zones<'_>
pub fn zones(&self) -> Zones<'_>
Zones: list, get, create, delete, issue and revoke the zone key.
Sourcepub fn zone_members(&self) -> ZoneMembers<'_>
pub fn zone_members(&self) -> ZoneMembers<'_>
Who has access to a zone (Owner, Administrators).
Sourcepub fn users(&self) -> Users<'_>
pub fn users(&self) -> Users<'_>
The caller’s own user account: read it, issue or revoke the personal key.
Sourcepub fn redirects(&self) -> Redirects<'_>
pub fn redirects(&self) -> Redirects<'_>
HTTP(S) redirects by host name, inside the caller’s zones.
Sourcepub fn certificates(&self) -> Certificates<'_>
pub fn certificates(&self) -> Certificates<'_>
TLS certificates of zones: upload, renew, delete; read the ones Core issues for redirects.
Sourcepub fn records(&self) -> Records<'_>
pub fn records(&self) -> Records<'_>
Records: groups (RRsets) and their values. See also the name-based
ops functions.
Sourcepub fn geo_bans(&self) -> GeoBans<'_>
pub fn geo_bans(&self) -> GeoBans<'_>
Geo bans of record values, by uuid. See also ops::add_geo_bans.
Sourcepub fn audit_logs(&self) -> AuditLogs<'_>
pub fn audit_logs(&self) -> AuditLogs<'_>
Who did what, on the caller’s account and zones.
Sourcepub fn stats(&self) -> Stats<'_>
pub fn stats(&self) -> Stats<'_>
Query statistics of the caller’s zones and client identities (Relay telemetry).
Sourcepub fn free_domains(&self) -> FreeDomains<'_>
pub fn free_domains(&self) -> FreeDomains<'_>
Free domains to lease a subdomain of; works without an API key.
Sourcepub fn health_checks(&self) -> HealthChecks<'_>
pub fn health_checks(&self) -> HealthChecks<'_>
Health checks, one per record value.
Sourcepub fn client_identities(&self) -> ClientIdentities<'_>
pub fn client_identities(&self) -> ClientIdentities<'_>
Client identities: clients Relay recognises (by IP, DoT hostname or DoH path), so that sinkhole lists can apply to them.
Sourcepub fn sinkhole_lists(&self) -> SinkholeLists<'_>
pub fn sinkhole_lists(&self) -> SinkholeLists<'_>
Sinkhole lists: blacklists and whitelists of names.
Sourcepub fn sinkhole_roles(&self) -> SinkholeRoles<'_>
pub fn sinkhole_roles(&self) -> SinkholeRoles<'_>
Rules of sinkhole lists. See also
ops::select_sinkhole_roles.
Sourcepub fn sinkhole_links(&self) -> SinkholeLinks<'_>
pub fn sinkhole_links(&self) -> SinkholeLinks<'_>
Links between client identities and sinkhole lists.
Sourcepub async fn health(&self) -> Result<Health>
pub async fn health(&self) -> Result<Health>
GET /api/health: unauthenticated liveness of the Core instance that answered.
Not enveloped, and works without credentials.
§Examples
let health = client.health().await?;
println!("Core {} is {}", health.version.as_deref().unwrap_or("?"), health.status);