Skip to content

Commit a04ad67

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
[FA] Add fleet automation config update endpoint (#978)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 812b65c commit a04ad67

26 files changed

+2766
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 422 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Cancel a deployment returns "Deployment successfully canceled." response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_fleet_automation::FleetAutomationAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.CancelFleetDeployment", true);
9+
let api = FleetAutomationAPI::with_config(configuration);
10+
let resp = api
11+
.cancel_fleet_deployment("deployment_id".to_string())
12+
.await;
13+
if let Ok(value) = resp {
14+
println!("{:#?}", value);
15+
} else {
16+
println!("{:#?}", resp.unwrap_err());
17+
}
18+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Create a deployment returns "CREATED" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_fleet_automation::FleetAutomationAPI;
4+
use datadog_api_client::datadogV2::model::FleetDeploymentConfigureAttributes;
5+
use datadog_api_client::datadogV2::model::FleetDeploymentConfigureCreate;
6+
use datadog_api_client::datadogV2::model::FleetDeploymentConfigureCreateRequest;
7+
use datadog_api_client::datadogV2::model::FleetDeploymentFileOp;
8+
use datadog_api_client::datadogV2::model::FleetDeploymentOperation;
9+
use datadog_api_client::datadogV2::model::FleetDeploymentResourceType;
10+
use serde_json::Value;
11+
use std::collections::BTreeMap;
12+
13+
#[tokio::main]
14+
async fn main() {
15+
let body = FleetDeploymentConfigureCreateRequest::new(FleetDeploymentConfigureCreate::new(
16+
FleetDeploymentConfigureAttributes::new(vec![FleetDeploymentOperation::new(
17+
FleetDeploymentFileOp::MERGE_PATCH,
18+
"/datadog.yaml".to_string(),
19+
)
20+
.patch(BTreeMap::from([
21+
("log_level".to_string(), Value::from("debug")),
22+
("logs_enabled".to_string(), Value::from("True")),
23+
]))])
24+
.filter_query("env:prod AND service:web".to_string()),
25+
FleetDeploymentResourceType::DEPLOYMENT,
26+
));
27+
let mut configuration = datadog::Configuration::new();
28+
configuration.set_unstable_operation_enabled("v2.CreateFleetDeploymentConfigure", true);
29+
let api = FleetAutomationAPI::with_config(configuration);
30+
let resp = api.create_fleet_deployment_configure(body).await;
31+
if let Ok(value) = resp {
32+
println!("{:#?}", value);
33+
} else {
34+
println!("{:#?}", resp.unwrap_err());
35+
}
36+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Get a deployment by ID returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_fleet_automation::FleetAutomationAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "deployment" in the system
8+
let deployment_id = std::env::var("DEPLOYMENT_ID").unwrap();
9+
let mut configuration = datadog::Configuration::new();
10+
configuration.set_unstable_operation_enabled("v2.GetFleetDeployment", true);
11+
let api = FleetAutomationAPI::with_config(configuration);
12+
let resp = api.get_fleet_deployment(deployment_id.clone()).await;
13+
if let Ok(value) = resp {
14+
println!("{:#?}", value);
15+
} else {
16+
println!("{:#?}", resp.unwrap_err());
17+
}
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// List all deployments returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_fleet_automation::FleetAutomationAPI;
4+
use datadog_api_client::datadogV2::api_fleet_automation::ListFleetDeploymentsOptionalParams;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
let mut configuration = datadog::Configuration::new();
9+
configuration.set_unstable_operation_enabled("v2.ListFleetDeployments", true);
10+
let api = FleetAutomationAPI::with_config(configuration);
11+
let resp = api
12+
.list_fleet_deployments(ListFleetDeploymentsOptionalParams::default())
13+
.await;
14+
if let Ok(value) = resp {
15+
println!("{:#?}", value);
16+
} else {
17+
println!("{:#?}", resp.unwrap_err());
18+
}
19+
}

src/datadog/configuration.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ impl Configuration {
122122
impl Default for Configuration {
123123
fn default() -> Self {
124124
let unstable_operations = HashMap::from([
125+
("v2.cancel_fleet_deployment".to_owned(), false),
126+
("v2.create_fleet_deployment_configure".to_owned(), false),
127+
("v2.get_fleet_deployment".to_owned(), false),
128+
("v2.list_fleet_deployments".to_owned(), false),
125129
("v2.create_open_api".to_owned(), false),
126130
("v2.delete_open_api".to_owned(), false),
127131
("v2.get_open_api".to_owned(), false),

0 commit comments

Comments
 (0)