Skip to content

Commit 2000cfc

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add log autosubscription tag filters config to aws v2 API (#824)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 07b2c7a commit 2000cfc

File tree

47 files changed

+430
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+430
-101
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "fd3370f",
3-
"generated": "2025-08-06 20:59:11.792"
2+
"spec_repo_commit": "c5cca50",
3+
"generated": "2025-08-07 18:08:43.875"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,8 @@ components:
16251625
example: arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder
16261626
type: string
16271627
type: array
1628+
log_source_config:
1629+
$ref: '#/components/schemas/AWSLambdaForwarderConfigLogSourceConfig'
16281630
sources:
16291631
description: 'List of service IDs set to enable automatic log collection.
16301632
Discover the list of available services with the
@@ -1636,6 +1638,44 @@ components:
16361638
type: string
16371639
type: array
16381640
type: object
1641+
AWSLambdaForwarderConfigLogSourceConfig:
1642+
description: Log source configuration.
1643+
properties:
1644+
tag_filters:
1645+
description: List of AWS log source tag filters. Defaults to `[]`.
1646+
items:
1647+
$ref: '#/components/schemas/AWSLogSourceTagFilter'
1648+
type: array
1649+
type: object
1650+
AWSLogSourceTagFilter:
1651+
description: 'AWS log source tag filter list. Defaults to `[]`.
1652+
1653+
Array of log source to AWS resource tag mappings. Each mapping contains a
1654+
log source and its associated AWS resource tags (in `key:value` format) used
1655+
to filter logs submitted to Datadog.
1656+
1657+
Tag filters are applied for tags on the AWS resource emitting logs; tags associated
1658+
with the log storage entity (such as a CloudWatch Log Group or S3 Bucket)
1659+
are not considered.
1660+
1661+
For more information on resource tag filter syntax, [see AWS resource exclusion](https://docs.datadoghq.com/account_management/billing/aws/#aws-resource-exclusion)
1662+
in the AWS integration billing page.'
1663+
properties:
1664+
source:
1665+
description: The AWS log source to which the tag filters defined in `tags`
1666+
are applied.
1667+
example: s3
1668+
type: string
1669+
tags:
1670+
description: The AWS resource tags to filter on for the log source specified
1671+
by `source`.
1672+
items:
1673+
description: Tag in the form `key:value`.
1674+
example: env:prod
1675+
type: string
1676+
nullable: true
1677+
type: array
1678+
type: object
16391679
AWSLogsConfig:
16401680
description: AWS Logs Collection config.
16411681
properties:

examples/v2_aws-integration_CreateAWSAccount.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use datadog_api_client::datadogV2::model::AWSAccountType;
99
use datadog_api_client::datadogV2::model::AWSAuthConfig;
1010
use datadog_api_client::datadogV2::model::AWSAuthConfigKeys;
1111
use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfig;
12+
use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfigLogSourceConfig;
13+
use datadog_api_client::datadogV2::model::AWSLogSourceTagFilter;
1214
use datadog_api_client::datadogV2::model::AWSLogsConfig;
1315
use datadog_api_client::datadogV2::model::AWSMetricsConfig;
1416
use datadog_api_client::datadogV2::model::AWSNamespaceTagFilter;
@@ -34,6 +36,13 @@ async fn main() {
3436
"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"
3537
.to_string(),
3638
])
39+
.log_source_config(AWSLambdaForwarderConfigLogSourceConfig::new().tag_filters(
40+
vec![
41+
AWSLogSourceTagFilter::new()
42+
.source("s3".to_string())
43+
.tags(Some(vec!["test:test".to_string()]))
44+
],
45+
))
3746
.sources(vec!["s3".to_string()]),
3847
),
3948
)

examples/v2_aws-integration_CreateAWSAccount_1716720881.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use datadog_api_client::datadogV2::model::AWSAccountType;
99
use datadog_api_client::datadogV2::model::AWSAuthConfig;
1010
use datadog_api_client::datadogV2::model::AWSAuthConfigRole;
1111
use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfig;
12+
use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfigLogSourceConfig;
13+
use datadog_api_client::datadogV2::model::AWSLogSourceTagFilter;
1214
use datadog_api_client::datadogV2::model::AWSLogsConfig;
1315
use datadog_api_client::datadogV2::model::AWSMetricsConfig;
1416
use datadog_api_client::datadogV2::model::AWSNamespaceTagFilter;
@@ -33,6 +35,13 @@ async fn main() {
3335
"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"
3436
.to_string(),
3537
])
38+
.log_source_config(AWSLambdaForwarderConfigLogSourceConfig::new().tag_filters(
39+
vec![
40+
AWSLogSourceTagFilter::new()
41+
.source("s3".to_string())
42+
.tags(Some(vec!["test:test".to_string()]))
43+
],
44+
))
3645
.sources(vec!["s3".to_string()]),
3746
),
3847
)

examples/v2_aws-integration_UpdateAWSAccount.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use datadog_api_client::datadogV2::model::AWSAccountUpdateRequestData;
99
use datadog_api_client::datadogV2::model::AWSAuthConfig;
1010
use datadog_api_client::datadogV2::model::AWSAuthConfigRole;
1111
use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfig;
12+
use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfigLogSourceConfig;
13+
use datadog_api_client::datadogV2::model::AWSLogSourceTagFilter;
1214
use datadog_api_client::datadogV2::model::AWSLogsConfig;
1315
use datadog_api_client::datadogV2::model::AWSMetricsConfig;
1416
use datadog_api_client::datadogV2::model::AWSNamespaceTagFilter;
@@ -39,6 +41,16 @@ async fn main() {
3941
"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder".to_string()
4042
],
4143
)
44+
.log_source_config(
45+
AWSLambdaForwarderConfigLogSourceConfig
46+
::new().tag_filters(
47+
vec![
48+
AWSLogSourceTagFilter::new()
49+
.source("s3".to_string())
50+
.tags(Some(vec!["test:test".to_string()]))
51+
],
52+
),
53+
)
4254
.sources(vec!["s3".to_string()]),
4355
),
4456
)

src/datadogV2/model/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,6 +2284,10 @@ pub mod model_aws_logs_config;
22842284
pub use self::model_aws_logs_config::AWSLogsConfig;
22852285
pub mod model_aws_lambda_forwarder_config;
22862286
pub use self::model_aws_lambda_forwarder_config::AWSLambdaForwarderConfig;
2287+
pub mod model_aws_lambda_forwarder_config_log_source_config;
2288+
pub use self::model_aws_lambda_forwarder_config_log_source_config::AWSLambdaForwarderConfigLogSourceConfig;
2289+
pub mod model_aws_log_source_tag_filter;
2290+
pub use self::model_aws_log_source_tag_filter::AWSLogSourceTagFilter;
22872291
pub mod model_aws_metrics_config;
22882292
pub use self::model_aws_metrics_config::AWSMetricsConfig;
22892293
pub mod model_aws_namespace_filters_exclude_only;

src/datadogV2/model/model_aws_lambda_forwarder_config.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ pub struct AWSLambdaForwarderConfig {
1515
/// List of Datadog Lambda Log Forwarder ARNs in your AWS account. Defaults to `[]`.
1616
#[serde(rename = "lambdas")]
1717
pub lambdas: Option<Vec<String>>,
18+
/// Log source configuration.
19+
#[serde(rename = "log_source_config")]
20+
pub log_source_config: Option<crate::datadogV2::model::AWSLambdaForwarderConfigLogSourceConfig>,
1821
/// List of service IDs set to enable automatic log collection. Discover the list of available services with the
1922
/// [Get list of AWS log ready services](<https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services>) endpoint.
2023
#[serde(rename = "sources")]
@@ -30,6 +33,7 @@ impl AWSLambdaForwarderConfig {
3033
pub fn new() -> AWSLambdaForwarderConfig {
3134
AWSLambdaForwarderConfig {
3235
lambdas: None,
36+
log_source_config: None,
3337
sources: None,
3438
additional_properties: std::collections::BTreeMap::new(),
3539
_unparsed: false,
@@ -41,6 +45,14 @@ impl AWSLambdaForwarderConfig {
4145
self
4246
}
4347

48+
pub fn log_source_config(
49+
mut self,
50+
value: crate::datadogV2::model::AWSLambdaForwarderConfigLogSourceConfig,
51+
) -> Self {
52+
self.log_source_config = Some(value);
53+
self
54+
}
55+
4456
pub fn sources(mut self, value: Vec<String>) -> Self {
4557
self.sources = Some(value);
4658
self
@@ -79,6 +91,9 @@ impl<'de> Deserialize<'de> for AWSLambdaForwarderConfig {
7991
M: MapAccess<'a>,
8092
{
8193
let mut lambdas: Option<Vec<String>> = None;
94+
let mut log_source_config: Option<
95+
crate::datadogV2::model::AWSLambdaForwarderConfigLogSourceConfig,
96+
> = None;
8297
let mut sources: Option<Vec<String>> = None;
8398
let mut additional_properties: std::collections::BTreeMap<
8499
String,
@@ -94,6 +109,13 @@ impl<'de> Deserialize<'de> for AWSLambdaForwarderConfig {
94109
}
95110
lambdas = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
96111
}
112+
"log_source_config" => {
113+
if v.is_null() {
114+
continue;
115+
}
116+
log_source_config =
117+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
118+
}
97119
"sources" => {
98120
if v.is_null() {
99121
continue;
@@ -110,6 +132,7 @@ impl<'de> Deserialize<'de> for AWSLambdaForwarderConfig {
110132

111133
let content = AWSLambdaForwarderConfig {
112134
lambdas,
135+
log_source_config,
113136
sources,
114137
additional_properties,
115138
_unparsed,
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// Log source configuration.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct AWSLambdaForwarderConfigLogSourceConfig {
14+
/// List of AWS log source tag filters. Defaults to `[]`.
15+
#[serde(rename = "tag_filters")]
16+
pub tag_filters: Option<Vec<crate::datadogV2::model::AWSLogSourceTagFilter>>,
17+
#[serde(flatten)]
18+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
19+
#[serde(skip)]
20+
#[serde(default)]
21+
pub(crate) _unparsed: bool,
22+
}
23+
24+
impl AWSLambdaForwarderConfigLogSourceConfig {
25+
pub fn new() -> AWSLambdaForwarderConfigLogSourceConfig {
26+
AWSLambdaForwarderConfigLogSourceConfig {
27+
tag_filters: None,
28+
additional_properties: std::collections::BTreeMap::new(),
29+
_unparsed: false,
30+
}
31+
}
32+
33+
pub fn tag_filters(
34+
mut self,
35+
value: Vec<crate::datadogV2::model::AWSLogSourceTagFilter>,
36+
) -> Self {
37+
self.tag_filters = Some(value);
38+
self
39+
}
40+
41+
pub fn additional_properties(
42+
mut self,
43+
value: std::collections::BTreeMap<String, serde_json::Value>,
44+
) -> Self {
45+
self.additional_properties = value;
46+
self
47+
}
48+
}
49+
50+
impl Default for AWSLambdaForwarderConfigLogSourceConfig {
51+
fn default() -> Self {
52+
Self::new()
53+
}
54+
}
55+
56+
impl<'de> Deserialize<'de> for AWSLambdaForwarderConfigLogSourceConfig {
57+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
58+
where
59+
D: Deserializer<'de>,
60+
{
61+
struct AWSLambdaForwarderConfigLogSourceConfigVisitor;
62+
impl<'a> Visitor<'a> for AWSLambdaForwarderConfigLogSourceConfigVisitor {
63+
type Value = AWSLambdaForwarderConfigLogSourceConfig;
64+
65+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
66+
f.write_str("a mapping")
67+
}
68+
69+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
70+
where
71+
M: MapAccess<'a>,
72+
{
73+
let mut tag_filters: Option<Vec<crate::datadogV2::model::AWSLogSourceTagFilter>> =
74+
None;
75+
let mut additional_properties: std::collections::BTreeMap<
76+
String,
77+
serde_json::Value,
78+
> = std::collections::BTreeMap::new();
79+
let mut _unparsed = false;
80+
81+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
82+
match k.as_str() {
83+
"tag_filters" => {
84+
if v.is_null() {
85+
continue;
86+
}
87+
tag_filters =
88+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
89+
}
90+
&_ => {
91+
if let Ok(value) = serde_json::from_value(v.clone()) {
92+
additional_properties.insert(k, value);
93+
}
94+
}
95+
}
96+
}
97+
98+
let content = AWSLambdaForwarderConfigLogSourceConfig {
99+
tag_filters,
100+
additional_properties,
101+
_unparsed,
102+
};
103+
104+
Ok(content)
105+
}
106+
}
107+
108+
deserializer.deserialize_any(AWSLambdaForwarderConfigLogSourceConfigVisitor)
109+
}
110+
}

0 commit comments

Comments
 (0)