Skip to content

Commit b6077fc

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Incident Notification Template Public Docs (#897)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 12fc173 commit b6077fc

File tree

59 files changed

+5828
-27
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+5828
-27
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 613 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE-3rdparty.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Component,Origin,License,Copyright
22
addr2line,https://github.com/gimli-rs/addr2line,Apache-2.0 OR MIT,The addr2line Authors
33
adler2,https://github.com/oyvindln/adler2,0BSD OR MIT OR Apache-2.0,"Jonas Schievink <[email protected]>, oyvindln <[email protected]>"
4-
android-tzdata,https://github.com/RumovZ/android-tzdata,MIT OR Apache-2.0,RumovZ
54
android_system_properties,https://github.com/nical/android_system_properties,MIT OR Apache-2.0,Nicolas Silva <[email protected]>
65
anyhow,https://github.com/dtolnay/anyhow,MIT OR Apache-2.0,David Tolnay <[email protected]>
76
async-stream,https://github.com/tokio-rs/async-stream,MIT,Carl Lerche <[email protected]>
@@ -181,6 +180,7 @@ windows-core,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
181180
windows-implement,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
182181
windows-interface,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
183182
windows-link,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
183+
windows-link,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-link Authors
184184
windows-result,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
185185
windows-strings,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
186186
windows-sys,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Create incident notification template returns "Created" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
4+
use datadog_api_client::datadogV2::model::CreateIncidentNotificationTemplateRequest;
5+
use datadog_api_client::datadogV2::model::IncidentNotificationTemplateCreateAttributes;
6+
use datadog_api_client::datadogV2::model::IncidentNotificationTemplateCreateData;
7+
use datadog_api_client::datadogV2::model::IncidentNotificationTemplateCreateDataRelationships;
8+
use datadog_api_client::datadogV2::model::IncidentNotificationTemplateType;
9+
use datadog_api_client::datadogV2::model::IncidentTypeType;
10+
use datadog_api_client::datadogV2::model::RelationshipToIncidentType;
11+
use datadog_api_client::datadogV2::model::RelationshipToIncidentTypeData;
12+
13+
#[tokio::main]
14+
async fn main() {
15+
// there is a valid "incident_type" in the system
16+
let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
17+
let body = CreateIncidentNotificationTemplateRequest::new(
18+
IncidentNotificationTemplateCreateData::new(
19+
IncidentNotificationTemplateCreateAttributes::new(
20+
"alert".to_string(),
21+
r#"An incident has been declared.
22+
23+
Title: Sample Incident Title
24+
Severity: SEV-2
25+
Affected Services: web-service, database-service
26+
Status: active
27+
28+
Please join the incident channel for updates."#
29+
.to_string(),
30+
"Example-Incident".to_string(),
31+
"SEV-2 Incident: Sample Incident Title".to_string(),
32+
),
33+
IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
34+
)
35+
.relationships(
36+
IncidentNotificationTemplateCreateDataRelationships::new().incident_type(
37+
RelationshipToIncidentType::new(RelationshipToIncidentTypeData::new(
38+
incident_type_data_id.clone(),
39+
IncidentTypeType::INCIDENT_TYPES,
40+
)),
41+
),
42+
),
43+
);
44+
let mut configuration = datadog::Configuration::new();
45+
configuration.set_unstable_operation_enabled("v2.CreateIncidentNotificationTemplate", true);
46+
let api = IncidentsAPI::with_config(configuration);
47+
let resp = api.create_incident_notification_template(body).await;
48+
if let Ok(value) = resp {
49+
println!("{:#?}", value);
50+
} else {
51+
println!("{:#?}", resp.unwrap_err());
52+
}
53+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Delete a notification template returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_incidents::DeleteIncidentNotificationTemplateOptionalParams;
4+
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
5+
use uuid::Uuid;
6+
7+
#[tokio::main]
8+
async fn main() {
9+
let mut configuration = datadog::Configuration::new();
10+
configuration.set_unstable_operation_enabled("v2.DeleteIncidentNotificationTemplate", true);
11+
let api = IncidentsAPI::with_config(configuration);
12+
let resp = api
13+
.delete_incident_notification_template(
14+
Uuid::parse_str("00000000-0000-0000-0000-000000000001").expect("invalid UUID"),
15+
DeleteIncidentNotificationTemplateOptionalParams::default(),
16+
)
17+
.await;
18+
if let Ok(value) = resp {
19+
println!("{:#?}", value);
20+
} else {
21+
println!("{:#?}", resp.unwrap_err());
22+
}
23+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Delete incident notification template returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_incidents::DeleteIncidentNotificationTemplateOptionalParams;
4+
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "notification_template" in the system
9+
let notification_template_data_id =
10+
uuid::Uuid::parse_str(&std::env::var("NOTIFICATION_TEMPLATE_DATA_ID").unwrap())
11+
.expect("Invalid UUID");
12+
let mut configuration = datadog::Configuration::new();
13+
configuration.set_unstable_operation_enabled("v2.DeleteIncidentNotificationTemplate", true);
14+
let api = IncidentsAPI::with_config(configuration);
15+
let resp = api
16+
.delete_incident_notification_template(
17+
notification_template_data_id.clone(),
18+
DeleteIncidentNotificationTemplateOptionalParams::default(),
19+
)
20+
.await;
21+
if let Ok(value) = resp {
22+
println!("{:#?}", value);
23+
} else {
24+
println!("{:#?}", resp.unwrap_err());
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Get incident notification template returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_incidents::GetIncidentNotificationTemplateOptionalParams;
4+
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "notification_template" in the system
9+
let notification_template_data_id =
10+
uuid::Uuid::parse_str(&std::env::var("NOTIFICATION_TEMPLATE_DATA_ID").unwrap())
11+
.expect("Invalid UUID");
12+
let mut configuration = datadog::Configuration::new();
13+
configuration.set_unstable_operation_enabled("v2.GetIncidentNotificationTemplate", true);
14+
let api = IncidentsAPI::with_config(configuration);
15+
let resp = api
16+
.get_incident_notification_template(
17+
notification_template_data_id.clone(),
18+
GetIncidentNotificationTemplateOptionalParams::default(),
19+
)
20+
.await;
21+
if let Ok(value) = resp {
22+
println!("{:#?}", value);
23+
} else {
24+
println!("{:#?}", resp.unwrap_err());
25+
}
26+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// List incident notification templates returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
4+
use datadog_api_client::datadogV2::api_incidents::ListIncidentNotificationTemplatesOptionalParams;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
let mut configuration = datadog::Configuration::new();
9+
configuration.set_unstable_operation_enabled("v2.ListIncidentNotificationTemplates", true);
10+
let api = IncidentsAPI::with_config(configuration);
11+
let resp = api
12+
.list_incident_notification_templates(
13+
ListIncidentNotificationTemplatesOptionalParams::default(),
14+
)
15+
.await;
16+
if let Ok(value) = resp {
17+
println!("{:#?}", value);
18+
} else {
19+
println!("{:#?}", resp.unwrap_err());
20+
}
21+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Update incident notification template returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
4+
use datadog_api_client::datadogV2::api_incidents::UpdateIncidentNotificationTemplateOptionalParams;
5+
use datadog_api_client::datadogV2::model::IncidentNotificationTemplateType;
6+
use datadog_api_client::datadogV2::model::IncidentNotificationTemplateUpdateAttributes;
7+
use datadog_api_client::datadogV2::model::IncidentNotificationTemplateUpdateData;
8+
use datadog_api_client::datadogV2::model::PatchIncidentNotificationTemplateRequest;
9+
10+
#[tokio::main]
11+
async fn main() {
12+
// there is a valid "notification_template" in the system
13+
let notification_template_data_id =
14+
uuid::Uuid::parse_str(&std::env::var("NOTIFICATION_TEMPLATE_DATA_ID").unwrap())
15+
.expect("Invalid UUID");
16+
let body = PatchIncidentNotificationTemplateRequest::new(
17+
IncidentNotificationTemplateUpdateData::new(
18+
notification_template_data_id.clone(),
19+
IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES,
20+
)
21+
.attributes(
22+
IncidentNotificationTemplateUpdateAttributes::new()
23+
.category("update".to_string())
24+
.content(
25+
r#"Incident Status Update:
26+
27+
Title: Sample Incident Title
28+
New Status: resolved
29+
Severity: SEV-2
30+
Services: web-service, database-service
31+
Commander: John Doe
32+
33+
For more details, visit the incident page."#
34+
.to_string(),
35+
)
36+
.name("Example-Incident".to_string())
37+
.subject("Incident Update: Sample Incident Title - resolved".to_string()),
38+
),
39+
);
40+
let mut configuration = datadog::Configuration::new();
41+
configuration.set_unstable_operation_enabled("v2.UpdateIncidentNotificationTemplate", true);
42+
let api = IncidentsAPI::with_config(configuration);
43+
let resp = api
44+
.update_incident_notification_template(
45+
notification_template_data_id.clone(),
46+
body,
47+
UpdateIncidentNotificationTemplateOptionalParams::default(),
48+
)
49+
.await;
50+
if let Ok(value) = resp {
51+
println!("{:#?}", value);
52+
} else {
53+
println!("{:#?}", resp.unwrap_err());
54+
}
55+
}

src/datadog/configuration.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,25 +161,30 @@ impl Default for Configuration {
161161
("v2.get_data_deletion_requests".to_owned(), false),
162162
("v2.create_incident".to_owned(), false),
163163
("v2.create_incident_integration".to_owned(), false),
164+
("v2.create_incident_notification_template".to_owned(), false),
164165
("v2.create_incident_todo".to_owned(), false),
165166
("v2.create_incident_type".to_owned(), false),
166167
("v2.delete_incident".to_owned(), false),
167168
("v2.delete_incident_integration".to_owned(), false),
169+
("v2.delete_incident_notification_template".to_owned(), false),
168170
("v2.delete_incident_todo".to_owned(), false),
169171
("v2.delete_incident_type".to_owned(), false),
170172
("v2.get_incident".to_owned(), false),
171173
("v2.get_incident_integration".to_owned(), false),
174+
("v2.get_incident_notification_template".to_owned(), false),
172175
("v2.get_incident_todo".to_owned(), false),
173176
("v2.get_incident_type".to_owned(), false),
174177
("v2.list_incident_attachments".to_owned(), false),
175178
("v2.list_incident_integrations".to_owned(), false),
179+
("v2.list_incident_notification_templates".to_owned(), false),
176180
("v2.list_incidents".to_owned(), false),
177181
("v2.list_incident_todos".to_owned(), false),
178182
("v2.list_incident_types".to_owned(), false),
179183
("v2.search_incidents".to_owned(), false),
180184
("v2.update_incident".to_owned(), false),
181185
("v2.update_incident_attachments".to_owned(), false),
182186
("v2.update_incident_integration".to_owned(), false),
187+
("v2.update_incident_notification_template".to_owned(), false),
183188
("v2.update_incident_todo".to_owned(), false),
184189
("v2.update_incident_type".to_owned(), false),
185190
("v2.create_aws_account".to_owned(), false),

0 commit comments

Comments
 (0)