Skip to content

Commit

Permalink
Fix filter indexes parameter in logs search (#1559)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec committed Jul 6, 2023
1 parent d32f982 commit 31c0b7a
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 27 deletions.
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.5",
"regenerated": "2023-07-05 21:53:47.988269",
"spec_repo_commit": "aee1c6e4"
"regenerated": "2023-07-06 20:39:52.417261",
"spec_repo_commit": "45b9e51d"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-07-05 21:53:48.144607",
"spec_repo_commit": "aee1c6e4"
"regenerated": "2023-07-06 20:39:52.441657",
"spec_repo_commit": "45b9e51d"
}
}
}
14 changes: 10 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21255,15 +21255,21 @@ paths:
required: false
schema:
type: string
- description: 'For customers with multiple indexes, the indexes to search
- description: 'For customers with multiple indexes, the indexes to search.

Defaults to ''*'' which means all indexes'
example: main
example:
- main
- web
explode: false
in: query
name: filter[index]
name: filter[indexes]
required: false
schema:
type: string
items:
description: The name of a log index.
type: string
type: array
- description: Minimum timestamp for requested logs.
example: '2019-01-02T09:42:36.320Z'
in: query
Expand Down
4 changes: 3 additions & 1 deletion examples/v2/logs/ListLogsGet_2034110533.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
api_instance = LogsApi(api_client)
response = api_instance.list_logs_get(
filter_query="datadog-agent",
filter_index="main",
filter_indexes=[
"main",
],
filter_from=datetime(2020, 9, 17, 11, 48, 36, tzinfo=tzoffset(None, 3600)),
filter_to=datetime(2020, 9, 17, 12, 48, 36, tzinfo=tzoffset(None, 3600)),
page_limit=5,
Expand Down
29 changes: 15 additions & 14 deletions src/datadog_api_client/v2/api/logs_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import annotations

import collections
from typing import Any, Dict, Union
from typing import Any, Dict, List, Union

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
Expand Down Expand Up @@ -90,10 +90,11 @@ def __init__(self, api_client=None):
"attribute": "filter[query]",
"location": "query",
},
"filter_index": {
"openapi_types": (str,),
"attribute": "filter[index]",
"filter_indexes": {
"openapi_types": ([str],),
"attribute": "filter[indexes]",
"location": "query",
"collection_format": "csv",
},
"filter_from": {
"openapi_types": (datetime,),
Expand Down Expand Up @@ -294,7 +295,7 @@ def list_logs_get(
self,
*,
filter_query: Union[str, UnsetType] = unset,
filter_index: Union[str, UnsetType] = unset,
filter_indexes: Union[List[str], UnsetType] = unset,
filter_from: Union[datetime, UnsetType] = unset,
filter_to: Union[datetime, UnsetType] = unset,
filter_storage_tier: Union[LogsStorageTier, UnsetType] = unset,
Expand All @@ -315,9 +316,9 @@ def list_logs_get(
:param filter_query: Search query following logs syntax.
:type filter_query: str, optional
:param filter_index: For customers with multiple indexes, the indexes to search
:param filter_indexes: For customers with multiple indexes, the indexes to search.
Defaults to '*' which means all indexes
:type filter_index: str, optional
:type filter_indexes: [str], optional
:param filter_from: Minimum timestamp for requested logs.
:type filter_from: datetime, optional
:param filter_to: Maximum timestamp for requested logs.
Expand All @@ -336,8 +337,8 @@ def list_logs_get(
if filter_query is not unset:
kwargs["filter_query"] = filter_query

if filter_index is not unset:
kwargs["filter_index"] = filter_index
if filter_indexes is not unset:
kwargs["filter_indexes"] = filter_indexes

if filter_from is not unset:
kwargs["filter_from"] = filter_from
Expand All @@ -363,7 +364,7 @@ def list_logs_get_with_pagination(
self,
*,
filter_query: Union[str, UnsetType] = unset,
filter_index: Union[str, UnsetType] = unset,
filter_indexes: Union[List[str], UnsetType] = unset,
filter_from: Union[datetime, UnsetType] = unset,
filter_to: Union[datetime, UnsetType] = unset,
filter_storage_tier: Union[LogsStorageTier, UnsetType] = unset,
Expand All @@ -377,9 +378,9 @@ def list_logs_get_with_pagination(
:param filter_query: Search query following logs syntax.
:type filter_query: str, optional
:param filter_index: For customers with multiple indexes, the indexes to search
:param filter_indexes: For customers with multiple indexes, the indexes to search.
Defaults to '*' which means all indexes
:type filter_index: str, optional
:type filter_indexes: [str], optional
:param filter_from: Minimum timestamp for requested logs.
:type filter_from: datetime, optional
:param filter_to: Maximum timestamp for requested logs.
Expand All @@ -400,8 +401,8 @@ def list_logs_get_with_pagination(
if filter_query is not unset:
kwargs["filter_query"] = filter_query

if filter_index is not unset:
kwargs["filter_index"] = filter_index
if filter_indexes is not unset:
kwargs["filter_indexes"] = filter_indexes

if filter_from is not unset:
kwargs["filter_from"] = filter_from
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-01-06T00:51:50.622Z
2023-07-05T20:27:06.820Z
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ interactions:
accept:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v2/logs/events?filter%5Bquery%5D=datadog-agent&filter%5Bindex%5D=main&filter%5Bfrom%5D=2020-09-17T11%3A48%3A36%2B01%3A00&filter%5Bto%5D=2020-09-17T12%3A48%3A36%2B01%3A00&page%5Blimit%5D=5
uri: https://api.datadoghq.com/api/v2/logs/events?filter%5Bquery%5D=datadog-agent&filter%5Bindexes%5D=main&filter%5Bfrom%5D=2020-09-17T11%3A48%3A36%2B01%3A00&filter%5Bto%5D=2020-09-17T12%3A48%3A36%2B01%3A00&page%5Blimit%5D=5
response:
body:
string: '{"data":[]}'
string: '{"data":[],"meta":{"elapsed":0,"request_id":"pddv1ChZVZjdFSUNKdlM3LVBKNXNPcjR6R1hnIiwKHP4qJC1KWavJCGIvcezlUg3AhhLxU4JfitQ_QFESDFVjhmcEEEIN8NN7KA","status":"done"}}
'
headers:
content-type:
- application/json
Expand Down
2 changes: 1 addition & 1 deletion tests/v2/features/logs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Feature: Logs
Given a valid "appKeyAuth" key in the system
And new "ListLogsGet" request
And request contains "filter[query]" parameter with value "datadog-agent"
And request contains "filter[index]" parameter with value "main"
And request contains "filter[indexes]" parameter with value ["main"]
And request contains "filter[from]" parameter with value "2020-09-17T11:48:36+01:00"
And request contains "filter[to]" parameter with value "2020-09-17T12:48:36+01:00"
And request contains "page[limit]" parameter with value 5
Expand Down

0 comments on commit 31c0b7a

Please sign in to comment.