#[non_exhaustive]pub struct CreateNotificationRuleParameters {
pub data: Option<CreateNotificationRuleParametersData>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Body of the notification rule create request.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.data: Option<CreateNotificationRuleParametersData>
Data of the notification rule create request: the rule type, and the rule attributes. All fields are required.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl CreateNotificationRuleParameters
impl CreateNotificationRuleParameters
Sourcepub fn new() -> CreateNotificationRuleParameters
pub fn new() -> CreateNotificationRuleParameters
Examples found in repository?
examples/v2_security-monitoring_CreateSignalNotificationRule.rs (line 17)
15async fn main() {
16 let body =
17 CreateNotificationRuleParameters::new().data(CreateNotificationRuleParametersData::new(
18 CreateNotificationRuleParametersDataAttributes::new(
19 "Rule 1".to_string(),
20 Selectors::new(TriggerSource::SECURITY_FINDINGS)
21 .query("(source:production_service OR env:prod)".to_string())
22 .rule_types(vec![
23 RuleTypesItems::MISCONFIGURATION,
24 RuleTypesItems::ATTACK_PATH,
25 ])
26 .severities(vec![RuleSeverity::CRITICAL]),
27 vec!["@john.doe@email.com".to_string()],
28 )
29 .enabled(true)
30 .time_aggregation(86400),
31 NotificationRulesType::NOTIFICATION_RULES,
32 ));
33 let configuration = datadog::Configuration::new();
34 let api = SecurityMonitoringAPI::with_config(configuration);
35 let resp = api.create_signal_notification_rule(body).await;
36 if let Ok(value) = resp {
37 println!("{:#?}", value);
38 } else {
39 println!("{:#?}", resp.unwrap_err());
40 }
41}
More examples
examples/v2_security-monitoring_CreateVulnerabilityNotificationRule.rs (line 17)
15async fn main() {
16 let body =
17 CreateNotificationRuleParameters::new().data(CreateNotificationRuleParametersData::new(
18 CreateNotificationRuleParametersDataAttributes::new(
19 "Rule 1".to_string(),
20 Selectors::new(TriggerSource::SECURITY_FINDINGS)
21 .query("(source:production_service OR env:prod)".to_string())
22 .rule_types(vec![
23 RuleTypesItems::MISCONFIGURATION,
24 RuleTypesItems::ATTACK_PATH,
25 ])
26 .severities(vec![RuleSeverity::CRITICAL]),
27 vec!["@john.doe@email.com".to_string()],
28 )
29 .enabled(true)
30 .time_aggregation(86400),
31 NotificationRulesType::NOTIFICATION_RULES,
32 ));
33 let configuration = datadog::Configuration::new();
34 let api = SecurityMonitoringAPI::with_config(configuration);
35 let resp = api.create_vulnerability_notification_rule(body).await;
36 if let Ok(value) = resp {
37 println!("{:#?}", value);
38 } else {
39 println!("{:#?}", resp.unwrap_err());
40 }
41}
Sourcepub fn data(self, value: CreateNotificationRuleParametersData) -> Self
pub fn data(self, value: CreateNotificationRuleParametersData) -> Self
Examples found in repository?
examples/v2_security-monitoring_CreateSignalNotificationRule.rs (lines 17-32)
15async fn main() {
16 let body =
17 CreateNotificationRuleParameters::new().data(CreateNotificationRuleParametersData::new(
18 CreateNotificationRuleParametersDataAttributes::new(
19 "Rule 1".to_string(),
20 Selectors::new(TriggerSource::SECURITY_FINDINGS)
21 .query("(source:production_service OR env:prod)".to_string())
22 .rule_types(vec![
23 RuleTypesItems::MISCONFIGURATION,
24 RuleTypesItems::ATTACK_PATH,
25 ])
26 .severities(vec![RuleSeverity::CRITICAL]),
27 vec!["@john.doe@email.com".to_string()],
28 )
29 .enabled(true)
30 .time_aggregation(86400),
31 NotificationRulesType::NOTIFICATION_RULES,
32 ));
33 let configuration = datadog::Configuration::new();
34 let api = SecurityMonitoringAPI::with_config(configuration);
35 let resp = api.create_signal_notification_rule(body).await;
36 if let Ok(value) = resp {
37 println!("{:#?}", value);
38 } else {
39 println!("{:#?}", resp.unwrap_err());
40 }
41}
More examples
examples/v2_security-monitoring_CreateVulnerabilityNotificationRule.rs (lines 17-32)
15async fn main() {
16 let body =
17 CreateNotificationRuleParameters::new().data(CreateNotificationRuleParametersData::new(
18 CreateNotificationRuleParametersDataAttributes::new(
19 "Rule 1".to_string(),
20 Selectors::new(TriggerSource::SECURITY_FINDINGS)
21 .query("(source:production_service OR env:prod)".to_string())
22 .rule_types(vec![
23 RuleTypesItems::MISCONFIGURATION,
24 RuleTypesItems::ATTACK_PATH,
25 ])
26 .severities(vec![RuleSeverity::CRITICAL]),
27 vec!["@john.doe@email.com".to_string()],
28 )
29 .enabled(true)
30 .time_aggregation(86400),
31 NotificationRulesType::NOTIFICATION_RULES,
32 ));
33 let configuration = datadog::Configuration::new();
34 let api = SecurityMonitoringAPI::with_config(configuration);
35 let resp = api.create_vulnerability_notification_rule(body).await;
36 if let Ok(value) = resp {
37 println!("{:#?}", value);
38 } else {
39 println!("{:#?}", resp.unwrap_err());
40 }
41}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for CreateNotificationRuleParameters
impl Clone for CreateNotificationRuleParameters
Source§fn clone(&self) -> CreateNotificationRuleParameters
fn clone(&self) -> CreateNotificationRuleParameters
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'de> Deserialize<'de> for CreateNotificationRuleParameters
impl<'de> Deserialize<'de> for CreateNotificationRuleParameters
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
Source§impl PartialEq for CreateNotificationRuleParameters
impl PartialEq for CreateNotificationRuleParameters
Source§fn eq(&self, other: &CreateNotificationRuleParameters) -> bool
fn eq(&self, other: &CreateNotificationRuleParameters) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl StructuralPartialEq for CreateNotificationRuleParameters
Auto Trait Implementations§
impl Freeze for CreateNotificationRuleParameters
impl RefUnwindSafe for CreateNotificationRuleParameters
impl Send for CreateNotificationRuleParameters
impl Sync for CreateNotificationRuleParameters
impl Unpin for CreateNotificationRuleParameters
impl UnwindSafe for CreateNotificationRuleParameters
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