v2_cloud_cost_management_UploadCustomCostsFile_4125168396/
v2_cloud-cost-management_UploadCustomCostsFile_4125168396.rs

1// Upload Custom Costs File returns "Accepted" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
4use datadog_api_client::datadogV2::model::CustomCostsFileLineItem;
5use std::collections::BTreeMap;
6
7#[tokio::main]
8async fn main() {
9    let body = vec![CustomCostsFileLineItem::new()
10        .billed_cost(250.0 as f64)
11        .billing_currency("USD".to_string())
12        .charge_description("my_description".to_string())
13        .charge_period_end("2023-06-06".to_string())
14        .charge_period_start("2023-05-06".to_string())
15        .provider_name("my_provider".to_string())
16        .tags(BTreeMap::from([("key".to_string(), "value".to_string())]))];
17    let configuration = datadog::Configuration::new();
18    let api = CloudCostManagementAPI::with_config(configuration);
19    let resp = api.upload_custom_costs_file(body).await;
20    if let Ok(value) = resp {
21        println!("{:#?}", value);
22    } else {
23        println!("{:#?}", resp.unwrap_err());
24    }
25}