Skip to content

Commit f706d79

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add action datastore API (#882)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 90394ef commit f706d79

File tree

104 files changed

+9345
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+9345
-8
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 890 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Bulk write datastore items returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
use datadog_api_client::datadogV2::model::BulkPutAppsDatastoreItemsRequest;
5+
use datadog_api_client::datadogV2::model::BulkPutAppsDatastoreItemsRequestData;
6+
use datadog_api_client::datadogV2::model::BulkPutAppsDatastoreItemsRequestDataAttributes;
7+
use datadog_api_client::datadogV2::model::DatastoreItemsDataType;
8+
use serde_json::Value;
9+
use std::collections::BTreeMap;
10+
11+
#[tokio::main]
12+
async fn main() {
13+
// there is a valid "datastore" in the system
14+
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+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Create datastore returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
use datadog_api_client::datadogV2::model::CreateAppsDatastoreRequest;
5+
use datadog_api_client::datadogV2::model::CreateAppsDatastoreRequestData;
6+
use datadog_api_client::datadogV2::model::CreateAppsDatastoreRequestDataAttributes;
7+
use datadog_api_client::datadogV2::model::DatastoreDataType;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
let body = CreateAppsDatastoreRequest::new().data(
12+
CreateAppsDatastoreRequestData::new(DatastoreDataType::DATASTORES).attributes(
13+
CreateAppsDatastoreRequestDataAttributes::new(
14+
"datastore-name".to_string(),
15+
"primaryKey".to_string(),
16+
),
17+
),
18+
);
19+
let configuration = datadog::Configuration::new();
20+
let api = ActionsDatastoresAPI::with_config(configuration);
21+
let resp = api.create_datastore(body).await;
22+
if let Ok(value) = resp {
23+
println!("{:#?}", value);
24+
} else {
25+
println!("{:#?}", resp.unwrap_err());
26+
}
27+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Delete datastore returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "datastore" in the system
8+
let datastore_data_id = std::env::var("DATASTORE_DATA_ID").unwrap();
9+
let configuration = datadog::Configuration::new();
10+
let api = ActionsDatastoresAPI::with_config(configuration);
11+
let resp = api.delete_datastore(datastore_data_id.clone()).await;
12+
if let Ok(value) = resp {
13+
println!("{:#?}", value);
14+
} else {
15+
println!("{:#?}", resp.unwrap_err());
16+
}
17+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Delete datastore item returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
use datadog_api_client::datadogV2::model::DatastoreItemsDataType;
5+
use datadog_api_client::datadogV2::model::DeleteAppsDatastoreItemRequest;
6+
use datadog_api_client::datadogV2::model::DeleteAppsDatastoreItemRequestData;
7+
use datadog_api_client::datadogV2::model::DeleteAppsDatastoreItemRequestDataAttributes;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
// there is a valid "datastore" in the system
12+
let datastore_data_id = std::env::var("DATASTORE_DATA_ID").unwrap();
13+
let body = DeleteAppsDatastoreItemRequest::new().data(
14+
DeleteAppsDatastoreItemRequestData::new(DatastoreItemsDataType::ITEMS).attributes(
15+
DeleteAppsDatastoreItemRequestDataAttributes::new("test-key".to_string()),
16+
),
17+
);
18+
let configuration = datadog::Configuration::new();
19+
let api = ActionsDatastoresAPI::with_config(configuration);
20+
let resp = api
21+
.delete_datastore_item(datastore_data_id.clone(), body)
22+
.await;
23+
if let Ok(value) = resp {
24+
println!("{:#?}", value);
25+
} else {
26+
println!("{:#?}", resp.unwrap_err());
27+
}
28+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Get datastore returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "datastore" in the system
8+
let datastore_data_id = std::env::var("DATASTORE_DATA_ID").unwrap();
9+
let configuration = datadog::Configuration::new();
10+
let api = ActionsDatastoresAPI::with_config(configuration);
11+
let resp = api.get_datastore(datastore_data_id.clone()).await;
12+
if let Ok(value) = resp {
13+
println!("{:#?}", value);
14+
} else {
15+
println!("{:#?}", resp.unwrap_err());
16+
}
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// List datastore items returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
use datadog_api_client::datadogV2::api_actions_datastores::ListDatastoreItemsOptionalParams;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "datastore" in the system
9+
let datastore_data_id = std::env::var("DATASTORE_DATA_ID").unwrap();
10+
let configuration = datadog::Configuration::new();
11+
let api = ActionsDatastoresAPI::with_config(configuration);
12+
let resp = api
13+
.list_datastore_items(
14+
datastore_data_id.clone(),
15+
ListDatastoreItemsOptionalParams::default(),
16+
)
17+
.await;
18+
if let Ok(value) = resp {
19+
println!("{:#?}", value);
20+
} else {
21+
println!("{:#?}", resp.unwrap_err());
22+
}
23+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// List datastores returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = ActionsDatastoresAPI::with_config(configuration);
9+
let resp = api.list_datastores().await;
10+
if let Ok(value) = resp {
11+
println!("{:#?}", value);
12+
} else {
13+
println!("{:#?}", resp.unwrap_err());
14+
}
15+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Update datastore returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
use datadog_api_client::datadogV2::model::DatastoreDataType;
5+
use datadog_api_client::datadogV2::model::UpdateAppsDatastoreRequest;
6+
use datadog_api_client::datadogV2::model::UpdateAppsDatastoreRequestData;
7+
use datadog_api_client::datadogV2::model::UpdateAppsDatastoreRequestDataAttributes;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
// there is a valid "datastore" in the system
12+
let datastore_data_id = std::env::var("DATASTORE_DATA_ID").unwrap();
13+
let body = UpdateAppsDatastoreRequest::new().data(
14+
UpdateAppsDatastoreRequestData::new(DatastoreDataType::DATASTORES)
15+
.attributes(
16+
UpdateAppsDatastoreRequestDataAttributes::new().name("updated name".to_string()),
17+
)
18+
.id(datastore_data_id.clone()),
19+
);
20+
let configuration = datadog::Configuration::new();
21+
let api = ActionsDatastoresAPI::with_config(configuration);
22+
let resp = api.update_datastore(datastore_data_id.clone(), body).await;
23+
if let Ok(value) = resp {
24+
println!("{:#?}", value);
25+
} else {
26+
println!("{:#?}", resp.unwrap_err());
27+
}
28+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Update datastore item returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_actions_datastores::ActionsDatastoresAPI;
4+
use datadog_api_client::datadogV2::model::UpdateAppsDatastoreItemRequest;
5+
use datadog_api_client::datadogV2::model::UpdateAppsDatastoreItemRequestData;
6+
use datadog_api_client::datadogV2::model::UpdateAppsDatastoreItemRequestDataAttributes;
7+
use datadog_api_client::datadogV2::model::UpdateAppsDatastoreItemRequestDataAttributesItemChanges;
8+
use datadog_api_client::datadogV2::model::UpdateAppsDatastoreItemRequestDataType;
9+
10+
#[tokio::main]
11+
async fn main() {
12+
// there is a valid "datastore" in the system
13+
let datastore_data_id = std::env::var("DATASTORE_DATA_ID").unwrap();
14+
let body = UpdateAppsDatastoreItemRequest::new().data(
15+
UpdateAppsDatastoreItemRequestData::new(UpdateAppsDatastoreItemRequestDataType::ITEMS)
16+
.attributes(UpdateAppsDatastoreItemRequestDataAttributes::new(
17+
UpdateAppsDatastoreItemRequestDataAttributesItemChanges::new(),
18+
"test-key".to_string(),
19+
)),
20+
);
21+
let configuration = datadog::Configuration::new();
22+
let api = ActionsDatastoresAPI::with_config(configuration);
23+
let resp = api
24+
.update_datastore_item(datastore_data_id.clone(), body)
25+
.await;
26+
if let Ok(value) = resp {
27+
println!("{:#?}", value);
28+
} else {
29+
println!("{:#?}", resp.unwrap_err());
30+
}
31+
}

0 commit comments

Comments
 (0)