v1_logs_indexes_UpdateLogsIndex/
v1_logs-indexes_UpdateLogsIndex.rs

1// Update an index returns "OK" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV1::api_logs_indexes::LogsIndexesAPI;
4use datadog_api_client::datadogV1::model::LogsDailyLimitReset;
5use datadog_api_client::datadogV1::model::LogsExclusion;
6use datadog_api_client::datadogV1::model::LogsExclusionFilter;
7use datadog_api_client::datadogV1::model::LogsFilter;
8use datadog_api_client::datadogV1::model::LogsIndexUpdateRequest;
9
10#[tokio::main]
11async fn main() {
12    let body = LogsIndexUpdateRequest::new(LogsFilter::new().query("source:python".to_string()))
13        .daily_limit(300000000)
14        .daily_limit_reset(
15            LogsDailyLimitReset::new()
16                .reset_time("14:00".to_string())
17                .reset_utc_offset("+02:00".to_string()),
18        )
19        .daily_limit_warning_threshold_percentage(70.0 as f64)
20        .disable_daily_limit(false)
21        .exclusion_filters(vec![LogsExclusion::new("payment".to_string())
22            .filter(LogsExclusionFilter::new(1.0).query("*".to_string()))])
23        .num_flex_logs_retention_days(360)
24        .num_retention_days(15);
25    let configuration = datadog::Configuration::new();
26    let api = LogsIndexesAPI::with_config(configuration);
27    let resp = api.update_logs_index("name".to_string(), body).await;
28    if let Ok(value) = resp {
29        println!("{:#?}", value);
30    } else {
31        println!("{:#?}", resp.unwrap_err());
32    }
33}