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
impl Controller
Sourcepub fn new(config: ControllerConfig) -> Self
pub fn new(config: ControllerConfig) -> Self
Create a new Controller from configuration. Does NOT connect –
call connect() to authenticate and start background tasks.
Sourcepub fn config(&self) -> &ControllerConfig
pub fn config(&self) -> &ControllerConfig
Access the controller configuration.
Sourcepub async fn connect(&self) -> Result<(), CoreError>
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).
Sourcepub async fn disconnect(&self)
pub async fn disconnect(&self)
Disconnect from the controller.
Cancels background tasks, logs out if session-based, and resets
the connection state to Disconnected.
Sourcepub async fn full_refresh(&self) -> Result<(), CoreError>
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).
Sourcepub async fn execute(&self, cmd: Command) -> Result<CommandResult, CoreError>
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.
Sourcepub async fn oneshot<F, Fut, T>(
config: ControllerConfig,
f: F,
) -> Result<T, CoreError>
pub async fn oneshot<F, Fut, T>( config: ControllerConfig, f: F, ) -> 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.
Sourcepub fn connection_state(&self) -> Receiver<ConnectionState>
pub fn connection_state(&self) -> Receiver<ConnectionState>
Subscribe to connection state changes.
pub fn devices_snapshot(&self) -> Arc<Vec<Arc<Device>>>
pub fn clients_snapshot(&self) -> Arc<Vec<Arc<Client>>>
pub fn networks_snapshot(&self) -> Arc<Vec<Arc<Network>>>
pub fn wifi_broadcasts_snapshot(&self) -> Arc<Vec<Arc<WifiBroadcast>>>
pub fn firewall_policies_snapshot(&self) -> Arc<Vec<Arc<FirewallPolicy>>>
pub fn firewall_zones_snapshot(&self) -> Arc<Vec<Arc<FirewallZone>>>
pub fn acl_rules_snapshot(&self) -> Arc<Vec<Arc<AclRule>>>
pub fn dns_policies_snapshot(&self) -> Arc<Vec<Arc<DnsPolicy>>>
pub fn vouchers_snapshot(&self) -> Arc<Vec<Arc<Voucher>>>
pub fn sites_snapshot(&self) -> Arc<Vec<Arc<Site>>>
pub fn events_snapshot(&self) -> Arc<Vec<Arc<Event>>>
pub fn traffic_matching_lists_snapshot( &self, ) -> Arc<Vec<Arc<TrafficMatchingList>>>
pub fn devices(&self) -> EntityStream<Device>
pub fn clients(&self) -> EntityStream<Client>
pub fn networks(&self) -> EntityStream<Network>
pub fn wifi_broadcasts(&self) -> EntityStream<WifiBroadcast>
pub fn firewall_policies(&self) -> EntityStream<FirewallPolicy>
pub fn firewall_zones(&self) -> EntityStream<FirewallZone>
pub fn acl_rules(&self) -> EntityStream<AclRule>
pub fn dns_policies(&self) -> EntityStream<DnsPolicy>
pub fn vouchers(&self) -> EntityStream<Voucher>
pub fn sites(&self) -> EntityStream<Site>
pub fn traffic_matching_lists(&self) -> EntityStream<TrafficMatchingList>
Sourcepub fn site_health(&self) -> Receiver<Arc<Vec<HealthSummary>>>
pub fn site_health(&self) -> Receiver<Arc<Vec<HealthSummary>>>
Subscribe to site health updates (WAN IP, latency, bandwidth rates).
Sourcepub async fn take_warnings(&self) -> Vec<String>
pub async fn take_warnings(&self) -> Vec<String>
Drain warnings accumulated during connect (e.g. Legacy auth failure).
Sourcepub async fn list_vpn_servers(&self) -> Result<Vec<VpnServer>, CoreError>
pub async fn list_vpn_servers(&self) -> Result<Vec<VpnServer>, CoreError>
Fetch VPN servers from the Integration API.
Sourcepub async fn list_vpn_tunnels(&self) -> Result<Vec<VpnTunnel>, CoreError>
pub async fn list_vpn_tunnels(&self) -> Result<Vec<VpnTunnel>, CoreError>
Fetch VPN tunnels from the Integration API.
Sourcepub async fn list_wans(&self) -> Result<Vec<WanInterface>, CoreError>
pub async fn list_wans(&self) -> Result<Vec<WanInterface>, CoreError>
Fetch WAN interfaces from the Integration API.
Sourcepub async fn list_dpi_categories(&self) -> Result<Vec<DpiCategory>, CoreError>
pub async fn list_dpi_categories(&self) -> Result<Vec<DpiCategory>, CoreError>
Fetch DPI categories from the Integration API.
Sourcepub async fn list_dpi_applications(
&self,
) -> Result<Vec<DpiApplication>, CoreError>
pub async fn list_dpi_applications( &self, ) -> Result<Vec<DpiApplication>, CoreError>
Fetch DPI applications from the Integration API.
Sourcepub async fn list_radius_profiles(
&self,
) -> Result<Vec<RadiusProfile>, CoreError>
pub async fn list_radius_profiles( &self, ) -> Result<Vec<RadiusProfile>, CoreError>
Fetch RADIUS profiles from the Integration API.
Sourcepub async fn list_countries(&self) -> Result<Vec<Country>, CoreError>
pub async fn list_countries(&self) -> Result<Vec<Country>, CoreError>
Fetch countries from the Integration API.
Sourcepub async fn get_network_references(
&self,
network_id: &EntityId,
) -> Result<Value, CoreError>
pub async fn get_network_references( &self, network_id: &EntityId, ) -> Result<Value, CoreError>
Fetch references for a specific network (Integration API).
Sourcepub async fn get_firewall_policy_ordering(
&self,
) -> Result<FirewallPolicyOrdering, CoreError>
pub async fn get_firewall_policy_ordering( &self, ) -> Result<FirewallPolicyOrdering, CoreError>
Fetch firewall policy ordering (Integration API).
Sourcepub async fn list_pending_devices(&self) -> Result<Vec<Value>, CoreError>
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.
List device tags.
Uses Integration API when available.
Sourcepub async fn list_backups(&self) -> Result<Vec<Value>, CoreError>
pub async fn list_backups(&self) -> Result<Vec<Value>, CoreError>
List controller backups (legacy API).
Sourcepub async fn download_backup(
&self,
filename: &str,
) -> Result<Vec<u8>, CoreError>
pub async fn download_backup( &self, filename: &str, ) -> Result<Vec<u8>, CoreError>
Download a controller backup file (legacy API).
Sourcepub async fn get_site_stats(
&self,
interval: &str,
start: Option<i64>,
end: Option<i64>,
attrs: Option<&[String]>,
) -> Result<Vec<Value>, CoreError>
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.
Sourcepub async fn get_device_stats(
&self,
interval: &str,
macs: Option<&[String]>,
attrs: Option<&[String]>,
) -> Result<Vec<Value>, CoreError>
pub async fn get_device_stats( &self, interval: &str, macs: Option<&[String]>, attrs: Option<&[String]>, ) -> Result<Vec<Value>, CoreError>
Fetch per-device historical statistics.
Sourcepub async fn get_client_stats(
&self,
interval: &str,
macs: Option<&[String]>,
attrs: Option<&[String]>,
) -> Result<Vec<Value>, CoreError>
pub async fn get_client_stats( &self, interval: &str, macs: Option<&[String]>, attrs: Option<&[String]>, ) -> Result<Vec<Value>, CoreError>
Fetch per-client historical statistics.
Sourcepub async fn get_gateway_stats(
&self,
interval: &str,
start: Option<i64>,
end: Option<i64>,
attrs: Option<&[String]>,
) -> Result<Vec<Value>, CoreError>
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.
Sourcepub async fn get_dpi_stats(
&self,
group_by: &str,
macs: Option<&[String]>,
) -> Result<Vec<Value>, CoreError>
pub async fn get_dpi_stats( &self, group_by: &str, macs: Option<&[String]>, ) -> Result<Vec<Value>, CoreError>
Fetch DPI statistics.
Sourcepub async fn list_admins(&self) -> Result<Vec<Admin>, CoreError>
pub async fn list_admins(&self) -> Result<Vec<Admin>, CoreError>
Fetch admin list from the Legacy API.
Sourcepub async fn list_alarms(&self) -> Result<Vec<Alarm>, CoreError>
pub async fn list_alarms(&self) -> Result<Vec<Alarm>, CoreError>
Fetch alarms from the Legacy API.
Sourcepub async fn get_system_info(&self) -> Result<SystemInfo, CoreError>
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.
Sourcepub async fn get_site_health(&self) -> Result<Vec<HealthSummary>, CoreError>
pub async fn get_site_health(&self) -> Result<Vec<HealthSummary>, CoreError>
Fetch site health dashboard from the Legacy API.
Sourcepub async fn get_sysinfo(&self) -> Result<SysInfo, CoreError>
pub async fn get_sysinfo(&self) -> Result<SysInfo, CoreError>
Fetch low-level sysinfo from the Legacy API.
Trait Implementations§
Source§impl Clone for Controller
impl Clone for Controller
Source§fn clone(&self) -> Controller
fn clone(&self) -> Controller
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more