Skip to content

Commit 2fae060

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add log autosubscription tag filters config to aws v2 API (#3257)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 02fd1c6 commit 2fae060

File tree

43 files changed

+442
-74
lines changed

Some content is hidden

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

43 files changed

+442
-74
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:55:33.459"
2+
"spec_repo_commit": "c5cca50",
3+
"generated": "2025-08-07 18:05:06.066"
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:

api/datadogV2/model_aws_lambda_forwarder_config.go

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
type AWSLambdaForwarderConfig struct {
1414
// List of Datadog Lambda Log Forwarder ARNs in your AWS account. Defaults to `[]`.
1515
Lambdas []string `json:"lambdas,omitempty"`
16+
// Log source configuration.
17+
LogSourceConfig *AWSLambdaForwarderConfigLogSourceConfig `json:"log_source_config,omitempty"`
1618
// List of service IDs set to enable automatic log collection. Discover the list of available services with the
1719
// [Get list of AWS log ready services](https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services) endpoint.
1820
Sources []string `json:"sources,omitempty"`
@@ -66,6 +68,34 @@ func (o *AWSLambdaForwarderConfig) SetLambdas(v []string) {
6668
o.Lambdas = v
6769
}
6870

71+
// GetLogSourceConfig returns the LogSourceConfig field value if set, zero value otherwise.
72+
func (o *AWSLambdaForwarderConfig) GetLogSourceConfig() AWSLambdaForwarderConfigLogSourceConfig {
73+
if o == nil || o.LogSourceConfig == nil {
74+
var ret AWSLambdaForwarderConfigLogSourceConfig
75+
return ret
76+
}
77+
return *o.LogSourceConfig
78+
}
79+
80+
// GetLogSourceConfigOk returns a tuple with the LogSourceConfig field value if set, nil otherwise
81+
// and a boolean to check if the value has been set.
82+
func (o *AWSLambdaForwarderConfig) GetLogSourceConfigOk() (*AWSLambdaForwarderConfigLogSourceConfig, bool) {
83+
if o == nil || o.LogSourceConfig == nil {
84+
return nil, false
85+
}
86+
return o.LogSourceConfig, true
87+
}
88+
89+
// HasLogSourceConfig returns a boolean if a field has been set.
90+
func (o *AWSLambdaForwarderConfig) HasLogSourceConfig() bool {
91+
return o != nil && o.LogSourceConfig != nil
92+
}
93+
94+
// SetLogSourceConfig gets a reference to the given AWSLambdaForwarderConfigLogSourceConfig and assigns it to the LogSourceConfig field.
95+
func (o *AWSLambdaForwarderConfig) SetLogSourceConfig(v AWSLambdaForwarderConfigLogSourceConfig) {
96+
o.LogSourceConfig = &v
97+
}
98+
6999
// GetSources returns the Sources field value if set, zero value otherwise.
70100
func (o *AWSLambdaForwarderConfig) GetSources() []string {
71101
if o == nil || o.Sources == nil {
@@ -103,6 +133,9 @@ func (o AWSLambdaForwarderConfig) MarshalJSON() ([]byte, error) {
103133
if o.Lambdas != nil {
104134
toSerialize["lambdas"] = o.Lambdas
105135
}
136+
if o.LogSourceConfig != nil {
137+
toSerialize["log_source_config"] = o.LogSourceConfig
138+
}
106139
if o.Sources != nil {
107140
toSerialize["sources"] = o.Sources
108141
}
@@ -116,24 +149,35 @@ func (o AWSLambdaForwarderConfig) MarshalJSON() ([]byte, error) {
116149
// UnmarshalJSON deserializes the given payload.
117150
func (o *AWSLambdaForwarderConfig) UnmarshalJSON(bytes []byte) (err error) {
118151
all := struct {
119-
Lambdas []string `json:"lambdas,omitempty"`
120-
Sources []string `json:"sources,omitempty"`
152+
Lambdas []string `json:"lambdas,omitempty"`
153+
LogSourceConfig *AWSLambdaForwarderConfigLogSourceConfig `json:"log_source_config,omitempty"`
154+
Sources []string `json:"sources,omitempty"`
121155
}{}
122156
if err = datadog.Unmarshal(bytes, &all); err != nil {
123157
return datadog.Unmarshal(bytes, &o.UnparsedObject)
124158
}
125159
additionalProperties := make(map[string]interface{})
126160
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
127-
datadog.DeleteKeys(additionalProperties, &[]string{"lambdas", "sources"})
161+
datadog.DeleteKeys(additionalProperties, &[]string{"lambdas", "log_source_config", "sources"})
128162
} else {
129163
return err
130164
}
165+
166+
hasInvalidField := false
131167
o.Lambdas = all.Lambdas
168+
if all.LogSourceConfig != nil && all.LogSourceConfig.UnparsedObject != nil && o.UnparsedObject == nil {
169+
hasInvalidField = true
170+
}
171+
o.LogSourceConfig = all.LogSourceConfig
132172
o.Sources = all.Sources
133173

134174
if len(additionalProperties) > 0 {
135175
o.AdditionalProperties = additionalProperties
136176
}
137177

178+
if hasInvalidField {
179+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
180+
}
181+
138182
return nil
139183
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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+
5+
package datadogV2
6+
7+
import (
8+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// AWSLambdaForwarderConfigLogSourceConfig Log source configuration.
12+
type AWSLambdaForwarderConfigLogSourceConfig struct {
13+
// List of AWS log source tag filters. Defaults to `[]`.
14+
TagFilters []AWSLogSourceTagFilter `json:"tag_filters,omitempty"`
15+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
16+
UnparsedObject map[string]interface{} `json:"-"`
17+
AdditionalProperties map[string]interface{} `json:"-"`
18+
}
19+
20+
// NewAWSLambdaForwarderConfigLogSourceConfig instantiates a new AWSLambdaForwarderConfigLogSourceConfig object.
21+
// This constructor will assign default values to properties that have it defined,
22+
// and makes sure properties required by API are set, but the set of arguments
23+
// will change when the set of required properties is changed.
24+
func NewAWSLambdaForwarderConfigLogSourceConfig() *AWSLambdaForwarderConfigLogSourceConfig {
25+
this := AWSLambdaForwarderConfigLogSourceConfig{}
26+
return &this
27+
}
28+
29+
// NewAWSLambdaForwarderConfigLogSourceConfigWithDefaults instantiates a new AWSLambdaForwarderConfigLogSourceConfig object.
30+
// This constructor will only assign default values to properties that have it defined,
31+
// but it doesn't guarantee that properties required by API are set.
32+
func NewAWSLambdaForwarderConfigLogSourceConfigWithDefaults() *AWSLambdaForwarderConfigLogSourceConfig {
33+
this := AWSLambdaForwarderConfigLogSourceConfig{}
34+
return &this
35+
}
36+
37+
// GetTagFilters returns the TagFilters field value if set, zero value otherwise.
38+
func (o *AWSLambdaForwarderConfigLogSourceConfig) GetTagFilters() []AWSLogSourceTagFilter {
39+
if o == nil || o.TagFilters == nil {
40+
var ret []AWSLogSourceTagFilter
41+
return ret
42+
}
43+
return o.TagFilters
44+
}
45+
46+
// GetTagFiltersOk returns a tuple with the TagFilters field value if set, nil otherwise
47+
// and a boolean to check if the value has been set.
48+
func (o *AWSLambdaForwarderConfigLogSourceConfig) GetTagFiltersOk() (*[]AWSLogSourceTagFilter, bool) {
49+
if o == nil || o.TagFilters == nil {
50+
return nil, false
51+
}
52+
return &o.TagFilters, true
53+
}
54+
55+
// HasTagFilters returns a boolean if a field has been set.
56+
func (o *AWSLambdaForwarderConfigLogSourceConfig) HasTagFilters() bool {
57+
return o != nil && o.TagFilters != nil
58+
}
59+
60+
// SetTagFilters gets a reference to the given []AWSLogSourceTagFilter and assigns it to the TagFilters field.
61+
func (o *AWSLambdaForwarderConfigLogSourceConfig) SetTagFilters(v []AWSLogSourceTagFilter) {
62+
o.TagFilters = v
63+
}
64+
65+
// MarshalJSON serializes the struct using spec logic.
66+
func (o AWSLambdaForwarderConfigLogSourceConfig) MarshalJSON() ([]byte, error) {
67+
toSerialize := map[string]interface{}{}
68+
if o.UnparsedObject != nil {
69+
return datadog.Marshal(o.UnparsedObject)
70+
}
71+
if o.TagFilters != nil {
72+
toSerialize["tag_filters"] = o.TagFilters
73+
}
74+
75+
for key, value := range o.AdditionalProperties {
76+
toSerialize[key] = value
77+
}
78+
return datadog.Marshal(toSerialize)
79+
}
80+
81+
// UnmarshalJSON deserializes the given payload.
82+
func (o *AWSLambdaForwarderConfigLogSourceConfig) UnmarshalJSON(bytes []byte) (err error) {
83+
all := struct {
84+
TagFilters []AWSLogSourceTagFilter `json:"tag_filters,omitempty"`
85+
}{}
86+
if err = datadog.Unmarshal(bytes, &all); err != nil {
87+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
88+
}
89+
additionalProperties := make(map[string]interface{})
90+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
91+
datadog.DeleteKeys(additionalProperties, &[]string{"tag_filters"})
92+
} else {
93+
return err
94+
}
95+
o.TagFilters = all.TagFilters
96+
97+
if len(additionalProperties) > 0 {
98+
o.AdditionalProperties = additionalProperties
99+
}
100+
101+
return nil
102+
}

0 commit comments

Comments
 (0)