#[non_exhaustive]pub struct CreateNotificationRuleParametersData {
pub attributes: CreateNotificationRuleParametersDataAttributes,
pub type_: NotificationRulesType,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Data of the notification rule create request: the rule type, and the rule attributes. All fields are required.
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.attributes: CreateNotificationRuleParametersDataAttributes
Attributes of the notification rule create request.
type_: NotificationRulesType
The rule type associated to notification rules.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl CreateNotificationRuleParametersData
impl CreateNotificationRuleParametersData
Sourcepub fn new(
attributes: CreateNotificationRuleParametersDataAttributes,
type_: NotificationRulesType,
) -> CreateNotificationRuleParametersData
pub fn new( attributes: CreateNotificationRuleParametersDataAttributes, type_: NotificationRulesType, ) -> CreateNotificationRuleParametersData
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 CreateNotificationRuleParametersData
impl Clone for CreateNotificationRuleParametersData
Source§fn clone(&self) -> CreateNotificationRuleParametersData
fn clone(&self) -> CreateNotificationRuleParametersData
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 CreateNotificationRuleParametersData
impl<'de> Deserialize<'de> for CreateNotificationRuleParametersData
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 CreateNotificationRuleParametersData
impl PartialEq for CreateNotificationRuleParametersData
Source§fn eq(&self, other: &CreateNotificationRuleParametersData) -> bool
fn eq(&self, other: &CreateNotificationRuleParametersData) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl StructuralPartialEq for CreateNotificationRuleParametersData
Auto Trait Implementations§
impl Freeze for CreateNotificationRuleParametersData
impl RefUnwindSafe for CreateNotificationRuleParametersData
impl Send for CreateNotificationRuleParametersData
impl Sync for CreateNotificationRuleParametersData
impl Unpin for CreateNotificationRuleParametersData
impl UnwindSafe for CreateNotificationRuleParametersData
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