#[non_exhaustive]pub struct IncidentNotificationRuleCreateAttributes {
pub conditions: Vec<IncidentNotificationRuleConditionsItems>,
pub enabled: Option<bool>,
pub handles: Vec<String>,
pub renotify_on: Option<Vec<String>>,
pub trigger: String,
pub visibility: Option<IncidentNotificationRuleCreateAttributesVisibility>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
The attributes for creating a notification rule.
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.conditions: Vec<IncidentNotificationRuleConditionsItems>
The conditions that trigger this notification rule.
enabled: Option<bool>
Whether the notification rule is enabled.
handles: Vec<String>
The notification handles (targets) for this rule.
renotify_on: Option<Vec<String>>
List of incident fields that trigger re-notification when changed.
trigger: String
The trigger event for this notification rule.
visibility: Option<IncidentNotificationRuleCreateAttributesVisibility>
The visibility of the notification rule.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl IncidentNotificationRuleCreateAttributes
impl IncidentNotificationRuleCreateAttributes
Sourcepub fn new(
conditions: Vec<IncidentNotificationRuleConditionsItems>,
handles: Vec<String>,
trigger: String,
) -> IncidentNotificationRuleCreateAttributes
pub fn new( conditions: Vec<IncidentNotificationRuleConditionsItems>, handles: Vec<String>, trigger: String, ) -> IncidentNotificationRuleCreateAttributes
Examples found in repository?
examples/v2_incidents_CreateIncidentNotificationRule_3029800608.rs (lines 21-28)
16async fn main() {
17 // there is a valid "incident_type" in the system
18 let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
19 let body = CreateIncidentNotificationRuleRequest::new(
20 IncidentNotificationRuleCreateData::new(
21 IncidentNotificationRuleCreateAttributes::new(
22 vec![IncidentNotificationRuleConditionsItems::new(
23 "severity".to_string(),
24 vec!["SEV-1".to_string(), "SEV-2".to_string()],
25 )],
26 vec!["@test-email@company.com".to_string()],
27 "incident_created_trigger".to_string(),
28 )
29 .enabled(true)
30 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
31 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
32 )
33 .relationships(
34 IncidentNotificationRuleCreateDataRelationships::new().incident_type(
35 RelationshipToIncidentType::new(RelationshipToIncidentTypeData::new(
36 incident_type_data_id.clone(),
37 IncidentTypeType::INCIDENT_TYPES,
38 )),
39 ),
40 ),
41 );
42 let mut configuration = datadog::Configuration::new();
43 configuration.set_unstable_operation_enabled("v2.CreateIncidentNotificationRule", true);
44 let api = IncidentsAPI::with_config(configuration);
45 let resp = api.create_incident_notification_rule(body).await;
46 if let Ok(value) = resp {
47 println!("{:#?}", value);
48 } else {
49 println!("{:#?}", resp.unwrap_err());
50 }
51}
More examples
examples/v2_incidents_UpdateIncidentNotificationRule_1207309457.rs (lines 27-34)
17async fn main() {
18 // there is a valid "notification_rule" in the system
19 let notification_rule_data_id =
20 uuid::Uuid::parse_str(&std::env::var("NOTIFICATION_RULE_DATA_ID").unwrap())
21 .expect("Invalid UUID");
22
23 // there is a valid "incident_type" in the system
24 let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
25 let body = PutIncidentNotificationRuleRequest::new(
26 IncidentNotificationRuleUpdateData::new(
27 IncidentNotificationRuleCreateAttributes::new(
28 vec![IncidentNotificationRuleConditionsItems::new(
29 "severity".to_string(),
30 vec!["SEV-1".to_string()],
31 )],
32 vec!["@updated-team-email@company.com".to_string()],
33 "incident_modified_trigger".to_string(),
34 )
35 .enabled(false)
36 .visibility(IncidentNotificationRuleCreateAttributesVisibility::PRIVATE),
37 notification_rule_data_id.clone(),
38 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
39 )
40 .relationships(
41 IncidentNotificationRuleCreateDataRelationships::new().incident_type(
42 RelationshipToIncidentType::new(RelationshipToIncidentTypeData::new(
43 incident_type_data_id.clone(),
44 IncidentTypeType::INCIDENT_TYPES,
45 )),
46 ),
47 ),
48 );
49 let mut configuration = datadog::Configuration::new();
50 configuration.set_unstable_operation_enabled("v2.UpdateIncidentNotificationRule", true);
51 let api = IncidentsAPI::with_config(configuration);
52 let resp = api
53 .update_incident_notification_rule(
54 notification_rule_data_id.clone(),
55 body,
56 UpdateIncidentNotificationRuleOptionalParams::default(),
57 )
58 .await;
59 if let Ok(value) = resp {
60 println!("{:#?}", value);
61 } else {
62 println!("{:#?}", resp.unwrap_err());
63 }
64}
examples/v2_incidents_CreateIncidentNotificationRule.rs (lines 23-33)
20async fn main() {
21 let body = CreateIncidentNotificationRuleRequest::new(
22 IncidentNotificationRuleCreateData::new(
23 IncidentNotificationRuleCreateAttributes::new(
24 vec![IncidentNotificationRuleConditionsItems::new(
25 "severity".to_string(),
26 vec!["SEV-1".to_string(), "SEV-2".to_string()],
27 )],
28 vec![
29 "@team-email@company.com".to_string(),
30 "@slack-channel".to_string(),
31 ],
32 "incident_created_trigger".to_string(),
33 )
34 .enabled(true)
35 .renotify_on(vec!["status".to_string(), "severity".to_string()])
36 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
37 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
38 )
39 .relationships(
40 IncidentNotificationRuleCreateDataRelationships::new()
41 .incident_type(RelationshipToIncidentType::new(
42 RelationshipToIncidentTypeData::new(
43 "00000000-0000-0000-0000-000000000000".to_string(),
44 IncidentTypeType::INCIDENT_TYPES,
45 ),
46 ))
47 .notification_template(RelationshipToIncidentNotificationTemplate::new(
48 RelationshipToIncidentNotificationTemplateData::new(
49 Uuid::parse_str("00000000-0000-0000-0000-000000000001")
50 .expect("invalid UUID"),
51 IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
52 ),
53 )),
54 ),
55 );
56 let mut configuration = datadog::Configuration::new();
57 configuration.set_unstable_operation_enabled("v2.CreateIncidentNotificationRule", true);
58 let api = IncidentsAPI::with_config(configuration);
59 let resp = api.create_incident_notification_rule(body).await;
60 if let Ok(value) = resp {
61 println!("{:#?}", value);
62 } else {
63 println!("{:#?}", resp.unwrap_err());
64 }
65}
examples/v2_incidents_UpdateIncidentNotificationRule.rs (lines 24-34)
21async fn main() {
22 let body = PutIncidentNotificationRuleRequest::new(
23 IncidentNotificationRuleUpdateData::new(
24 IncidentNotificationRuleCreateAttributes::new(
25 vec![IncidentNotificationRuleConditionsItems::new(
26 "severity".to_string(),
27 vec!["SEV-1".to_string(), "SEV-2".to_string()],
28 )],
29 vec![
30 "@team-email@company.com".to_string(),
31 "@slack-channel".to_string(),
32 ],
33 "incident_created_trigger".to_string(),
34 )
35 .enabled(true)
36 .renotify_on(vec!["status".to_string(), "severity".to_string()])
37 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
38 Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
39 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
40 )
41 .relationships(
42 IncidentNotificationRuleCreateDataRelationships::new()
43 .incident_type(RelationshipToIncidentType::new(
44 RelationshipToIncidentTypeData::new(
45 "00000000-0000-0000-0000-000000000000".to_string(),
46 IncidentTypeType::INCIDENT_TYPES,
47 ),
48 ))
49 .notification_template(RelationshipToIncidentNotificationTemplate::new(
50 RelationshipToIncidentNotificationTemplateData::new(
51 Uuid::parse_str("00000000-0000-0000-0000-000000000001")
52 .expect("invalid UUID"),
53 IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
54 ),
55 )),
56 ),
57 );
58 let mut configuration = datadog::Configuration::new();
59 configuration.set_unstable_operation_enabled("v2.UpdateIncidentNotificationRule", true);
60 let api = IncidentsAPI::with_config(configuration);
61 let resp = api
62 .update_incident_notification_rule(
63 Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
64 body,
65 UpdateIncidentNotificationRuleOptionalParams::default(),
66 )
67 .await;
68 if let Ok(value) = resp {
69 println!("{:#?}", value);
70 } else {
71 println!("{:#?}", resp.unwrap_err());
72 }
73}
Sourcepub fn enabled(self, value: bool) -> Self
pub fn enabled(self, value: bool) -> Self
Examples found in repository?
examples/v2_incidents_CreateIncidentNotificationRule_3029800608.rs (line 29)
16async fn main() {
17 // there is a valid "incident_type" in the system
18 let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
19 let body = CreateIncidentNotificationRuleRequest::new(
20 IncidentNotificationRuleCreateData::new(
21 IncidentNotificationRuleCreateAttributes::new(
22 vec![IncidentNotificationRuleConditionsItems::new(
23 "severity".to_string(),
24 vec!["SEV-1".to_string(), "SEV-2".to_string()],
25 )],
26 vec!["@test-email@company.com".to_string()],
27 "incident_created_trigger".to_string(),
28 )
29 .enabled(true)
30 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
31 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
32 )
33 .relationships(
34 IncidentNotificationRuleCreateDataRelationships::new().incident_type(
35 RelationshipToIncidentType::new(RelationshipToIncidentTypeData::new(
36 incident_type_data_id.clone(),
37 IncidentTypeType::INCIDENT_TYPES,
38 )),
39 ),
40 ),
41 );
42 let mut configuration = datadog::Configuration::new();
43 configuration.set_unstable_operation_enabled("v2.CreateIncidentNotificationRule", true);
44 let api = IncidentsAPI::with_config(configuration);
45 let resp = api.create_incident_notification_rule(body).await;
46 if let Ok(value) = resp {
47 println!("{:#?}", value);
48 } else {
49 println!("{:#?}", resp.unwrap_err());
50 }
51}
More examples
examples/v2_incidents_UpdateIncidentNotificationRule_1207309457.rs (line 35)
17async fn main() {
18 // there is a valid "notification_rule" in the system
19 let notification_rule_data_id =
20 uuid::Uuid::parse_str(&std::env::var("NOTIFICATION_RULE_DATA_ID").unwrap())
21 .expect("Invalid UUID");
22
23 // there is a valid "incident_type" in the system
24 let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
25 let body = PutIncidentNotificationRuleRequest::new(
26 IncidentNotificationRuleUpdateData::new(
27 IncidentNotificationRuleCreateAttributes::new(
28 vec![IncidentNotificationRuleConditionsItems::new(
29 "severity".to_string(),
30 vec!["SEV-1".to_string()],
31 )],
32 vec!["@updated-team-email@company.com".to_string()],
33 "incident_modified_trigger".to_string(),
34 )
35 .enabled(false)
36 .visibility(IncidentNotificationRuleCreateAttributesVisibility::PRIVATE),
37 notification_rule_data_id.clone(),
38 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
39 )
40 .relationships(
41 IncidentNotificationRuleCreateDataRelationships::new().incident_type(
42 RelationshipToIncidentType::new(RelationshipToIncidentTypeData::new(
43 incident_type_data_id.clone(),
44 IncidentTypeType::INCIDENT_TYPES,
45 )),
46 ),
47 ),
48 );
49 let mut configuration = datadog::Configuration::new();
50 configuration.set_unstable_operation_enabled("v2.UpdateIncidentNotificationRule", true);
51 let api = IncidentsAPI::with_config(configuration);
52 let resp = api
53 .update_incident_notification_rule(
54 notification_rule_data_id.clone(),
55 body,
56 UpdateIncidentNotificationRuleOptionalParams::default(),
57 )
58 .await;
59 if let Ok(value) = resp {
60 println!("{:#?}", value);
61 } else {
62 println!("{:#?}", resp.unwrap_err());
63 }
64}
examples/v2_incidents_CreateIncidentNotificationRule.rs (line 34)
20async fn main() {
21 let body = CreateIncidentNotificationRuleRequest::new(
22 IncidentNotificationRuleCreateData::new(
23 IncidentNotificationRuleCreateAttributes::new(
24 vec![IncidentNotificationRuleConditionsItems::new(
25 "severity".to_string(),
26 vec!["SEV-1".to_string(), "SEV-2".to_string()],
27 )],
28 vec![
29 "@team-email@company.com".to_string(),
30 "@slack-channel".to_string(),
31 ],
32 "incident_created_trigger".to_string(),
33 )
34 .enabled(true)
35 .renotify_on(vec!["status".to_string(), "severity".to_string()])
36 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
37 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
38 )
39 .relationships(
40 IncidentNotificationRuleCreateDataRelationships::new()
41 .incident_type(RelationshipToIncidentType::new(
42 RelationshipToIncidentTypeData::new(
43 "00000000-0000-0000-0000-000000000000".to_string(),
44 IncidentTypeType::INCIDENT_TYPES,
45 ),
46 ))
47 .notification_template(RelationshipToIncidentNotificationTemplate::new(
48 RelationshipToIncidentNotificationTemplateData::new(
49 Uuid::parse_str("00000000-0000-0000-0000-000000000001")
50 .expect("invalid UUID"),
51 IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
52 ),
53 )),
54 ),
55 );
56 let mut configuration = datadog::Configuration::new();
57 configuration.set_unstable_operation_enabled("v2.CreateIncidentNotificationRule", true);
58 let api = IncidentsAPI::with_config(configuration);
59 let resp = api.create_incident_notification_rule(body).await;
60 if let Ok(value) = resp {
61 println!("{:#?}", value);
62 } else {
63 println!("{:#?}", resp.unwrap_err());
64 }
65}
examples/v2_incidents_UpdateIncidentNotificationRule.rs (line 35)
21async fn main() {
22 let body = PutIncidentNotificationRuleRequest::new(
23 IncidentNotificationRuleUpdateData::new(
24 IncidentNotificationRuleCreateAttributes::new(
25 vec![IncidentNotificationRuleConditionsItems::new(
26 "severity".to_string(),
27 vec!["SEV-1".to_string(), "SEV-2".to_string()],
28 )],
29 vec![
30 "@team-email@company.com".to_string(),
31 "@slack-channel".to_string(),
32 ],
33 "incident_created_trigger".to_string(),
34 )
35 .enabled(true)
36 .renotify_on(vec!["status".to_string(), "severity".to_string()])
37 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
38 Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
39 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
40 )
41 .relationships(
42 IncidentNotificationRuleCreateDataRelationships::new()
43 .incident_type(RelationshipToIncidentType::new(
44 RelationshipToIncidentTypeData::new(
45 "00000000-0000-0000-0000-000000000000".to_string(),
46 IncidentTypeType::INCIDENT_TYPES,
47 ),
48 ))
49 .notification_template(RelationshipToIncidentNotificationTemplate::new(
50 RelationshipToIncidentNotificationTemplateData::new(
51 Uuid::parse_str("00000000-0000-0000-0000-000000000001")
52 .expect("invalid UUID"),
53 IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
54 ),
55 )),
56 ),
57 );
58 let mut configuration = datadog::Configuration::new();
59 configuration.set_unstable_operation_enabled("v2.UpdateIncidentNotificationRule", true);
60 let api = IncidentsAPI::with_config(configuration);
61 let resp = api
62 .update_incident_notification_rule(
63 Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
64 body,
65 UpdateIncidentNotificationRuleOptionalParams::default(),
66 )
67 .await;
68 if let Ok(value) = resp {
69 println!("{:#?}", value);
70 } else {
71 println!("{:#?}", resp.unwrap_err());
72 }
73}
Sourcepub fn renotify_on(self, value: Vec<String>) -> Self
pub fn renotify_on(self, value: Vec<String>) -> Self
Examples found in repository?
examples/v2_incidents_CreateIncidentNotificationRule.rs (line 35)
20async fn main() {
21 let body = CreateIncidentNotificationRuleRequest::new(
22 IncidentNotificationRuleCreateData::new(
23 IncidentNotificationRuleCreateAttributes::new(
24 vec![IncidentNotificationRuleConditionsItems::new(
25 "severity".to_string(),
26 vec!["SEV-1".to_string(), "SEV-2".to_string()],
27 )],
28 vec![
29 "@team-email@company.com".to_string(),
30 "@slack-channel".to_string(),
31 ],
32 "incident_created_trigger".to_string(),
33 )
34 .enabled(true)
35 .renotify_on(vec!["status".to_string(), "severity".to_string()])
36 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
37 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
38 )
39 .relationships(
40 IncidentNotificationRuleCreateDataRelationships::new()
41 .incident_type(RelationshipToIncidentType::new(
42 RelationshipToIncidentTypeData::new(
43 "00000000-0000-0000-0000-000000000000".to_string(),
44 IncidentTypeType::INCIDENT_TYPES,
45 ),
46 ))
47 .notification_template(RelationshipToIncidentNotificationTemplate::new(
48 RelationshipToIncidentNotificationTemplateData::new(
49 Uuid::parse_str("00000000-0000-0000-0000-000000000001")
50 .expect("invalid UUID"),
51 IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
52 ),
53 )),
54 ),
55 );
56 let mut configuration = datadog::Configuration::new();
57 configuration.set_unstable_operation_enabled("v2.CreateIncidentNotificationRule", true);
58 let api = IncidentsAPI::with_config(configuration);
59 let resp = api.create_incident_notification_rule(body).await;
60 if let Ok(value) = resp {
61 println!("{:#?}", value);
62 } else {
63 println!("{:#?}", resp.unwrap_err());
64 }
65}
More examples
examples/v2_incidents_UpdateIncidentNotificationRule.rs (line 36)
21async fn main() {
22 let body = PutIncidentNotificationRuleRequest::new(
23 IncidentNotificationRuleUpdateData::new(
24 IncidentNotificationRuleCreateAttributes::new(
25 vec![IncidentNotificationRuleConditionsItems::new(
26 "severity".to_string(),
27 vec!["SEV-1".to_string(), "SEV-2".to_string()],
28 )],
29 vec![
30 "@team-email@company.com".to_string(),
31 "@slack-channel".to_string(),
32 ],
33 "incident_created_trigger".to_string(),
34 )
35 .enabled(true)
36 .renotify_on(vec!["status".to_string(), "severity".to_string()])
37 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
38 Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
39 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
40 )
41 .relationships(
42 IncidentNotificationRuleCreateDataRelationships::new()
43 .incident_type(RelationshipToIncidentType::new(
44 RelationshipToIncidentTypeData::new(
45 "00000000-0000-0000-0000-000000000000".to_string(),
46 IncidentTypeType::INCIDENT_TYPES,
47 ),
48 ))
49 .notification_template(RelationshipToIncidentNotificationTemplate::new(
50 RelationshipToIncidentNotificationTemplateData::new(
51 Uuid::parse_str("00000000-0000-0000-0000-000000000001")
52 .expect("invalid UUID"),
53 IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
54 ),
55 )),
56 ),
57 );
58 let mut configuration = datadog::Configuration::new();
59 configuration.set_unstable_operation_enabled("v2.UpdateIncidentNotificationRule", true);
60 let api = IncidentsAPI::with_config(configuration);
61 let resp = api
62 .update_incident_notification_rule(
63 Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
64 body,
65 UpdateIncidentNotificationRuleOptionalParams::default(),
66 )
67 .await;
68 if let Ok(value) = resp {
69 println!("{:#?}", value);
70 } else {
71 println!("{:#?}", resp.unwrap_err());
72 }
73}
Sourcepub fn visibility(
self,
value: IncidentNotificationRuleCreateAttributesVisibility,
) -> Self
pub fn visibility( self, value: IncidentNotificationRuleCreateAttributesVisibility, ) -> Self
Examples found in repository?
examples/v2_incidents_CreateIncidentNotificationRule_3029800608.rs (line 30)
16async fn main() {
17 // there is a valid "incident_type" in the system
18 let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
19 let body = CreateIncidentNotificationRuleRequest::new(
20 IncidentNotificationRuleCreateData::new(
21 IncidentNotificationRuleCreateAttributes::new(
22 vec![IncidentNotificationRuleConditionsItems::new(
23 "severity".to_string(),
24 vec!["SEV-1".to_string(), "SEV-2".to_string()],
25 )],
26 vec!["@test-email@company.com".to_string()],
27 "incident_created_trigger".to_string(),
28 )
29 .enabled(true)
30 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
31 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
32 )
33 .relationships(
34 IncidentNotificationRuleCreateDataRelationships::new().incident_type(
35 RelationshipToIncidentType::new(RelationshipToIncidentTypeData::new(
36 incident_type_data_id.clone(),
37 IncidentTypeType::INCIDENT_TYPES,
38 )),
39 ),
40 ),
41 );
42 let mut configuration = datadog::Configuration::new();
43 configuration.set_unstable_operation_enabled("v2.CreateIncidentNotificationRule", true);
44 let api = IncidentsAPI::with_config(configuration);
45 let resp = api.create_incident_notification_rule(body).await;
46 if let Ok(value) = resp {
47 println!("{:#?}", value);
48 } else {
49 println!("{:#?}", resp.unwrap_err());
50 }
51}
More examples
examples/v2_incidents_UpdateIncidentNotificationRule_1207309457.rs (line 36)
17async fn main() {
18 // there is a valid "notification_rule" in the system
19 let notification_rule_data_id =
20 uuid::Uuid::parse_str(&std::env::var("NOTIFICATION_RULE_DATA_ID").unwrap())
21 .expect("Invalid UUID");
22
23 // there is a valid "incident_type" in the system
24 let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
25 let body = PutIncidentNotificationRuleRequest::new(
26 IncidentNotificationRuleUpdateData::new(
27 IncidentNotificationRuleCreateAttributes::new(
28 vec![IncidentNotificationRuleConditionsItems::new(
29 "severity".to_string(),
30 vec!["SEV-1".to_string()],
31 )],
32 vec!["@updated-team-email@company.com".to_string()],
33 "incident_modified_trigger".to_string(),
34 )
35 .enabled(false)
36 .visibility(IncidentNotificationRuleCreateAttributesVisibility::PRIVATE),
37 notification_rule_data_id.clone(),
38 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
39 )
40 .relationships(
41 IncidentNotificationRuleCreateDataRelationships::new().incident_type(
42 RelationshipToIncidentType::new(RelationshipToIncidentTypeData::new(
43 incident_type_data_id.clone(),
44 IncidentTypeType::INCIDENT_TYPES,
45 )),
46 ),
47 ),
48 );
49 let mut configuration = datadog::Configuration::new();
50 configuration.set_unstable_operation_enabled("v2.UpdateIncidentNotificationRule", true);
51 let api = IncidentsAPI::with_config(configuration);
52 let resp = api
53 .update_incident_notification_rule(
54 notification_rule_data_id.clone(),
55 body,
56 UpdateIncidentNotificationRuleOptionalParams::default(),
57 )
58 .await;
59 if let Ok(value) = resp {
60 println!("{:#?}", value);
61 } else {
62 println!("{:#?}", resp.unwrap_err());
63 }
64}
examples/v2_incidents_CreateIncidentNotificationRule.rs (line 36)
20async fn main() {
21 let body = CreateIncidentNotificationRuleRequest::new(
22 IncidentNotificationRuleCreateData::new(
23 IncidentNotificationRuleCreateAttributes::new(
24 vec![IncidentNotificationRuleConditionsItems::new(
25 "severity".to_string(),
26 vec!["SEV-1".to_string(), "SEV-2".to_string()],
27 )],
28 vec![
29 "@team-email@company.com".to_string(),
30 "@slack-channel".to_string(),
31 ],
32 "incident_created_trigger".to_string(),
33 )
34 .enabled(true)
35 .renotify_on(vec!["status".to_string(), "severity".to_string()])
36 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
37 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
38 )
39 .relationships(
40 IncidentNotificationRuleCreateDataRelationships::new()
41 .incident_type(RelationshipToIncidentType::new(
42 RelationshipToIncidentTypeData::new(
43 "00000000-0000-0000-0000-000000000000".to_string(),
44 IncidentTypeType::INCIDENT_TYPES,
45 ),
46 ))
47 .notification_template(RelationshipToIncidentNotificationTemplate::new(
48 RelationshipToIncidentNotificationTemplateData::new(
49 Uuid::parse_str("00000000-0000-0000-0000-000000000001")
50 .expect("invalid UUID"),
51 IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
52 ),
53 )),
54 ),
55 );
56 let mut configuration = datadog::Configuration::new();
57 configuration.set_unstable_operation_enabled("v2.CreateIncidentNotificationRule", true);
58 let api = IncidentsAPI::with_config(configuration);
59 let resp = api.create_incident_notification_rule(body).await;
60 if let Ok(value) = resp {
61 println!("{:#?}", value);
62 } else {
63 println!("{:#?}", resp.unwrap_err());
64 }
65}
examples/v2_incidents_UpdateIncidentNotificationRule.rs (line 37)
21async fn main() {
22 let body = PutIncidentNotificationRuleRequest::new(
23 IncidentNotificationRuleUpdateData::new(
24 IncidentNotificationRuleCreateAttributes::new(
25 vec![IncidentNotificationRuleConditionsItems::new(
26 "severity".to_string(),
27 vec!["SEV-1".to_string(), "SEV-2".to_string()],
28 )],
29 vec![
30 "@team-email@company.com".to_string(),
31 "@slack-channel".to_string(),
32 ],
33 "incident_created_trigger".to_string(),
34 )
35 .enabled(true)
36 .renotify_on(vec!["status".to_string(), "severity".to_string()])
37 .visibility(IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION),
38 Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
39 IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES,
40 )
41 .relationships(
42 IncidentNotificationRuleCreateDataRelationships::new()
43 .incident_type(RelationshipToIncidentType::new(
44 RelationshipToIncidentTypeData::new(
45 "00000000-0000-0000-0000-000000000000".to_string(),
46 IncidentTypeType::INCIDENT_TYPES,
47 ),
48 ))
49 .notification_template(RelationshipToIncidentNotificationTemplate::new(
50 RelationshipToIncidentNotificationTemplateData::new(
51 Uuid::parse_str("00000000-0000-0000-0000-000000000001")
52 .expect("invalid UUID"),
53 IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
54 ),
55 )),
56 ),
57 );
58 let mut configuration = datadog::Configuration::new();
59 configuration.set_unstable_operation_enabled("v2.UpdateIncidentNotificationRule", true);
60 let api = IncidentsAPI::with_config(configuration);
61 let resp = api
62 .update_incident_notification_rule(
63 Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
64 body,
65 UpdateIncidentNotificationRuleOptionalParams::default(),
66 )
67 .await;
68 if let Ok(value) = resp {
69 println!("{:#?}", value);
70 } else {
71 println!("{:#?}", resp.unwrap_err());
72 }
73}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for IncidentNotificationRuleCreateAttributes
impl Clone for IncidentNotificationRuleCreateAttributes
Source§fn clone(&self) -> IncidentNotificationRuleCreateAttributes
fn clone(&self) -> IncidentNotificationRuleCreateAttributes
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 IncidentNotificationRuleCreateAttributes
impl<'de> Deserialize<'de> for IncidentNotificationRuleCreateAttributes
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 IncidentNotificationRuleCreateAttributes
impl PartialEq for IncidentNotificationRuleCreateAttributes
Source§fn eq(&self, other: &IncidentNotificationRuleCreateAttributes) -> bool
fn eq(&self, other: &IncidentNotificationRuleCreateAttributes) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl StructuralPartialEq for IncidentNotificationRuleCreateAttributes
Auto Trait Implementations§
impl Freeze for IncidentNotificationRuleCreateAttributes
impl RefUnwindSafe for IncidentNotificationRuleCreateAttributes
impl Send for IncidentNotificationRuleCreateAttributes
impl Sync for IncidentNotificationRuleCreateAttributes
impl Unpin for IncidentNotificationRuleCreateAttributes
impl UnwindSafe for IncidentNotificationRuleCreateAttributes
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