pub struct Trigger {
pub name: String,
pub trigger_type: TriggerType,
pub config: TriggerTypeConfig,
}
Expand description
Configuration for actions to take when monitored conditions are met.
Fields§
§name: String
Unique name identifying this trigger
trigger_type: TriggerType
Type of trigger (Email, Slack, Webhook, Telegram, Discord, Script)
config: TriggerTypeConfig
Configuration specific to the trigger type
Trait Implementations§
Source§impl ConfigLoader for Trigger
impl ConfigLoader for Trigger
Source§fn load_all<'life0, 'async_trait, T>(
path: Option<&'life0 Path>,
) -> Pin<Box<dyn Future<Output = Result<T, ConfigError>> + Send + 'async_trait>>where
T: FromIterator<(String, Self)> + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn load_all<'life0, 'async_trait, T>(
path: Option<&'life0 Path>,
) -> Pin<Box<dyn Future<Output = Result<T, ConfigError>> + Send + 'async_trait>>where
T: FromIterator<(String, Self)> + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Load all trigger configurations from a directory
Reads and parses all JSON files in the specified directory (or default config directory) as trigger configurations.
Source§fn load_from_path<'life0, 'async_trait>(
path: &'life0 Path,
) -> Pin<Box<dyn Future<Output = Result<Self, ConfigError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_from_path<'life0, 'async_trait>(
path: &'life0 Path,
) -> Pin<Box<dyn Future<Output = Result<Self, ConfigError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load a trigger configuration from a specific file
Reads and parses a single JSON file as a trigger configuration.
Source§fn validate(&self) -> Result<(), ConfigError>
fn validate(&self) -> Result<(), ConfigError>
Validate the trigger configuration
Ensures that:
- The trigger has a valid name
- The trigger type is supported
- Required configuration fields for the trigger type are present
- URLs are valid for webhook and Slack triggers
- Script paths exist for script triggers
Source§fn validate_protocol(&self)
fn validate_protocol(&self)
Validate the safety of the protocols used in the trigger
Returns if safe, or logs a warning message if unsafe.
Source§fn resolve_secrets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self, ConfigError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn resolve_secrets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self, ConfigError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resolve all secrets in the configuration
Source§fn is_json_file(path: &Path) -> bool
fn is_json_file(path: &Path) -> bool
Check if a file is a JSON file based on extension
Source§impl<'de> Deserialize<'de> for Trigger
impl<'de> Deserialize<'de> for Trigger
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Trigger
Auto Trait Implementations§
impl Freeze for Trigger
impl RefUnwindSafe for Trigger
impl Send for Trigger
impl Sync for Trigger
impl Unpin for Trigger
impl UnwindSafe for Trigger
Blanket Implementations§
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<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more