v2_cloud_cost_management_ReorderCustomAllocationRules/
v2_cloud-cost-management_ReorderCustomAllocationRules.rs

1// Reorder custom allocation rules returns "Successfully reordered rules" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
4use datadog_api_client::datadogV2::model::ReorderRuleResourceArray;
5use datadog_api_client::datadogV2::model::ReorderRuleResourceData;
6use datadog_api_client::datadogV2::model::ReorderRuleResourceDataType;
7
8#[tokio::main]
9async fn main() {
10    let body = ReorderRuleResourceArray::new(vec![
11        ReorderRuleResourceData::new(ReorderRuleResourceDataType::ARBITRARY_RULE)
12            .id("456".to_string()),
13        ReorderRuleResourceData::new(ReorderRuleResourceDataType::ARBITRARY_RULE)
14            .id("123".to_string()),
15        ReorderRuleResourceData::new(ReorderRuleResourceDataType::ARBITRARY_RULE)
16            .id("789".to_string()),
17    ]);
18    let configuration = datadog::Configuration::new();
19    let api = CloudCostManagementAPI::with_config(configuration);
20    let resp = api.reorder_custom_allocation_rules(body).await;
21    if let Ok(value) = resp {
22        println!("{:#?}", value);
23    } else {
24        println!("{:#?}", resp.unwrap_err());
25    }
26}