v1_logs_pipelines_CreateLogsPipeline_1271012410/
v1_logs-pipelines_CreateLogsPipeline_1271012410.rs1use datadog_api_client::datadog;
3use datadog_api_client::datadogV1::api_logs_pipelines::LogsPipelinesAPI;
4use datadog_api_client::datadogV1::model::LogsArrayProcessor;
5use datadog_api_client::datadogV1::model::LogsArrayProcessorOperation;
6use datadog_api_client::datadogV1::model::LogsArrayProcessorOperationLength;
7use datadog_api_client::datadogV1::model::LogsArrayProcessorOperationLengthType;
8use datadog_api_client::datadogV1::model::LogsArrayProcessorType;
9use datadog_api_client::datadogV1::model::LogsFilter;
10use datadog_api_client::datadogV1::model::LogsPipeline;
11use datadog_api_client::datadogV1::model::LogsProcessor;
12
13#[tokio::main]
14async fn main() {
15 let body = LogsPipeline::new("testPipelineArrayLength".to_string())
16 .filter(LogsFilter::new().query("source:python".to_string()))
17 .processors(vec![LogsProcessor::LogsArrayProcessor(Box::new(
18 LogsArrayProcessor::new(
19 LogsArrayProcessorOperation::LogsArrayProcessorOperationLength(Box::new(
20 LogsArrayProcessorOperationLength::new(
21 "tags".to_string(),
22 "tagCount".to_string(),
23 LogsArrayProcessorOperationLengthType::LENGTH,
24 ),
25 )),
26 LogsArrayProcessorType::ARRAY_PROCESSOR,
27 )
28 .is_enabled(true)
29 .name("count_tags".to_string()),
30 ))])
31 .tags(vec![]);
32 let configuration = datadog::Configuration::new();
33 let api = LogsPipelinesAPI::with_config(configuration);
34 let resp = api.create_logs_pipeline(body).await;
35 if let Ok(value) = resp {
36 println!("{:#?}", value);
37 } else {
38 println!("{:#?}", resp.unwrap_err());
39 }
40}