control
Module: control
Section titled “Module: control”Contents
Section titled “Contents”Structs
ControlOptions- Startup options for the Policy Control TUI.
Functions
read_policy_state- Reads one policy state from a Cedar source file.read_policy_states- Reads several policy states from one Cedar source file.run- Runs the Policy Control event loop.set_policy_state- Sets one policy in a Cedar source file to the requested state.set_policy_states- Sets multiple policies in one Cedar source file to the requested state.
firma_tui::control::ControlOptions
Section titled “firma_tui::control::ControlOptions”Struct
Startup options for the Policy Control TUI.
The CLI service resolves real stack paths before constructing this value. The TUI then consumes audit rows from the supplied receiver and displays the resolved policy directory as its policy source.
Methods:
fn with_audit_rows(audit_rows: Receiver<AuditRow>) -> Self- Creates options backed by an existing audit-row stream.fn with_policy_dir(self: Self, policy_dir: PathBuf) -> Self- Sets the Authority policy directory shown and loaded by the TUI.
Trait Implementations:
- Default
fn default() -> ControlOptions
firma_tui::control::read_policy_state
Section titled “firma_tui::control::read_policy_state”Function
Reads one policy state from a Cedar source file.
fn read_policy_state(path: &std::path::Path, policy_id: &str) -> PolicyStatefirma_tui::control::read_policy_states
Section titled “firma_tui::control::read_policy_states”Function
Reads several policy states from one Cedar source file.
fn read_policy_states(path: &std::path::Path, policy_ids: &[String]) -> std::collections::HashMap<String, PolicyState>firma_tui::control::run
Section titled “firma_tui::control::run”Function
Runs the Policy Control event loop.
Terminal setup, input polling, and drawing errors are returned to the caller. Terminal cleanup is still attempted when setup partially succeeds.
Errors
Section titled “Errors”Returns an error when terminal setup, event polling, drawing, or terminal suspension around a blocking editor fails.
fn run(options: &ControlOptions) -> anyhow::Result<std::process::ExitCode>firma_tui::control::set_policy_state
Section titled “firma_tui::control::set_policy_state”Function
Sets one policy in a Cedar source file to the requested state.
Errors
Section titled “Errors”Fails when the Cedar file cannot be read, the policy id is missing or malformed, the rewritten candidate does not parse, or the candidate cannot be atomically persisted.
fn set_policy_state(path: &std::path::Path, policy_id: &str, requested: PolicyState) -> Result<(), PolicyRewriteError>firma_tui::control::set_policy_states
Section titled “firma_tui::control::set_policy_states”Function
Sets multiple policies in one Cedar source file to the requested state.
Errors
Section titled “Errors”Fails when the Cedar file cannot be read, any policy id is missing or malformed, the rewritten candidate does not parse, or the candidate cannot be atomically persisted.
fn set_policy_states(path: &std::path::Path, policy_ids: &[String], requested: PolicyState) -> Result<(), PolicyRewriteError>