v2_fleet_automation_CreateFleetDeploymentConfigure/
v2_fleet-automation_CreateFleetDeploymentConfigure.rs

1// Create a deployment returns "CREATED" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_fleet_automation::FleetAutomationAPI;
4use datadog_api_client::datadogV2::model::FleetDeploymentConfigureAttributes;
5use datadog_api_client::datadogV2::model::FleetDeploymentConfigureCreate;
6use datadog_api_client::datadogV2::model::FleetDeploymentConfigureCreateRequest;
7use datadog_api_client::datadogV2::model::FleetDeploymentFileOp;
8use datadog_api_client::datadogV2::model::FleetDeploymentOperation;
9use datadog_api_client::datadogV2::model::FleetDeploymentResourceType;
10use serde_json::Value;
11use std::collections::BTreeMap;
12
13#[tokio::main]
14async 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}