v2_case_management_attribute_CreateCustomAttributeConfig/
v2_case-management-attribute_CreateCustomAttributeConfig.rs1use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_case_management_attribute::CaseManagementAttributeAPI;
4use datadog_api_client::datadogV2::model::CustomAttributeConfigAttributesCreate;
5use datadog_api_client::datadogV2::model::CustomAttributeConfigCreate;
6use datadog_api_client::datadogV2::model::CustomAttributeConfigCreateRequest;
7use datadog_api_client::datadogV2::model::CustomAttributeConfigResourceType;
8use datadog_api_client::datadogV2::model::CustomAttributeType;
9
10#[tokio::main]
11async fn main() {
12 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}