v2_ci_visibility_pipelines_ListCIAppPipelineEvents/
v2_ci-visibility-pipelines_ListCIAppPipelineEvents.rs

1// Get a list of pipelines events returns "OK" response
2use chrono::{DateTime, Utc};
3use datadog_api_client::datadog;
4use datadog_api_client::datadogV2::api_ci_visibility_pipelines::CIVisibilityPipelinesAPI;
5use datadog_api_client::datadogV2::api_ci_visibility_pipelines::ListCIAppPipelineEventsOptionalParams;
6
7#[tokio::main]
8async fn main() {
9    let configuration = datadog::Configuration::new();
10    let api = CIVisibilityPipelinesAPI::with_config(configuration);
11    let resp = api
12        .list_ci_app_pipeline_events(
13            ListCIAppPipelineEventsOptionalParams::default()
14                .filter_query("@ci.provider.name:circleci".to_string())
15                .filter_from(
16                    DateTime::parse_from_rfc3339("2021-11-11T10:41:11+00:00")
17                        .expect("Failed to parse datetime")
18                        .with_timezone(&Utc),
19                )
20                .filter_to(
21                    DateTime::parse_from_rfc3339("2021-11-11T11:11:11+00:00")
22                        .expect("Failed to parse datetime")
23                        .with_timezone(&Utc),
24                )
25                .page_limit(5),
26        )
27        .await;
28    if let Ok(value) = resp {
29        println!("{:#?}", value);
30    } else {
31        println!("{:#?}", resp.unwrap_err());
32    }
33}