Skip to content

Commit caa1a50

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Update header for logs search endpoints (#2339)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 80f99a9 commit caa1a50

File tree

9 files changed

+152
-36
lines changed

9 files changed

+152
-36
lines changed

Diff for: .apigentools-info

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-01-02 17:32:10.022066",
8-
"spec_repo_commit": "733cf3ea"
7+
"regenerated": "2025-01-03 15:57:07.457578",
8+
"spec_repo_commit": "50c16e5f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-02 17:32:10.039540",
13-
"spec_repo_commit": "733cf3ea"
12+
"regenerated": "2025-01-03 15:57:07.474412",
13+
"spec_repo_commit": "50c16e5f"
1414
}
1515
}
1616
}

Diff for: .generator/schemas/v2/openapi.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -38621,7 +38621,7 @@ paths:
3862138621
[Results are paginated][1].
3862238622

3862338623

38624-
Use this endpoint to see your latest logs.
38624+
Use this endpoint to search and filter your logs.
3862538625

3862638626

3862738627
**If you are considering archiving logs for your organization,
@@ -38718,7 +38718,7 @@ paths:
3871838718
$ref: '#/components/responses/NotAuthorizedResponse'
3871938719
'429':
3872038720
$ref: '#/components/responses/TooManyRequestsResponse'
38721-
summary: Get a list of logs
38721+
summary: Search logs (GET)
3872238722
tags:
3872338723
- Logs
3872438724
x-pagination:
@@ -38737,7 +38737,7 @@ paths:
3873738737
[Results are paginated][1].
3873838738

3873938739

38740-
Use this endpoint to build complex logs filtering and search.
38740+
Use this endpoint to search and filter your logs.
3874138741

3874238742

3874338743
**If you are considering archiving logs for your organization,
@@ -38770,7 +38770,7 @@ paths:
3877038770
$ref: '#/components/responses/NotAuthorizedResponse'
3877138771
'429':
3877238772
$ref: '#/components/responses/TooManyRequestsResponse'
38773-
summary: Search logs
38773+
summary: Search logs (POST)
3877438774
tags:
3877538775
- Logs
3877638776
x-codegen-request-body-name: body

Diff for: examples/v2/logs/ListLogs.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
"""
2-
Search logs returns "OK" response
2+
Search logs (POST) returns "OK" response
33
"""
44

55
from datadog_api_client import ApiClient, Configuration
66
from datadog_api_client.v2.api.logs_api import LogsApi
77
from datadog_api_client.v2.model.logs_list_request import LogsListRequest
88
from datadog_api_client.v2.model.logs_list_request_page import LogsListRequestPage
99
from datadog_api_client.v2.model.logs_query_filter import LogsQueryFilter
10+
from datadog_api_client.v2.model.logs_query_options import LogsQueryOptions
1011
from datadog_api_client.v2.model.logs_sort import LogsSort
12+
from datadog_api_client.v2.model.logs_storage_tier import LogsStorageTier
1113

1214
body = LogsListRequest(
1315
filter=LogsQueryFilter(
14-
query="datadog-agent",
16+
_from="now-15m",
1517
indexes=[
1618
"main",
19+
"web",
1720
],
18-
_from="2020-09-17T11:48:36+01:00",
19-
to="2020-09-17T12:48:36+01:00",
21+
query="service:web* AND @http.status_code:[200 TO 299]",
22+
storage_tier=LogsStorageTier.INDEXES,
23+
to="now",
24+
),
25+
options=LogsQueryOptions(
26+
timezone="GMT",
2027
),
21-
sort=LogsSort.TIMESTAMP_ASCENDING,
2228
page=LogsListRequestPage(
23-
limit=5,
29+
cursor="eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
30+
limit=25,
2431
),
32+
sort=LogsSort.TIMESTAMP_ASCENDING,
2533
)
2634

2735
configuration = Configuration()

Diff for: examples/v2/logs/ListLogsGet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Get a list of logs returns "OK" response
2+
Search logs (GET) returns "OK" response
33
"""
44

55
from datadog_api_client import ApiClient, Configuration

Diff for: examples/v2/logs/ListLogsGet_175182691.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Search logs (GET) returns "OK" response with pagination
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.logs_api import LogsApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = LogsApi(api_client)
11+
items = api_instance.list_logs_get_with_pagination()
12+
for item in items:
13+
print(item)

Diff for: examples/v2/logs/ListLogs_3400928236.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Search logs returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.logs_api import LogsApi
7+
from datadog_api_client.v2.model.logs_list_request import LogsListRequest
8+
from datadog_api_client.v2.model.logs_list_request_page import LogsListRequestPage
9+
from datadog_api_client.v2.model.logs_query_filter import LogsQueryFilter
10+
from datadog_api_client.v2.model.logs_sort import LogsSort
11+
12+
body = LogsListRequest(
13+
filter=LogsQueryFilter(
14+
query="datadog-agent",
15+
indexes=[
16+
"main",
17+
],
18+
_from="2020-09-17T11:48:36+01:00",
19+
to="2020-09-17T12:48:36+01:00",
20+
),
21+
sort=LogsSort.TIMESTAMP_ASCENDING,
22+
page=LogsListRequestPage(
23+
limit=5,
24+
),
25+
)
26+
27+
configuration = Configuration()
28+
with ApiClient(configuration) as api_client:
29+
api_instance = LogsApi(api_client)
30+
response = api_instance.list_logs(body=body)
31+
32+
print(response)

Diff for: examples/v2/logs/ListLogs_534975433.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""
2+
Search logs (POST) returns "OK" response with pagination
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.logs_api import LogsApi
7+
from datadog_api_client.v2.model.logs_list_request import LogsListRequest
8+
from datadog_api_client.v2.model.logs_list_request_page import LogsListRequestPage
9+
from datadog_api_client.v2.model.logs_query_filter import LogsQueryFilter
10+
from datadog_api_client.v2.model.logs_query_options import LogsQueryOptions
11+
from datadog_api_client.v2.model.logs_sort import LogsSort
12+
from datadog_api_client.v2.model.logs_storage_tier import LogsStorageTier
13+
14+
body = LogsListRequest(
15+
filter=LogsQueryFilter(
16+
_from="now-15m",
17+
indexes=[
18+
"main",
19+
"web",
20+
],
21+
query="service:web* AND @http.status_code:[200 TO 299]",
22+
storage_tier=LogsStorageTier.INDEXES,
23+
to="now",
24+
),
25+
options=LogsQueryOptions(
26+
timezone="GMT",
27+
),
28+
page=LogsListRequestPage(
29+
cursor="eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
30+
limit=25,
31+
),
32+
sort=LogsSort.TIMESTAMP_ASCENDING,
33+
)
34+
35+
configuration = Configuration()
36+
with ApiClient(configuration) as api_client:
37+
api_instance = LogsApi(api_client)
38+
items = api_instance.list_logs_with_pagination(body=body)
39+
for item in items:
40+
print(item)

Diff for: src/datadog_api_client/v2/api/logs_api.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ def list_logs(
240240
*,
241241
body: Union[LogsListRequest, UnsetType] = unset,
242242
) -> LogsListResponse:
243-
"""Search logs.
243+
"""Search logs (POST).
244244
245245
List endpoint returns logs that match a log search query.
246246
`Results are paginated </logs/guide/collect-multiple-logs-with-pagination>`_.
247247
248-
Use this endpoint to build complex logs filtering and search.
248+
Use this endpoint to search and filter your logs.
249249
250250
If you are considering archiving logs for your organization,
251251
consider use of the Datadog archive capabilities instead of the log list API.
@@ -265,7 +265,7 @@ def list_logs_with_pagination(
265265
*,
266266
body: Union[LogsListRequest, UnsetType] = unset,
267267
) -> collections.abc.Iterable[Log]:
268-
"""Search logs.
268+
"""Search logs (POST).
269269
270270
Provide a paginated version of :meth:`list_logs`, returning all items.
271271
@@ -303,12 +303,12 @@ def list_logs_get(
303303
page_cursor: Union[str, UnsetType] = unset,
304304
page_limit: Union[int, UnsetType] = unset,
305305
) -> LogsListResponse:
306-
"""Get a list of logs.
306+
"""Search logs (GET).
307307
308308
List endpoint returns logs that match a log search query.
309309
`Results are paginated </logs/guide/collect-multiple-logs-with-pagination>`_.
310310
311-
Use this endpoint to see your latest logs.
311+
Use this endpoint to search and filter your logs.
312312
313313
If you are considering archiving logs for your organization,
314314
consider use of the Datadog archive capabilities instead of the log list API.
@@ -372,7 +372,7 @@ def list_logs_get_with_pagination(
372372
page_cursor: Union[str, UnsetType] = unset,
373373
page_limit: Union[int, UnsetType] = unset,
374374
) -> collections.abc.Iterable[Log]:
375-
"""Get a list of logs.
375+
"""Search logs (GET).
376376
377377
Provide a paginated version of :meth:`list_logs_get`, returning all items.
378378

Diff for: tests/v2/features/logs.feature

+38-15
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@ Feature: Logs
4343
Then the response status is 200 OK
4444
And the response "meta.status" is equal to "done"
4545

46-
@generated @skip @team:DataDog/logs-app
47-
Scenario: Get a list of logs returns "Bad Request" response
48-
Given a valid "appKeyAuth" key in the system
49-
And new "ListLogsGet" request
50-
When the request is sent
51-
Then the response status is 400 Bad Request
52-
53-
@generated @skip @team:DataDog/logs-app
54-
Scenario: Get a list of logs returns "OK" response
55-
Given a valid "appKeyAuth" key in the system
56-
And new "ListLogsGet" request
57-
When the request is sent
58-
Then the response status is 200 OK
59-
6046
@replay-only @skip-validation @team:DataDog/logs-app @with-pagination
6147
Scenario: Get a list of logs returns "OK" response with pagination
6248
Given a valid "appKeyAuth" key in the system
@@ -80,13 +66,50 @@ Feature: Logs
8066
And the response "data" has length 0
8167

8268
@generated @skip @team:DataDog/logs-app
83-
Scenario: Search logs returns "Bad Request" response
69+
Scenario: Search logs (GET) returns "Bad Request" response
70+
Given a valid "appKeyAuth" key in the system
71+
And new "ListLogsGet" request
72+
When the request is sent
73+
Then the response status is 400 Bad Request
74+
75+
@generated @skip @team:DataDog/logs-app
76+
Scenario: Search logs (GET) returns "OK" response
77+
Given a valid "appKeyAuth" key in the system
78+
And new "ListLogsGet" request
79+
When the request is sent
80+
Then the response status is 200 OK
81+
82+
@generated @skip @team:DataDog/logs-app @with-pagination
83+
Scenario: Search logs (GET) returns "OK" response with pagination
84+
Given a valid "appKeyAuth" key in the system
85+
And new "ListLogsGet" request
86+
When the request with pagination is sent
87+
Then the response status is 200 OK
88+
89+
@generated @skip @team:DataDog/logs-app
90+
Scenario: Search logs (POST) returns "Bad Request" response
8491
Given a valid "appKeyAuth" key in the system
8592
And new "ListLogs" request
8693
And body with value {"filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "storage_tier": "indexes", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"}
8794
When the request is sent
8895
Then the response status is 400 Bad Request
8996

97+
@generated @skip @team:DataDog/logs-app
98+
Scenario: Search logs (POST) returns "OK" response
99+
Given a valid "appKeyAuth" key in the system
100+
And new "ListLogs" request
101+
And body with value {"filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "storage_tier": "indexes", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"}
102+
When the request is sent
103+
Then the response status is 200 OK
104+
105+
@generated @skip @team:DataDog/logs-app @with-pagination
106+
Scenario: Search logs (POST) returns "OK" response with pagination
107+
Given a valid "appKeyAuth" key in the system
108+
And new "ListLogs" request
109+
And body with value {"filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "storage_tier": "indexes", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"}
110+
When the request with pagination is sent
111+
Then the response status is 200 OK
112+
90113
@team:DataDog/logs-app
91114
Scenario: Search logs returns "OK" response
92115
Given a valid "appKeyAuth" key in the system

0 commit comments

Comments
 (0)