pub struct AuditRegistry { /* private fields */ }Expand description
Registry for managing audit targets
Implementations§
Source§impl AuditRegistry
impl AuditRegistry
pub fn supports_target_type(&self, target_type: &str) -> bool
Sourcepub async fn create_target(
&self,
target_type: &str,
id: String,
config: &KVS,
) -> Result<Box<dyn Target<AuditEntry> + Send + Sync>, TargetError>
pub async fn create_target( &self, target_type: &str, id: String, config: &KVS, ) -> Result<Box<dyn Target<AuditEntry> + Send + Sync>, TargetError>
Creates a target of the specified type with the given ID and configuration
§Arguments
target_type- The type of the target (e.g., “webhook”, “mqtt”).id- The identifier for the target instance.config- The configuration key-value store for the target.
§Returns
Result<Box<dyn Target<AuditEntry> + Send + Sync>, TargetError>- The created target or an error.
Sourcepub async fn create_audit_targets_from_config(
&self,
config: &Config,
) -> AuditResult<Vec<Box<dyn Target<AuditEntry> + Send + Sync>>>
pub async fn create_audit_targets_from_config( &self, config: &Config, ) -> AuditResult<Vec<Box<dyn Target<AuditEntry> + Send + Sync>>>
Creates all targets from a configuration Create all notification targets from system configuration and environment variables. This method processes the creation of each target concurrently as follows:
- Iterate through all registered target types (e.g. webhooks, mqtt).
- For each type, resolve its configuration in the configuration file and environment variables.
- Identify all target instance IDs that need to be created.
- Combine the default configuration, file configuration, and environment variable configuration for each instance.
- If the instance is enabled, create an asynchronous task for it to instantiate.
- Concurrency executes all creation tasks and collects results.
Sourcepub fn add_target(
&mut self,
_id: String,
target: Box<dyn Target<AuditEntry> + Send + Sync>,
)
pub fn add_target( &mut self, _id: String, target: Box<dyn Target<AuditEntry> + Send + Sync>, )
Adds a target to the registry
§Arguments
id- The identifier for the target.target- The target instance to be added.
Sourcepub async fn remove_target(
&mut self,
id: &str,
) -> Option<SharedTarget<AuditEntry>>
pub async fn remove_target( &mut self, id: &str, ) -> Option<SharedTarget<AuditEntry>>
Sourcepub fn get_target(&self, id: &str) -> Option<SharedTarget<AuditEntry>>
pub fn get_target(&self, id: &str) -> Option<SharedTarget<AuditEntry>>
Sourcepub fn list_target_values(&self) -> Vec<SharedTarget<AuditEntry>> ⓘ
pub fn list_target_values(&self) -> Vec<SharedTarget<AuditEntry>> ⓘ
Lists cloned target values for runtime inspection without exposing mutable registry access.
pub fn runtime_manager(&self) -> &TargetRuntimeManager<AuditEntry>
pub fn runtime_manager_mut(&mut self) -> &mut TargetRuntimeManager<AuditEntry>
Sourcepub fn list_targets(&self) -> Vec<String>
pub fn list_targets(&self) -> Vec<String>
Sourcepub async fn close_all(&mut self) -> AuditResult<()>
pub async fn close_all(&mut self) -> AuditResult<()>
Closes all targets and clears the registry
§Returns
AuditResult<()>- Result indicating success or failure.
Sourcepub fn create_key(&self, target_type: &str, target_id: &str) -> String
pub fn create_key(&self, target_type: &str, target_id: &str) -> String
Sourcepub fn enable_target(
&self,
target_type: &str,
target_id: &str,
) -> AuditResult<()>
pub fn enable_target( &self, target_type: &str, target_id: &str, ) -> AuditResult<()>
Sourcepub fn disable_target(
&self,
target_type: &str,
target_id: &str,
) -> AuditResult<()>
pub fn disable_target( &self, target_type: &str, target_id: &str, ) -> AuditResult<()>
Sourcepub fn upsert_target(
&mut self,
target_type: &str,
target_id: &str,
target: Box<dyn Target<AuditEntry> + Send + Sync>,
) -> AuditResult<()>
pub fn upsert_target( &mut self, target_type: &str, target_id: &str, target: Box<dyn Target<AuditEntry> + Send + Sync>, ) -> AuditResult<()>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AuditRegistry
impl !UnwindSafe for AuditRegistry
impl Freeze for AuditRegistry
impl Send for AuditRegistry
impl Sync for AuditRegistry
impl Unpin for AuditRegistry
impl UnsafeUnpin for AuditRegistry
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request