v2_actions_datastores_BulkWriteDatastoreItems/
v2_actions-datastores_BulkWriteDatastoreItems.rs1use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4use datadog_api_client::datadogV2::model::BulkPutAppsDatastoreItemsRequest;
5use datadog_api_client::datadogV2::model::BulkPutAppsDatastoreItemsRequestData;
6use datadog_api_client::datadogV2::model::BulkPutAppsDatastoreItemsRequestDataAttributes;
7use datadog_api_client::datadogV2::model::DatastoreItemsDataType;
8use serde_json::Value;
9use std::collections::BTreeMap;
10
11#[tokio::main]
12async fn main() {
13 let datastore_data_id = std::env::var("DATASTORE_DATA_ID").unwrap();
15 let body = BulkPutAppsDatastoreItemsRequest::new().data(
16 BulkPutAppsDatastoreItemsRequestData::new(DatastoreItemsDataType::ITEMS).attributes(
17 BulkPutAppsDatastoreItemsRequestDataAttributes::new(vec![
18 BTreeMap::from([
19 ("id".to_string(), Value::from("cust_3141")),
20 ("name".to_string(), Value::from("Johnathan")),
21 ]),
22 BTreeMap::from([
23 ("id".to_string(), Value::from("cust_3142")),
24 ("name".to_string(), Value::from("Mary")),
25 ]),
26 ]),
27 ),
28 );
29 let configuration = datadog::Configuration::new();
30 let api = ActionsDatastoresAPI::with_config(configuration);
31 let resp = api
32 .bulk_write_datastore_items(datastore_data_id.clone(), body)
33 .await;
34 if let Ok(value) = resp {
35 println!("{:#?}", value);
36 } else {
37 println!("{:#?}", resp.unwrap_err());
38 }
39}