v2_ci_visibility_pipelines_SearchCIAppPipelineEvents/
v2_ci-visibility-pipelines_SearchCIAppPipelineEvents.rs1use 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;
10
11#[tokio::main]
12async fn main() {
13 let body = CIAppPipelineEventsRequest::new()
14 .filter(
15 CIAppPipelinesQueryFilter::new()
16 .from("now-15m".to_string())
17 .query("@ci.provider.name:github AND @ci.status:error".to_string())
18 .to("now".to_string()),
19 )
20 .options(CIAppQueryOptions::new().timezone("GMT".to_string()))
21 .page(CIAppQueryPageOptions::new().limit(5))
22 .sort(CIAppSort::TIMESTAMP_ASCENDING);
23 let configuration = datadog::Configuration::new();
24 let api = CIVisibilityPipelinesAPI::with_config(configuration);
25 let resp = api
26 .search_ci_app_pipeline_events(
27 SearchCIAppPipelineEventsOptionalParams::default().body(body),
28 )
29 .await;
30 if let Ok(value) = resp {
31 println!("{:#?}", value);
32 } else {
33 println!("{:#?}", resp.unwrap_err());
34 }
35}