pub struct ClientIdentities<'a> { /* private fields */ }Expand description
Client identity routes, from Client::client_identities.
With a personal key you see and change only your own identities (all of them as an
Admin). A zone key has no access: every route answers
ErrorCode::Forbidden.
Implementations§
Source§impl<'a> ClientIdentities<'a>
impl<'a> ClientIdentities<'a>
Sourcepub async fn list(
&self,
filter: &ClientIdentityFilter,
) -> Result<Vec<ClientIdentity>>
pub async fn list( &self, filter: &ClientIdentityFilter, ) -> Result<Vec<ClientIdentity>>
The caller’s identities, all at once (Core does not paginate them).
GET /api/v1/client-identities
Sourcepub async fn get(&self, identity: &str) -> Result<ClientIdentity>
pub async fn get(&self, identity: &str) -> Result<ClientIdentity>
One identity, by uuid or by its identify value (e.g. 203.0.113.10).
GET /api/v1/client-identities/:ref
§Errors
ErrorCode::NotFoundif there is no such identity.ErrorCode::Forbiddenif it belongs to another user.
§Examples
let identity = client.client_identities().get("203.0.113.10").await?;
println!("{} is {}", identity.identify, identity.uuid);Sourcepub async fn create(
&self,
identity: &NewClientIdentity,
) -> Result<ClientIdentity>
pub async fn create( &self, identity: &NewClientIdentity, ) -> Result<ClientIdentity>
Creates an identity owned by the caller; Relay starts recognising the client. For
Hostname/Path the returned identity carries the identify Core generated.
POST /api/v1/client-identities
§Errors
Error::InvalidInputifidentifyis given forHostname/Path, or missing forIp/None(checked before sending).ErrorCode::Conflictif the IP address is already in use, by anyone.ErrorCode::Validationifidentifyis not an IP address.
§Examples
use dinio_sdk::models::{ClientIdentityType, NewClientIdentity};
let new = NewClientIdentity {
identify: None,
id_type: ClientIdentityType::Path,
name: Some("phone".into()),
};
let identity = client.client_identities().create(&new).await?;
println!("DoH path part: {}", identity.identify);Sourcepub async fn update(
&self,
uuid: Uuid,
patch: &ClientIdentityPatch,
) -> Result<ClientIdentity>
pub async fn update( &self, uuid: Uuid, patch: &ClientIdentityPatch, ) -> Result<ClientIdentity>
Changes an identity; fields left None stay as they are.
PATCH /api/v1/client-identities/:uuid
§Errors
ErrorCode::NotFoundif there is no such identity.ErrorCode::Forbiddenif it belongs to another user.ErrorCode::Suspendedif the identity or its owner is suspended.ErrorCode::Conflictif the newidentifyis in use.ErrorCode::Validationif the result would not pairidentifyandid_typecorrectly (seeClientIdentityPatch).
Sourcepub async fn regenerate_identify(&self, uuid: Uuid) -> Result<ClientIdentity>
pub async fn regenerate_identify(&self, uuid: Uuid) -> Result<ClientIdentity>
Replaces the generated identify of a Hostname/Path identity with a new one.
The old value stops working on Relay, so every device configured with it needs the
new one.
POST /api/v1/client-identities/:uuid/identify
§Errors
ErrorCode::NotFoundif there is no such identity.ErrorCode::Forbiddenif it belongs to another user.ErrorCode::Suspendedif the identity or its owner is suspended.ErrorCode::Validationfor anIp/Noneidentity, whoseidentifyis an address, not generated.
Sourcepub async fn delete(&self, uuid: Uuid) -> Result<()>
pub async fn delete(&self, uuid: Uuid) -> Result<()>
Deletes an identity.
DELETE /api/v1/client-identities/:uuid
§Errors
ErrorCode::NotFoundif there is no such identity.ErrorCode::Forbiddenif it belongs to another user.ErrorCode::Conflictwhile sinkhole lists are linked to it; remove the links first (SinkholeLinks::delete).