v2_case_management_UpdateAttributes/
v2_case-management_UpdateAttributes.rs

1// Update case attributes returns "OK" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_case_management::CaseManagementAPI;
4use datadog_api_client::datadogV2::model::CaseResourceType;
5use datadog_api_client::datadogV2::model::CaseUpdateAttributes;
6use datadog_api_client::datadogV2::model::CaseUpdateAttributesAttributes;
7use datadog_api_client::datadogV2::model::CaseUpdateAttributesRequest;
8use std::collections::BTreeMap;
9
10#[tokio::main]
11async fn main() {
12    // there is a valid "case" in the system
13    let case_id = std::env::var("CASE_ID").unwrap();
14    let body = CaseUpdateAttributesRequest::new(CaseUpdateAttributes::new(
15        CaseUpdateAttributesAttributes::new(BTreeMap::from([
16            ("env".to_string(), vec!["test".to_string()]),
17            (
18                "service".to_string(),
19                vec!["web-store".to_string(), "web-api".to_string()],
20            ),
21            ("team".to_string(), vec!["engineer".to_string()]),
22        ])),
23        CaseResourceType::CASE,
24    ));
25    let configuration = datadog::Configuration::new();
26    let api = CaseManagementAPI::with_config(configuration);
27    let resp = api.update_attributes(case_id.clone(), body).await;
28    if let Ok(value) = resp {
29        println!("{:#?}", value);
30    } else {
31        println!("{:#?}", resp.unwrap_err());
32    }
33}