Struct PiHoleAPIConfigWithKey

Source
pub struct PiHoleAPIConfigWithKey { /* private fields */ }
Expand description

Pi Hole API Struct

Implementations§

Source§

impl PiHoleAPIConfigWithKey

Source

pub fn new(host: String, api_key: String) -> Self

Creates a new Pi Hole API instance. host must begin with the protocol e.g. http:// or https://

Trait Implementations§

Source§

impl Debug for PiHoleAPIConfigWithKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> AuthenticatedPiHoleAPI for T
where T: PiHoleAPIHost + PiHoleAPIKey,

Source§

fn get_top_items(&self, count: &Option<u32>) -> Result<TopItems, APIError>

Get the top domains and ads and the number of queries for each. Limit the number of items with count.
Source§

fn get_top_clients(&self, count: &Option<u32>) -> Result<TopClients, APIError>

Get the top clients and the number of queries for each. Limit the number of items with count.
Source§

fn get_top_clients_blocked( &self, count: Option<u32>, ) -> Result<TopClientsBlocked, APIError>

Get the top clients blocked and the number of queries for each. Limit the number of items with count.
Source§

fn get_forward_destinations( &self, unsorted: bool, ) -> Result<ForwardDestinations, APIError>

Get the percentage of queries forwarded to each target.
Source§

fn get_query_types(&self) -> Result<QueryTypes, APIError>

Get the number of queries per type.
Source§

fn get_all_queries(&self, count: u32) -> Result<Vec<Query>, APIError>

Get all DNS query data. Limit the number of items with count.
Source§

fn enable(&self) -> Result<Status, APIError>

Enable the Pi-Hole.
Source§

fn disable(&self, seconds: u64) -> Result<Status, APIError>

Disable the Pi-Hole for seconds seconds.
Source§

fn get_cache_info(&self) -> Result<CacheInfo, APIError>

Get statistics about the DNS cache.
Source§

fn get_client_names(&self) -> Result<Vec<ClientName>, APIError>

Get hostname and IP for hosts
Source§

fn get_over_time_data_clients( &self, ) -> Result<HashMap<String, Vec<u64>>, APIError>

Get queries by client over time. Maps timestamp to the number of queries by clients. Order of clients in the Vector is the same as for get_client_names
Source§

fn get_network(&self) -> Result<Network, APIError>

Get information about network clients.
Source§

fn get_queries_count(&self) -> Result<u64, APIError>

Get the total number of queries received.
Source§

fn list_add( &self, domain: &str, list: &str, ) -> Result<ListModificationResponse, APIError>

Add domains to a custom white/blacklist. Acceptable lists are: white, black, white_regex, black_regex, white_wild, black_wild, audit.
Source§

fn list_remove( &self, domain: &str, list: &str, ) -> Result<ListModificationResponse, APIError>

Remove domain to a custom white/blacklist. Acceptable lists are: white, black, white_regex, black_regex, white_wild, black_wild, audit.
Source§

fn list_get_domains( &self, list: &str, ) -> Result<Vec<CustomListDomainDetails>, APIError>

Get a list of domains on a particular custom white/blacklist Acceptable lists are: white, black, white_regex, black_regex, white_wild, black_wild, audit.
Source§

fn get_custom_dns_records(&self) -> Result<Vec<CustomDNSRecord>, APIError>

Get a list of custom DNS records
Source§

fn add_custom_dns_record( &self, ip: &IpAddr, domain: &str, ) -> Result<ListModificationResponse, APIError>

Add a custom DNS record
Source§

fn delete_custom_dns_record( &self, ip: &IpAddr, domain: &str, ) -> Result<ListModificationResponse, APIError>

Delete a custom DNS record
Source§

fn get_custom_cname_records(&self) -> Result<Vec<CustomCNAMERecord>, APIError>

Get a list of custom CNAME records
Source§

fn add_custom_cname_record( &self, domain: &str, target_domain: &str, ) -> Result<ListModificationResponse, APIError>

Add a custom CNAME record
Source§

fn delete_custom_cname_record( &self, domain: &str, target_domain: &str, ) -> Result<ListModificationResponse, APIError>

Delete a custom CNAME record
Source§

fn get_max_logage(&self) -> Result<f32, APIError>

Get max logage
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.

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.

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

impl<T> UnauthenticatedPiHoleAPI for T
where T: PiHoleAPIHost,

Source§

fn get_version(&self) -> Result<u32, APIError>

Get simple PiHole version

Source§

fn get_versions(&self) -> Result<Versions, APIError>

Get versions of core, FTL and web and if updates are available

Source§

fn get_summary_raw(&self) -> Result<SummaryRaw, APIError>

Get statistics in a raw format (no number format)
Source§

fn get_summary(&self) -> Result<Summary, APIError>

Get statistics in a formatted style
Source§

fn get_over_time_data_10_mins(&self) -> Result<OverTimeData, APIError>

Get statistics on the number of domains and ads for each 10 minute period
Source§

impl<T> ErasedDestructor for T
where T: 'static,