v2_dora_metrics_ListDORADeployments/
v2_dora-metrics_ListDORADeployments.rs

1// Get a list of deployment events returns "OK" response
2use chrono::{DateTime, Utc};
3use datadog_api_client::datadog;
4use datadog_api_client::datadogV2::api_dora_metrics::DORAMetricsAPI;
5use datadog_api_client::datadogV2::model::DORAListDeploymentsRequest;
6use datadog_api_client::datadogV2::model::DORAListDeploymentsRequestAttributes;
7use datadog_api_client::datadogV2::model::DORAListDeploymentsRequestData;
8use datadog_api_client::datadogV2::model::DORAListDeploymentsRequestDataType;
9
10#[tokio::main]
11async fn main() {
12    let body = DORAListDeploymentsRequest::new(
13        DORAListDeploymentsRequestData::new(
14            DORAListDeploymentsRequestAttributes::new()
15                .from(
16                    DateTime::parse_from_rfc3339("2025-03-23T00:00:00+00:00")
17                        .expect("Failed to parse datetime")
18                        .with_timezone(&Utc),
19                )
20                .limit(1)
21                .to(DateTime::parse_from_rfc3339("2025-03-24T00:00:00+00:00")
22                    .expect("Failed to parse datetime")
23                    .with_timezone(&Utc)),
24        )
25        .type_(DORAListDeploymentsRequestDataType::DORA_DEPLOYMENTS_LIST_REQUEST),
26    );
27    let configuration = datadog::Configuration::new();
28    let api = DORAMetricsAPI::with_config(configuration);
29    let resp = api.list_dora_deployments(body).await;
30    if let Ok(value) = resp {
31        println!("{:#?}", value);
32    } else {
33        println!("{:#?}", resp.unwrap_err());
34    }
35}