IncidentNotificationRuleCreateAttributes

Struct IncidentNotificationRuleCreateAttributes 

Source
#[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

Source

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
Hide additional 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}
Source

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
Hide additional 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}
Source

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
Hide additional 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}
Source

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
Hide additional 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}
Source

pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self

Trait Implementations§

Source§

impl Clone for IncidentNotificationRuleCreateAttributes

Source§

fn clone(&self) -> IncidentNotificationRuleCreateAttributes

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IncidentNotificationRuleCreateAttributes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for IncidentNotificationRuleCreateAttributes

Source§

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

Source§

fn eq(&self, other: &IncidentNotificationRuleCreateAttributes) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for IncidentNotificationRuleCreateAttributes

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for IncidentNotificationRuleCreateAttributes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,