Skip to main content

Controller

Struct Controller 

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

The main entry point for consumers.

Cheaply cloneable via Arc<ControllerInner>. Manages the full connection lifecycle: authentication, background data refresh, command routing, and reactive entity streaming.

Implementations§

Source§

impl Controller

Source

pub fn new(config: ControllerConfig) -> Self

Create a new Controller from configuration. Does NOT connect – call connect() to authenticate and start background tasks.

Source

pub fn config(&self) -> &ControllerConfig

Access the controller configuration.

Source

pub fn store(&self) -> &Arc<DataStore>

Access the underlying DataStore.

Source

pub async fn connect(&self) -> Result<(), CoreError>

Connect to the controller.

Detects the platform, authenticates, performs an initial data refresh, and spawns background tasks (periodic refresh, command processor).

Source

pub async fn disconnect(&self)

Disconnect from the controller.

Cancels background tasks, logs out if session-based, and resets the connection state to Disconnected.

Source

pub async fn full_refresh(&self) -> Result<(), CoreError>

Fetch all data from the controller and update the DataStore.

Pulls devices, clients, and events from the Legacy API, converts them to domain types, and applies them to the store. Events are broadcast through the event channel (not stored).

Source

pub async fn execute(&self, cmd: Command) -> Result<CommandResult, CoreError>

Execute a command against the controller.

Sends the command through the internal channel to the command processor task and awaits the result.

Source

pub async fn oneshot<F, Fut, T>( config: ControllerConfig, f: F, ) -> Result<T, CoreError>
where F: FnOnce(Controller) -> Fut, Fut: Future<Output = Result<T, CoreError>>,

One-shot: connect, run closure, disconnect.

Optimized for CLI: disables WebSocket and periodic refresh since we only need a single request-response cycle.

Source

pub fn connection_state(&self) -> Receiver<ConnectionState>

Subscribe to connection state changes.

Source

pub fn events(&self) -> Receiver<Arc<Event>>

Subscribe to the event broadcast stream.

Source

pub fn devices_snapshot(&self) -> Arc<Vec<Arc<Device>>>

Source

pub fn clients_snapshot(&self) -> Arc<Vec<Arc<Client>>>

Source

pub fn networks_snapshot(&self) -> Arc<Vec<Arc<Network>>>

Source

pub fn wifi_broadcasts_snapshot(&self) -> Arc<Vec<Arc<WifiBroadcast>>>

Source

pub fn firewall_policies_snapshot(&self) -> Arc<Vec<Arc<FirewallPolicy>>>

Source

pub fn firewall_zones_snapshot(&self) -> Arc<Vec<Arc<FirewallZone>>>

Source

pub fn acl_rules_snapshot(&self) -> Arc<Vec<Arc<AclRule>>>

Source

pub fn dns_policies_snapshot(&self) -> Arc<Vec<Arc<DnsPolicy>>>

Source

pub fn vouchers_snapshot(&self) -> Arc<Vec<Arc<Voucher>>>

Source

pub fn sites_snapshot(&self) -> Arc<Vec<Arc<Site>>>

Source

pub fn events_snapshot(&self) -> Arc<Vec<Arc<Event>>>

Source

pub fn traffic_matching_lists_snapshot( &self, ) -> Arc<Vec<Arc<TrafficMatchingList>>>

Source

pub fn devices(&self) -> EntityStream<Device>

Source

pub fn clients(&self) -> EntityStream<Client>

Source

pub fn networks(&self) -> EntityStream<Network>

Source

pub fn wifi_broadcasts(&self) -> EntityStream<WifiBroadcast>

Source

pub fn firewall_policies(&self) -> EntityStream<FirewallPolicy>

Source

pub fn firewall_zones(&self) -> EntityStream<FirewallZone>

Source

pub fn acl_rules(&self) -> EntityStream<AclRule>

Source

pub fn dns_policies(&self) -> EntityStream<DnsPolicy>

Source

pub fn vouchers(&self) -> EntityStream<Voucher>

Source

pub fn sites(&self) -> EntityStream<Site>

Source

pub fn traffic_matching_lists(&self) -> EntityStream<TrafficMatchingList>

Source

pub fn site_health(&self) -> Receiver<Arc<Vec<HealthSummary>>>

Subscribe to site health updates (WAN IP, latency, bandwidth rates).

Source

pub async fn take_warnings(&self) -> Vec<String>

Drain warnings accumulated during connect (e.g. Legacy auth failure).

Source

pub async fn list_vpn_servers(&self) -> Result<Vec<VpnServer>, CoreError>

Fetch VPN servers from the Integration API.

Source

pub async fn list_vpn_tunnels(&self) -> Result<Vec<VpnTunnel>, CoreError>

Fetch VPN tunnels from the Integration API.

Source

pub async fn list_wans(&self) -> Result<Vec<WanInterface>, CoreError>

Fetch WAN interfaces from the Integration API.

Source

pub async fn list_dpi_categories(&self) -> Result<Vec<DpiCategory>, CoreError>

Fetch DPI categories from the Integration API.

Source

pub async fn list_dpi_applications( &self, ) -> Result<Vec<DpiApplication>, CoreError>

Fetch DPI applications from the Integration API.

Source

pub async fn list_radius_profiles( &self, ) -> Result<Vec<RadiusProfile>, CoreError>

Fetch RADIUS profiles from the Integration API.

Source

pub async fn list_countries(&self) -> Result<Vec<Country>, CoreError>

Fetch countries from the Integration API.

Source

pub async fn get_network_references( &self, network_id: &EntityId, ) -> Result<Value, CoreError>

Fetch references for a specific network (Integration API).

Source

pub async fn get_firewall_policy_ordering( &self, ) -> Result<FirewallPolicyOrdering, CoreError>

Fetch firewall policy ordering (Integration API).

Source

pub async fn list_pending_devices(&self) -> Result<Vec<Value>, CoreError>

List pending devices.

Prefers Integration API pending endpoint, falls back to filtering the canonical device snapshot by pending adoption state.

Source

pub async fn list_device_tags(&self) -> Result<Vec<Value>, CoreError>

List device tags.

Uses Integration API when available.

Source

pub async fn list_backups(&self) -> Result<Vec<Value>, CoreError>

List controller backups (legacy API).

Source

pub async fn download_backup( &self, filename: &str, ) -> Result<Vec<u8>, CoreError>

Download a controller backup file (legacy API).

Source

pub async fn get_site_stats( &self, interval: &str, start: Option<i64>, end: Option<i64>, attrs: Option<&[String]>, ) -> Result<Vec<Value>, CoreError>

Fetch site-level historical statistics.

Source

pub async fn get_device_stats( &self, interval: &str, macs: Option<&[String]>, attrs: Option<&[String]>, ) -> Result<Vec<Value>, CoreError>

Fetch per-device historical statistics.

Source

pub async fn get_client_stats( &self, interval: &str, macs: Option<&[String]>, attrs: Option<&[String]>, ) -> Result<Vec<Value>, CoreError>

Fetch per-client historical statistics.

Source

pub async fn get_gateway_stats( &self, interval: &str, start: Option<i64>, end: Option<i64>, attrs: Option<&[String]>, ) -> Result<Vec<Value>, CoreError>

Fetch gateway historical statistics.

Source

pub async fn get_dpi_stats( &self, group_by: &str, macs: Option<&[String]>, ) -> Result<Vec<Value>, CoreError>

Fetch DPI statistics.

Source

pub async fn list_admins(&self) -> Result<Vec<Admin>, CoreError>

Fetch admin list from the Legacy API.

Source

pub async fn list_alarms(&self) -> Result<Vec<Alarm>, CoreError>

Fetch alarms from the Legacy API.

Source

pub async fn get_system_info(&self) -> Result<SystemInfo, CoreError>

Fetch controller system info.

Prefers the Integration API (GET /v1/info) when available, falls back to Legacy stat/sysinfo.

Source

pub async fn get_site_health(&self) -> Result<Vec<HealthSummary>, CoreError>

Fetch site health dashboard from the Legacy API.

Source

pub async fn get_sysinfo(&self) -> Result<SysInfo, CoreError>

Fetch low-level sysinfo from the Legacy API.

Trait Implementations§

Source§

impl Clone for Controller

Source§

fn clone(&self) -> Controller

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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