Skip to content

Commit eedb307

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add tags support to Logs Indexes API (#3110)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent abe3f4d commit eedb307

6 files changed

Lines changed: 49 additions & 5 deletions

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6152,6 +6152,16 @@ components:
61526152
example: 15
61536153
format: int64
61546154
type: integer
6155+
tags:
6156+
description: A list of tags associated with the index. Tags must be in `key:value`
6157+
format.
6158+
example:
6159+
- team:backend
6160+
- env:production
6161+
items:
6162+
description: A single tag using the format `key:value`.
6163+
type: string
6164+
type: array
61556165
required:
61566166
- name
61576167
- filter
@@ -6239,6 +6249,16 @@ components:
62396249
example: 15
62406250
format: int64
62416251
type: integer
6252+
tags:
6253+
description: A list of tags associated with the index. Tags must be in `key:value`
6254+
format.
6255+
example:
6256+
- team:backend
6257+
- env:production
6258+
items:
6259+
description: A single tag using the format `key:value`.
6260+
type: string
6261+
type: array
62426262
required:
62436263
- filter
62446264
type: object

examples/v1/logs-indexes/CreateLogsIndex.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
name="main",
3333
num_flex_logs_retention_days=360,
3434
num_retention_days=15,
35+
tags=[
36+
"team:backend",
37+
"env:production",
38+
],
3539
)
3640

3741
configuration = Configuration()

examples/v1/logs-indexes/UpdateLogsIndex.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
),
3333
num_flex_logs_retention_days=360,
3434
num_retention_days=15,
35+
tags=[
36+
"team:backend",
37+
"env:production",
38+
],
3539
)
3640

3741
configuration = Configuration()

src/datadog_api_client/v1/model/logs_index.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def openapi_types(_):
4343
"name": (str,),
4444
"num_flex_logs_retention_days": (int,),
4545
"num_retention_days": (int,),
46+
"tags": ([str],),
4647
}
4748

4849
attribute_map = {
@@ -55,6 +56,7 @@ def openapi_types(_):
5556
"name": "name",
5657
"num_flex_logs_retention_days": "num_flex_logs_retention_days",
5758
"num_retention_days": "num_retention_days",
59+
"tags": "tags",
5860
}
5961
read_only_vars = {
6062
"is_rate_limited",
@@ -71,6 +73,7 @@ def __init__(
7173
is_rate_limited: Union[bool, UnsetType] = unset,
7274
num_flex_logs_retention_days: Union[int, UnsetType] = unset,
7375
num_retention_days: Union[int, UnsetType] = unset,
76+
tags: Union[List[str], UnsetType] = unset,
7477
**kwargs,
7578
):
7679
"""
@@ -109,6 +112,9 @@ def __init__(
109112
:param num_retention_days: The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index.
110113
The available values depend on retention plans specified in your organization's contract/subscriptions.
111114
:type num_retention_days: int, optional
115+
116+
:param tags: A list of tags associated with the index. Tags must be in ``key:value`` format.
117+
:type tags: [str], optional
112118
"""
113119
if daily_limit is not unset:
114120
kwargs["daily_limit"] = daily_limit
@@ -124,6 +130,8 @@ def __init__(
124130
kwargs["num_flex_logs_retention_days"] = num_flex_logs_retention_days
125131
if num_retention_days is not unset:
126132
kwargs["num_retention_days"] = num_retention_days
133+
if tags is not unset:
134+
kwargs["tags"] = tags
127135
super().__init__(kwargs)
128136

129137
self_.filter = filter

src/datadog_api_client/v1/model/logs_index_update_request.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def openapi_types(_):
4242
"filter": (LogsFilter,),
4343
"num_flex_logs_retention_days": (int,),
4444
"num_retention_days": (int,),
45+
"tags": ([str],),
4546
}
4647

4748
attribute_map = {
@@ -53,6 +54,7 @@ def openapi_types(_):
5354
"filter": "filter",
5455
"num_flex_logs_retention_days": "num_flex_logs_retention_days",
5556
"num_retention_days": "num_retention_days",
57+
"tags": "tags",
5658
}
5759

5860
def __init__(
@@ -65,6 +67,7 @@ def __init__(
6567
exclusion_filters: Union[List[LogsExclusion], UnsetType] = unset,
6668
num_flex_logs_retention_days: Union[int, UnsetType] = unset,
6769
num_retention_days: Union[int, UnsetType] = unset,
70+
tags: Union[List[str], UnsetType] = unset,
6871
**kwargs,
6972
):
7073
"""
@@ -105,6 +108,9 @@ def __init__(
105108
106109
**Note** : Changing this value affects all logs already in this index. It may also affect billing.
107110
:type num_retention_days: int, optional
111+
112+
:param tags: A list of tags associated with the index. Tags must be in ``key:value`` format.
113+
:type tags: [str], optional
108114
"""
109115
if daily_limit is not unset:
110116
kwargs["daily_limit"] = daily_limit
@@ -120,6 +126,8 @@ def __init__(
120126
kwargs["num_flex_logs_retention_days"] = num_flex_logs_retention_days
121127
if num_retention_days is not unset:
122128
kwargs["num_retention_days"] = num_retention_days
129+
if tags is not unset:
130+
kwargs["tags"] = tags
123131
super().__init__(kwargs)
124132

125133
self_.filter = filter

tests/v1/features/logs_indexes.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ Feature: Logs Indexes
1111
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
1212
Scenario: Create an index returns "Invalid Parameter Error" response
1313
Given new "CreateLogsIndex" request
14-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15}
14+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
1515
When the request is sent
1616
Then the response status is 400 Invalid Parameter Error
1717

1818
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
1919
Scenario: Create an index returns "OK" response
2020
Given new "CreateLogsIndex" request
21-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15}
21+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
2222
When the request is sent
2323
Then the response status is 200 OK
2424

2525
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
2626
Scenario: Create an index returns "Unprocessable Entity" response
2727
Given new "CreateLogsIndex" request
28-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15}
28+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
2929
When the request is sent
3030
Then the response status is 422 Unprocessable Entity
3131

@@ -73,15 +73,15 @@ Feature: Logs Indexes
7373
Scenario: Update an index returns "Invalid Parameter Error" response
7474
Given new "UpdateLogsIndex" request
7575
And request contains "name" parameter from "REPLACE.ME"
76-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15}
76+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
7777
When the request is sent
7878
Then the response status is 400 Invalid Parameter Error
7979

8080
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
8181
Scenario: Update an index returns "OK" response
8282
Given new "UpdateLogsIndex" request
8383
And request contains "name" parameter from "REPLACE.ME"
84-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15}
84+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
8585
When the request is sent
8686
Then the response status is 200 OK
8787

0 commit comments

Comments
 (0)