Skip to content

Commit c193e25

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Document multiple case-management endpoints (#840)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 8c41ab1 commit c193e25

File tree

178 files changed

+10673
-221
lines changed

Some content is hidden

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

178 files changed

+10673
-221
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 888 additions & 3 deletions
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Create custom attribute config for a case type returns "CREATED" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management_attribute::CaseManagementAttributeAPI;
4+
use datadog_api_client::datadogV2::model::CustomAttributeConfigAttributesCreate;
5+
use datadog_api_client::datadogV2::model::CustomAttributeConfigCreate;
6+
use datadog_api_client::datadogV2::model::CustomAttributeConfigCreateRequest;
7+
use datadog_api_client::datadogV2::model::CustomAttributeConfigResourceType;
8+
use datadog_api_client::datadogV2::model::CustomAttributeType;
9+
10+
#[tokio::main]
11+
async fn main() {
12+
// there is a valid "case_type" in the system
13+
let case_type_id = std::env::var("CASE_TYPE_ID").unwrap();
14+
let body = CustomAttributeConfigCreateRequest::new(CustomAttributeConfigCreate::new(
15+
CustomAttributeConfigAttributesCreate::new(
16+
"AWS Region ".to_string(),
17+
true,
18+
"region_d9fe56bc9274fbb6".to_string(),
19+
CustomAttributeType::NUMBER,
20+
),
21+
CustomAttributeConfigResourceType::CUSTOM_ATTRIBUTE,
22+
));
23+
let configuration = datadog::Configuration::new();
24+
let api = CaseManagementAttributeAPI::with_config(configuration);
25+
let resp = api
26+
.create_custom_attribute_config(case_type_id.clone(), body)
27+
.await;
28+
if let Ok(value) = resp {
29+
println!("{:#?}", value);
30+
} else {
31+
println!("{:#?}", resp.unwrap_err());
32+
}
33+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Delete custom attributes config returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management_attribute::CaseManagementAttributeAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "case_type" in the system
8+
let case_type_id = std::env::var("CASE_TYPE_ID").unwrap();
9+
10+
// there is a valid "custom_attribute" in the system
11+
let custom_attribute_id = std::env::var("CUSTOM_ATTRIBUTE_ID").unwrap();
12+
let configuration = datadog::Configuration::new();
13+
let api = CaseManagementAttributeAPI::with_config(configuration);
14+
let resp = api
15+
.delete_custom_attribute_config(case_type_id.clone(), custom_attribute_id.clone())
16+
.await;
17+
if let Ok(value) = resp {
18+
println!("{:#?}", value);
19+
} else {
20+
println!("{:#?}", resp.unwrap_err());
21+
}
22+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Get all custom attributes config of case type returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management_attribute::CaseManagementAttributeAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "case_type" in the system
8+
let case_type_id = std::env::var("CASE_TYPE_ID").unwrap();
9+
let configuration = datadog::Configuration::new();
10+
let api = CaseManagementAttributeAPI::with_config(configuration);
11+
let resp = api
12+
.get_all_custom_attribute_configs_by_case_type(case_type_id.clone())
13+
.await;
14+
if let Ok(value) = resp {
15+
println!("{:#?}", value);
16+
} else {
17+
println!("{:#?}", resp.unwrap_err());
18+
}
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Get all custom attributes returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management_attribute::CaseManagementAttributeAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = CaseManagementAttributeAPI::with_config(configuration);
9+
let resp = api.get_all_custom_attributes().await;
10+
if let Ok(value) = resp {
11+
println!("{:#?}", value);
12+
} else {
13+
println!("{:#?}", resp.unwrap_err());
14+
}
15+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Create a case type returns "CREATED" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management_type::CaseManagementTypeAPI;
4+
use datadog_api_client::datadogV2::model::CaseTypeCreate;
5+
use datadog_api_client::datadogV2::model::CaseTypeCreateRequest;
6+
use datadog_api_client::datadogV2::model::CaseTypeResourceAttributes;
7+
use datadog_api_client::datadogV2::model::CaseTypeResourceType;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
let body = CaseTypeCreateRequest::new(CaseTypeCreate::new(
12+
CaseTypeResourceAttributes::new("Investigation".to_string())
13+
.description("Investigations done in case management".to_string())
14+
.emoji("👑".to_string()),
15+
CaseTypeResourceType::CASE_TYPE,
16+
));
17+
let configuration = datadog::Configuration::new();
18+
let api = CaseManagementTypeAPI::with_config(configuration);
19+
let resp = api.create_case_type(body).await;
20+
if let Ok(value) = resp {
21+
println!("{:#?}", value);
22+
} else {
23+
println!("{:#?}", resp.unwrap_err());
24+
}
25+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Delete a case type returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management_type::CaseManagementTypeAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = CaseManagementTypeAPI::with_config(configuration);
9+
let resp = api.delete_case_type("case_type_id".to_string()).await;
10+
if let Ok(value) = resp {
11+
println!("{:#?}", value);
12+
} else {
13+
println!("{:#?}", resp.unwrap_err());
14+
}
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Delete a case type returns "NotContent" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management_type::CaseManagementTypeAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "case_type" in the system
8+
let case_type_id = std::env::var("CASE_TYPE_ID").unwrap();
9+
let configuration = datadog::Configuration::new();
10+
let api = CaseManagementTypeAPI::with_config(configuration);
11+
let resp = api.delete_case_type(case_type_id.clone()).await;
12+
if let Ok(value) = resp {
13+
println!("{:#?}", value);
14+
} else {
15+
println!("{:#?}", resp.unwrap_err());
16+
}
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Get all case types returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management_type::CaseManagementTypeAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = CaseManagementTypeAPI::with_config(configuration);
9+
let resp = api.get_all_case_types().await;
10+
if let Ok(value) = resp {
11+
println!("{:#?}", value);
12+
} else {
13+
println!("{:#?}", resp.unwrap_err());
14+
}
15+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Comment case returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management::CaseManagementAPI;
4+
use datadog_api_client::datadogV2::model::CaseComment;
5+
use datadog_api_client::datadogV2::model::CaseCommentAttributes;
6+
use datadog_api_client::datadogV2::model::CaseCommentRequest;
7+
use datadog_api_client::datadogV2::model::CaseResourceType;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
// there is a valid "case" in the system
12+
let case_id = std::env::var("CASE_ID").unwrap();
13+
let body = CaseCommentRequest::new(CaseComment::new(
14+
CaseCommentAttributes::new("Hello World !".to_string()),
15+
CaseResourceType::CASE,
16+
));
17+
let configuration = datadog::Configuration::new();
18+
let api = CaseManagementAPI::with_config(configuration);
19+
let resp = api.comment_case(case_id.clone(), body).await;
20+
if let Ok(value) = resp {
21+
println!("{:#?}", value);
22+
} else {
23+
println!("{:#?}", resp.unwrap_err());
24+
}
25+
}

0 commit comments

Comments
 (0)