Skip to content

control

Structs

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.

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

Function

Reads one policy state from a Cedar source file.

fn read_policy_state(path: &std::path::Path, policy_id: &str) -> PolicyState

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>

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.

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>

Function

Sets one policy in a Cedar source file to the requested state.

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>

Function

Sets multiple policies in one Cedar source file to the requested state.

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>