v2_ci_visibility_pipelines_SearchCIAppPipelineEvents_3246135003/
v2_ci-visibility-pipelines_SearchCIAppPipelineEvents_3246135003.rs

1// Search pipelines events returns "OK" response with pagination
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_ci_visibility_pipelines::CIVisibilityPipelinesAPI;
4use datadog_api_client::datadogV2::api_ci_visibility_pipelines::SearchCIAppPipelineEventsOptionalParams;
5use datadog_api_client::datadogV2::model::CIAppPipelineEventsRequest;
6use datadog_api_client::datadogV2::model::CIAppPipelinesQueryFilter;
7use datadog_api_client::datadogV2::model::CIAppQueryOptions;
8use datadog_api_client::datadogV2::model::CIAppQueryPageOptions;
9use datadog_api_client::datadogV2::model::CIAppSort;
10use futures_util::pin_mut;
11use futures_util::stream::StreamExt;
12
13#[tokio::main]
14async fn main() {
15    let body = CIAppPipelineEventsRequest::new()
16        .filter(
17            CIAppPipelinesQueryFilter::new()
18                .from("now-30s".to_string())
19                .to("now".to_string()),
20        )
21        .options(CIAppQueryOptions::new().timezone("GMT".to_string()))
22        .page(CIAppQueryPageOptions::new().limit(2))
23        .sort(CIAppSort::TIMESTAMP_ASCENDING);
24    let configuration = datadog::Configuration::new();
25    let api = CIVisibilityPipelinesAPI::with_config(configuration);
26    let response = api.search_ci_app_pipeline_events_with_pagination(
27        SearchCIAppPipelineEventsOptionalParams::default().body(body),
28    );
29    pin_mut!(response);
30    while let Some(resp) = response.next().await {
31        if let Ok(value) = resp {
32            println!("{:#?}", value);
33        } else {
34            println!("{:#?}", resp.unwrap_err());
35        }
36    }
37}