v2_ci_visibility_pipelines_AggregateCIAppPipelineEvents/
v2_ci-visibility-pipelines_AggregateCIAppPipelineEvents.rs1use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_ci_visibility_pipelines::CIVisibilityPipelinesAPI;
4use datadog_api_client::datadogV2::model::CIAppAggregationFunction;
5use datadog_api_client::datadogV2::model::CIAppCompute;
6use datadog_api_client::datadogV2::model::CIAppComputeType;
7use datadog_api_client::datadogV2::model::CIAppGroupByTotal;
8use datadog_api_client::datadogV2::model::CIAppPipelinesAggregateRequest;
9use datadog_api_client::datadogV2::model::CIAppPipelinesGroupBy;
10use datadog_api_client::datadogV2::model::CIAppPipelinesQueryFilter;
11use datadog_api_client::datadogV2::model::CIAppQueryOptions;
12
13#[tokio::main]
14async fn main() {
15 let body = CIAppPipelinesAggregateRequest::new()
16 .compute(vec![CIAppCompute::new(
17 CIAppAggregationFunction::PERCENTILE_90,
18 )
19 .metric("@duration".to_string())
20 .type_(CIAppComputeType::TOTAL)])
21 .filter(
22 CIAppPipelinesQueryFilter::new()
23 .from("now-15m".to_string())
24 .query("@ci.provider.name:(gitlab OR github)".to_string())
25 .to("now".to_string()),
26 )
27 .group_by(vec![CIAppPipelinesGroupBy::new("@ci.status".to_string())
28 .limit(10)
29 .total(CIAppGroupByTotal::CIAppGroupByTotalBoolean(false))])
30 .options(CIAppQueryOptions::new().timezone("GMT".to_string()));
31 let configuration = datadog::Configuration::new();
32 let api = CIVisibilityPipelinesAPI::with_config(configuration);
33 let resp = api.aggregate_ci_app_pipeline_events(body).await;
34 if let Ok(value) = resp {
35 println!("{:#?}", value);
36 } else {
37 println!("{:#?}", resp.unwrap_err());
38 }
39}