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

impl Controller

Source§

impl Controller

Source

pub async fn get_firewall_policy_ordering( &self, source_zone_id: &EntityId, destination_zone_id: &EntityId, ) -> Result<FirewallPolicyOrdering, CoreError>

Source

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

Source§

impl Controller

Source§

impl Controller

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 controller APIs, converts them to domain types, and applies them to the store. Events are broadcast through the event channel after snapshot application.

Source§

impl Controller

Source

pub async fn list_site_to_site_vpns( &self, ) -> Result<Vec<SiteToSiteVpn>, CoreError>

Source

pub async fn get_site_to_site_vpn( &self, id: &str, ) -> Result<SiteToSiteVpn, CoreError>

Source

pub async fn list_remote_access_vpn_servers( &self, ) -> Result<Vec<RemoteAccessVpnServer>, CoreError>

Source

pub async fn get_remote_access_vpn_server( &self, id: &str, ) -> Result<RemoteAccessVpnServer, CoreError>

Source

pub async fn list_wireguard_peers( &self, server_id: Option<&str>, ) -> Result<Vec<WireGuardPeer>, CoreError>

Source

pub async fn get_wireguard_peer( &self, server_id: &str, id: &str, ) -> Result<WireGuardPeer, CoreError>

Source

pub async fn list_wireguard_peer_existing_subnets( &self, ) -> Result<Vec<String>, CoreError>

Source

pub async fn list_openvpn_port_suggestions(&self) -> Result<Vec<u16>, CoreError>

Source

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

Source

pub async fn list_vpn_client_profiles( &self, ) -> Result<Vec<VpnClientProfile>, CoreError>

Source

pub async fn get_vpn_client_profile( &self, id: &str, ) -> Result<VpnClientProfile, CoreError>

Source

pub async fn list_vpn_client_connections( &self, ) -> Result<Vec<VpnClientConnection>, CoreError>

Source

pub async fn get_vpn_client_connection( &self, id: &str, ) -> Result<VpnClientConnection, CoreError>

Source

pub async fn list_magic_site_to_site_vpn_configs( &self, ) -> Result<Vec<MagicSiteToSiteVpnConfig>, CoreError>

Source

pub async fn get_magic_site_to_site_vpn_config( &self, id: &str, ) -> Result<MagicSiteToSiteVpnConfig, CoreError>

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub async fn list_users(&self) -> Result<Vec<SessionUserEntry>, CoreError>

Source

pub async fn list_rogue_aps( &self, within_secs: Option<i64>, ) -> Result<Vec<RogueAp>, CoreError>

Source

pub async fn list_channels(&self) -> Result<Vec<ChannelAvailability>, CoreError>

Source

pub async fn get_client_roams( &self, mac: &str, limit: Option<u32>, ) -> Result<Vec<Value>, CoreError>

Source

pub async fn get_client_wifi_experience( &self, client_ip: &str, ) -> Result<Value, CoreError>

Source

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

Source

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

Source

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

Source

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

Source

pub async fn list_ipsec_sa(&self) -> Result<Vec<IpsecSa>, CoreError>

Source

pub fn get_vpn_health(&self) -> Option<HealthSummary>

Source

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

Source

pub async fn list_vpn_settings(&self) -> Result<Vec<VpnSetting>, CoreError>

Source

pub async fn get_vpn_setting(&self, key: &str) -> Result<VpnSetting, CoreError>

Source

pub async fn update_vpn_setting( &self, key: &str, body: &Value, ) -> Result<VpnSetting, CoreError>

Source

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

Source

pub async fn get_site_setting(&self, key: &str) -> Result<Value, CoreError>

Source

pub async fn update_site_setting( &self, key: &str, body: &Value, ) -> Result<(), CoreError>

Source

pub async fn raw_get(&self, path: &str) -> Result<Value, CoreError>

Send a raw GET request to an arbitrary path on the controller.

The path is appended to the controller base URL + platform prefix (e.g. /proxy/network/). The response is returned as raw JSON without session envelope unwrapping.

Source

pub async fn raw_post( &self, path: &str, body: &Value, ) -> Result<Value, CoreError>

Send a raw POST request to an arbitrary path on the controller.

Source

pub async fn raw_put( &self, path: &str, body: &Value, ) -> Result<Value, CoreError>

Send a raw PUT request to an arbitrary path on the controller.

Source

pub async fn raw_patch( &self, path: &str, body: &Value, ) -> Result<Value, CoreError>

Send a raw PATCH request to an arbitrary path on the controller.

Source

pub async fn raw_delete(&self, path: &str) -> Result<(), CoreError>

Send a raw DELETE request to an arbitrary path on the controller.

Source§

impl Controller

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 nat_policies_snapshot(&self) -> Arc<Vec<Arc<NatPolicy>>>

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 nat_policies(&self) -> EntityStream<NatPolicy>

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. Session auth failure).

Source

pub async fn has_session_access(&self) -> bool

Whether any Session API client is available.

Source

pub async fn has_live_event_access(&self) -> bool

Whether live event streaming is available via a cookie-backed session.

Source

pub async fn has_integration_access(&self) -> bool

Whether the Integration API is available for integration-backed features.

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

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