Skip to main content

SinkholeLists

Struct SinkholeLists 

Source
pub struct SinkholeLists<'a> { /* private fields */ }
Expand description

Sinkhole list routes, from Client::sinkhole_lists.

Rules are in SinkholeRoles, links to client identities in SinkholeLinks. With a personal key you see and change only your own lists (all of them as an Admin). A zone key has no access: every route answers ErrorCode::Forbidden.

Lists have an optional, non-unique name; to find one by name, see ops::find_sinkhole_list.

§Examples

A blacklist for one client:

use dinio_sdk::models::{NewSinkholeList, NewSinkholeRole, SinkholeListType, SinkholeRoleType};

let identity = client.client_identities().get("203.0.113.10").await?;
let created = client
    .sinkhole_lists()
    .create(&NewSinkholeList {
        list_type: SinkholeListType::Blacklist,
        name: Some("ads".into()),
        is_shared: None,
        link_to: vec![identity.uuid],
    })
    .await?;
client
    .sinkhole_roles()
    .create(&NewSinkholeRole {
        list_id: created.list.uuid,
        sinkhole_type: SinkholeRoleType::Wildcard,
        pattern: "*.ads.example".into(),
    })
    .await?;

Implementations§

Source§

impl<'a> SinkholeLists<'a>

Source

pub async fn list(&self, shared: bool) -> Result<Vec<SinkholeList>>

The caller’s lists, or with shared every shared list on the platform (any owner); all at once (Core does not paginate them). Rules are not included.

GET /api/v1/sinkhole-lists[?shared=true]

Source

pub async fn get(&self, uuid: Uuid, with_roles: bool) -> Result<SinkholeList>

One list; with with_roles, its roles are filled in. Owner or Admin only, also for a shared list.

GET /api/v1/sinkhole-lists/:uuid[?include=roles]

§Errors
Source

pub async fn create( &self, list: &NewSinkholeList, ) -> Result<CreatedSinkholeList>

Creates an empty list owned by the caller, linked to the identities in link_to in the same transaction.

POST /api/v1/sinkhole-lists

§Errors

Nothing is created if:

Source

pub async fn update( &self, uuid: Uuid, patch: &SinkholeListPatch, ) -> Result<SinkholeList>

Changes whether a list is shared and/or its name. Owner or Admin only.

PATCH /api/v1/sinkhole-lists/:uuid

§Errors
Source

pub async fn set_shared( &self, uuid: Uuid, is_shared: bool, ) -> Result<SinkholeList>

Shares or unshares a list; shorthand for update. Unsharing keeps the links other users already have. Owner or Admin only.

PATCH /api/v1/sinkhole-lists/:uuid

§Errors

As update.

Source

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

Deletes a list with its rules and every link to it, including other users’ links to a shared list. Owner or Admin only.

DELETE /api/v1/sinkhole-lists/:uuid

§Errors

Auto Trait Implementations§

§

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

§

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

§

impl<'a> Freeze for SinkholeLists<'a>

§

impl<'a> Send for SinkholeLists<'a>

§

impl<'a> Sync for SinkholeLists<'a>

§

impl<'a> Unpin for SinkholeLists<'a>

§

impl<'a> UnsafeUnpin for SinkholeLists<'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