Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add num_flex_logs_retention_days field to logs_indexes api spec #2119

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-08-26 18:14:51.589283",
"spec_repo_commit": "0857d88a"
"regenerated": "2024-08-27 12:12:27.969266",
"spec_repo_commit": "09daef2e"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-08-26 18:14:51.607938",
"spec_repo_commit": "0857d88a"
"regenerated": "2024-08-27 12:12:27.987178",
"spec_repo_commit": "09daef2e"
}
}
}
54 changes: 44 additions & 10 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5576,11 +5576,27 @@ components:
description: The name of the index.
example: main
type: string
num_flex_logs_retention_days:
description: 'The total number of days logs are stored in Standard and Flex
Tier before being deleted from the index.

If Standard Tier is enabled on this index, logs are first retained in
Standard Tier for the number of days specified through `num_retention_days`,

and then stored in Flex Tier until the number of days specified in `num_flex_logs_retention_days`
is reached.

The available values depend on retention plans specified in your organization''s
contract/subscriptions.'
example: 360
format: int64
type: integer
num_retention_days:
description: 'The number of days before logs are deleted from this index.
Available values depend on
description: 'The number of days logs are stored in Standard Tier before
aging into the Flex Tier or being deleted from the index.

retention plans specified in your organization''s contract/subscriptions.'
The available values depend on retention plans specified in your organization''s
contract/subscriptions.'
example: 15
format: int64
type: integer
Expand Down Expand Up @@ -5639,17 +5655,35 @@ components:
type: array
filter:
$ref: '#/components/schemas/LogsFilter'
num_retention_days:
description: 'The number of days before logs are deleted from this index.
Available values depend on
num_flex_logs_retention_days:
description: 'The total number of days logs are stored in Standard and Flex
Tier before being deleted from the index.

If Standard Tier is enabled on this index, logs are first retained in
Standard Tier for the number of days specified through `num_retention_days`,

retention plans specified in your organization''s contract/subscriptions.
and then stored in Flex Tier until the number of days specified in `num_flex_logs_retention_days`
is reached.

The available values depend on retention plans specified in your organization''s
contract/subscriptions.


**Note**: Changing this value affects all logs already in this index.
It may also affect billing.'
example: 360
format: int64
type: integer
num_retention_days:
description: 'The number of days logs are stored in Standard Tier before
aging into the Flex Tier or being deleted from the index.

The available values depend on retention plans specified in your organization''s
contract/subscriptions.

**Note:** Changing the retention for an index adjusts the length of retention
for all logs

already in this index. It may also affect billing.'
**Note**: Changing this value affects all logs already in this index.
It may also affect billing.'
example: 15
format: int64
type: integer
Expand Down
1 change: 1 addition & 0 deletions examples/v1/logs-indexes/CreateLogsIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
query="source:python",
),
name="main",
num_flex_logs_retention_days=360,
num_retention_days=15,
)

Expand Down
1 change: 1 addition & 0 deletions examples/v1/logs-indexes/UpdateLogsIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
filter=LogsFilter(
query="source:python",
),
num_flex_logs_retention_days=360,
num_retention_days=15,
)

Expand Down
15 changes: 13 additions & 2 deletions src/datadog_api_client/v1/model/logs_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def openapi_types(_):
"filter": (LogsFilter,),
"is_rate_limited": (bool,),
"name": (str,),
"num_flex_logs_retention_days": (int,),
"num_retention_days": (int,),
}

Expand All @@ -52,6 +53,7 @@ def openapi_types(_):
"filter": "filter",
"is_rate_limited": "is_rate_limited",
"name": "name",
"num_flex_logs_retention_days": "num_flex_logs_retention_days",
"num_retention_days": "num_retention_days",
}
read_only_vars = {
Expand All @@ -67,6 +69,7 @@ def __init__(
daily_limit_warning_threshold_percentage: Union[float, UnsetType] = unset,
exclusion_filters: Union[List[LogsExclusion], UnsetType] = unset,
is_rate_limited: Union[bool, UnsetType] = unset,
num_flex_logs_retention_days: Union[int, UnsetType] = unset,
num_retention_days: Union[int, UnsetType] = unset,
**kwargs,
):
Expand Down Expand Up @@ -97,8 +100,14 @@ def __init__(
:param name: The name of the index.
:type name: str

:param num_retention_days: The number of days before logs are deleted from this index. Available values depend on
retention plans specified in your organization's contract/subscriptions.
:param num_flex_logs_retention_days: The total number of days logs are stored in Standard and Flex Tier before being deleted from the index.
If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through ``num_retention_days`` ,
and then stored in Flex Tier until the number of days specified in ``num_flex_logs_retention_days`` is reached.
The available values depend on retention plans specified in your organization's contract/subscriptions.
:type num_flex_logs_retention_days: int, optional

: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.
The available values depend on retention plans specified in your organization's contract/subscriptions.
:type num_retention_days: int, optional
"""
if daily_limit is not unset:
Expand All @@ -111,6 +120,8 @@ def __init__(
kwargs["exclusion_filters"] = exclusion_filters
if is_rate_limited is not unset:
kwargs["is_rate_limited"] = is_rate_limited
if num_flex_logs_retention_days is not unset:
kwargs["num_flex_logs_retention_days"] = num_flex_logs_retention_days
if num_retention_days is not unset:
kwargs["num_retention_days"] = num_retention_days
super().__init__(kwargs)
Expand Down
20 changes: 16 additions & 4 deletions src/datadog_api_client/v1/model/logs_index_update_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def openapi_types(_):
"disable_daily_limit": (bool,),
"exclusion_filters": ([LogsExclusion],),
"filter": (LogsFilter,),
"num_flex_logs_retention_days": (int,),
"num_retention_days": (int,),
}

Expand All @@ -50,6 +51,7 @@ def openapi_types(_):
"disable_daily_limit": "disable_daily_limit",
"exclusion_filters": "exclusion_filters",
"filter": "filter",
"num_flex_logs_retention_days": "num_flex_logs_retention_days",
"num_retention_days": "num_retention_days",
}

Expand All @@ -61,6 +63,7 @@ def __init__(
daily_limit_warning_threshold_percentage: Union[float, UnsetType] = unset,
disable_daily_limit: Union[bool, UnsetType] = unset,
exclusion_filters: Union[List[LogsExclusion], UnsetType] = unset,
num_flex_logs_retention_days: Union[int, UnsetType] = unset,
num_retention_days: Union[int, UnsetType] = unset,
**kwargs,
):
Expand Down Expand Up @@ -89,11 +92,18 @@ def __init__(
:param filter: Filter for logs.
:type filter: LogsFilter

:param num_retention_days: The number of days before logs are deleted from this index. Available values depend on
retention plans specified in your organization's contract/subscriptions.
:param num_flex_logs_retention_days: The total number of days logs are stored in Standard and Flex Tier before being deleted from the index.
If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through ``num_retention_days`` ,
and then stored in Flex Tier until the number of days specified in ``num_flex_logs_retention_days`` is reached.
The available values depend on retention plans specified in your organization's contract/subscriptions.

**Note:** Changing the retention for an index adjusts the length of retention for all logs
already in this index. It may also affect billing.
**Note** : Changing this value affects all logs already in this index. It may also affect billing.
:type num_flex_logs_retention_days: int, optional

: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.
The available values depend on retention plans specified in your organization's contract/subscriptions.

**Note** : Changing this value affects all logs already in this index. It may also affect billing.
:type num_retention_days: int, optional
"""
if daily_limit is not unset:
Expand All @@ -106,6 +116,8 @@ def __init__(
kwargs["disable_daily_limit"] = disable_daily_limit
if exclusion_filters is not unset:
kwargs["exclusion_filters"] = exclusion_filters
if num_flex_logs_retention_days is not unset:
kwargs["num_flex_logs_retention_days"] = num_flex_logs_retention_days
if num_retention_days is not unset:
kwargs["num_retention_days"] = num_retention_days
super().__init__(kwargs)
Expand Down
8 changes: 4 additions & 4 deletions tests/v1/features/logs_indexes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Feature: Logs Indexes
@generated @skip @team:DataDog/logs-backend
Scenario: Create an index returns "Invalid Parameter Error" response
Given new "CreateLogsIndex" request
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_retention_days": 15}
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}
When the request is sent
Then the response status is 400 Invalid Parameter Error

@generated @skip @team:DataDog/logs-backend
Scenario: Create an index returns "OK" response
Given new "CreateLogsIndex" request
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_retention_days": 15}
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}
When the request is sent
Then the response status is 200 OK

Expand Down Expand Up @@ -53,15 +53,15 @@ Feature: Logs Indexes
Scenario: Update an index returns "Invalid Parameter Error" response
Given new "UpdateLogsIndex" request
And request contains "name" parameter from "REPLACE.ME"
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_retention_days": 15}
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}
When the request is sent
Then the response status is 400 Invalid Parameter Error

@generated @skip @team:DataDog/logs-backend
Scenario: Update an index returns "OK" response
Given new "UpdateLogsIndex" request
And request contains "name" parameter from "REPLACE.ME"
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_retention_days": 15}
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}
When the request is sent
Then the response status is 200 OK

Expand Down
Loading