Skip to content

Commit

Permalink
Update header for logs search endpoints (#2637)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Jan 3, 2025
1 parent 58c4d71 commit b20595c
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 48 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.6",
"regenerated": "2025-01-02 17:32:09.022655",
"spec_repo_commit": "733cf3ea"
"regenerated": "2025-01-03 15:57:07.358573",
"spec_repo_commit": "50c16e5f"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-02 17:32:09.037464",
"spec_repo_commit": "733cf3ea"
"regenerated": "2025-01-03 15:57:07.373454",
"spec_repo_commit": "50c16e5f"
}
}
}
8 changes: 4 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38621,7 +38621,7 @@ paths:
[Results are paginated][1].


Use this endpoint to see your latest logs.
Use this endpoint to search and filter your logs.


**If you are considering archiving logs for your organization,
Expand Down Expand Up @@ -38718,7 +38718,7 @@ paths:
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Get a list of logs
summary: Search logs (GET)
tags:
- Logs
x-pagination:
Expand All @@ -38737,7 +38737,7 @@ paths:
[Results are paginated][1].


Use this endpoint to build complex logs filtering and search.
Use this endpoint to search and filter your logs.


**If you are considering archiving logs for your organization,
Expand Down Expand Up @@ -38770,7 +38770,7 @@ paths:
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Search logs
summary: Search logs (POST)
tags:
- Logs
x-codegen-request-body-name: body
Expand Down
24 changes: 16 additions & 8 deletions examples/v2/logs/ListLogs.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Search logs returns "OK" response
// Search logs (POST) returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
Expand All @@ -8,8 +8,10 @@
import com.datadog.api.client.v2.model.LogsListRequestPage;
import com.datadog.api.client.v2.model.LogsListResponse;
import com.datadog.api.client.v2.model.LogsQueryFilter;
import com.datadog.api.client.v2.model.LogsQueryOptions;
import com.datadog.api.client.v2.model.LogsSort;
import java.util.Collections;
import com.datadog.api.client.v2.model.LogsStorageTier;
import java.util.Arrays;

public class Example {
public static void main(String[] args) {
Expand All @@ -20,12 +22,18 @@ public static void main(String[] args) {
new LogsListRequest()
.filter(
new LogsQueryFilter()
.query("datadog-agent")
.indexes(Collections.singletonList("main"))
.from("2020-09-17T11:48:36+01:00")
.to("2020-09-17T12:48:36+01:00"))
.sort(LogsSort.TIMESTAMP_ASCENDING)
.page(new LogsListRequestPage().limit(5));
.from("now-15m")
.indexes(Arrays.asList("main", "web"))
.query("service:web* AND @http.status_code:[200 TO 299]")
.storageTier(LogsStorageTier.INDEXES)
.to("now"))
.options(new LogsQueryOptions().timezone("GMT"))
.page(
new LogsListRequestPage()
.cursor(
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==")
.limit(25))
.sort(LogsSort.TIMESTAMP_ASCENDING);

try {
LogsListResponse result = apiInstance.listLogs(new ListLogsOptionalParameters().body(body));
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/logs/ListLogsGet.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Get a list of logs returns "OK" response
// Search logs (GET) returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
Expand Down
25 changes: 25 additions & 0 deletions examples/v2/logs/ListLogsGet_175182691.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Search logs (GET) returns "OK" response with pagination

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.v2.api.LogsApi;
import com.datadog.api.client.v2.model.Log;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsApi apiInstance = new LogsApi(defaultClient);

try {
PaginationIterable<Log> iterable = apiInstance.listLogsGetWithPagination();

for (Log item : iterable) {
System.out.println(item);
}
} catch (RuntimeException e) {
System.err.println("Exception when calling LogsApi#listLogsGetWithPagination");
System.err.println("Reason: " + e.getMessage());
e.printStackTrace();
}
}
}
41 changes: 41 additions & 0 deletions examples/v2/logs/ListLogs_3400928236.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Search logs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.LogsApi;
import com.datadog.api.client.v2.api.LogsApi.ListLogsOptionalParameters;
import com.datadog.api.client.v2.model.LogsListRequest;
import com.datadog.api.client.v2.model.LogsListRequestPage;
import com.datadog.api.client.v2.model.LogsListResponse;
import com.datadog.api.client.v2.model.LogsQueryFilter;
import com.datadog.api.client.v2.model.LogsSort;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsApi apiInstance = new LogsApi(defaultClient);

LogsListRequest body =
new LogsListRequest()
.filter(
new LogsQueryFilter()
.query("datadog-agent")
.indexes(Collections.singletonList("main"))
.from("2020-09-17T11:48:36+01:00")
.to("2020-09-17T12:48:36+01:00"))
.sort(LogsSort.TIMESTAMP_ASCENDING)
.page(new LogsListRequestPage().limit(5));

try {
LogsListResponse result = apiInstance.listLogs(new ListLogsOptionalParameters().body(body));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsApi#listLogs");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
51 changes: 51 additions & 0 deletions examples/v2/logs/ListLogs_534975433.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Search logs (POST) returns "OK" response with pagination

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.v2.api.LogsApi;
import com.datadog.api.client.v2.api.LogsApi.ListLogsOptionalParameters;
import com.datadog.api.client.v2.model.Log;
import com.datadog.api.client.v2.model.LogsListRequest;
import com.datadog.api.client.v2.model.LogsListRequestPage;
import com.datadog.api.client.v2.model.LogsQueryFilter;
import com.datadog.api.client.v2.model.LogsQueryOptions;
import com.datadog.api.client.v2.model.LogsSort;
import com.datadog.api.client.v2.model.LogsStorageTier;
import java.util.Arrays;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsApi apiInstance = new LogsApi(defaultClient);

LogsListRequest body =
new LogsListRequest()
.filter(
new LogsQueryFilter()
.from("now-15m")
.indexes(Arrays.asList("main", "web"))
.query("service:web* AND @http.status_code:[200 TO 299]")
.storageTier(LogsStorageTier.INDEXES)
.to("now"))
.options(new LogsQueryOptions().timezone("GMT"))
.page(
new LogsListRequestPage()
.cursor(
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==")
.limit(25))
.sort(LogsSort.TIMESTAMP_ASCENDING);

try {
PaginationIterable<Log> iterable =
apiInstance.listLogsWithPagination(new ListLogsOptionalParameters().body(body));

for (Log item : iterable) {
System.out.println(item);
}
} catch (RuntimeException e) {
System.err.println("Exception when calling LogsApi#listLogsWithPagination");
System.err.println("Reason: " + e.getMessage());
e.printStackTrace();
}
}
}
32 changes: 16 additions & 16 deletions src/main/java/com/datadog/api/client/v2/api/LogsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public ListLogsOptionalParameters body(LogsListRequest body) {
}

/**
* Search logs.
* Search logs (POST).
*
* <p>See {@link #listLogsWithHttpInfo}.
*
Expand All @@ -216,7 +216,7 @@ public LogsListResponse listLogs() throws ApiException {
}

/**
* Search logs.
* Search logs (POST).
*
* <p>See {@link #listLogsWithHttpInfoAsync}.
*
Expand All @@ -231,7 +231,7 @@ public CompletableFuture<LogsListResponse> listLogsAsync() {
}

/**
* Search logs.
* Search logs (POST).
*
* <p>See {@link #listLogsWithHttpInfo}.
*
Expand All @@ -244,7 +244,7 @@ public LogsListResponse listLogs(ListLogsOptionalParameters parameters) throws A
}

/**
* Search logs.
* Search logs (POST).
*
* <p>See {@link #listLogsWithHttpInfoAsync}.
*
Expand All @@ -260,7 +260,7 @@ public CompletableFuture<LogsListResponse> listLogsAsync(ListLogsOptionalParamet
}

/**
* Search logs.
* Search logs (POST).
*
* <p>See {@link #listLogsWithHttpInfo}.
*
Expand All @@ -272,7 +272,7 @@ public PaginationIterable<Log> listLogsWithPagination() {
}

/**
* Search logs.
* Search logs (POST).
*
* <p>See {@link #listLogsWithHttpInfo}.
*
Expand Down Expand Up @@ -322,7 +322,7 @@ public PaginationIterable<Log> listLogsWithPagination(ListLogsOptionalParameters
* List endpoint returns logs that match a log search query. <a
* href="/logs/guide/collect-multiple-logs-with-pagination">Results are paginated</a>.
*
* <p>Use this endpoint to build complex logs filtering and search.
* <p>Use this endpoint to search and filter your logs.
*
* <p><strong>If you are considering archiving logs for your organization, consider use of the
* Datadog archive capabilities instead of the log list API. See <a
Expand Down Expand Up @@ -371,7 +371,7 @@ public ApiResponse<LogsListResponse> listLogsWithHttpInfo(ListLogsOptionalParame
}

/**
* Search logs.
* Search logs (POST).
*
* <p>See {@link #listLogsWithHttpInfo}.
*
Expand Down Expand Up @@ -517,7 +517,7 @@ public ListLogsGetOptionalParameters pageLimit(Integer pageLimit) {
}

/**
* Get a list of logs.
* Search logs (GET).
*
* <p>See {@link #listLogsGetWithHttpInfo}.
*
Expand All @@ -529,7 +529,7 @@ public LogsListResponse listLogsGet() throws ApiException {
}

/**
* Get a list of logs.
* Search logs (GET).
*
* <p>See {@link #listLogsGetWithHttpInfoAsync}.
*
Expand All @@ -544,7 +544,7 @@ public CompletableFuture<LogsListResponse> listLogsGetAsync() {
}

/**
* Get a list of logs.
* Search logs (GET).
*
* <p>See {@link #listLogsGetWithHttpInfo}.
*
Expand All @@ -558,7 +558,7 @@ public LogsListResponse listLogsGet(ListLogsGetOptionalParameters parameters)
}

/**
* Get a list of logs.
* Search logs (GET).
*
* <p>See {@link #listLogsGetWithHttpInfoAsync}.
*
Expand All @@ -575,7 +575,7 @@ public CompletableFuture<LogsListResponse> listLogsGetAsync(
}

/**
* Get a list of logs.
* Search logs (GET).
*
* <p>See {@link #listLogsGetWithHttpInfo}.
*
Expand All @@ -587,7 +587,7 @@ public PaginationIterable<Log> listLogsGetWithPagination() {
}

/**
* Get a list of logs.
* Search logs (GET).
*
* <p>See {@link #listLogsGetWithHttpInfo}.
*
Expand Down Expand Up @@ -630,7 +630,7 @@ public PaginationIterable<Log> listLogsGetWithPagination(
* List endpoint returns logs that match a log search query. <a
* href="/logs/guide/collect-multiple-logs-with-pagination">Results are paginated</a>.
*
* <p>Use this endpoint to see your latest logs.
* <p>Use this endpoint to search and filter your logs.
*
* <p><strong>If you are considering archiving logs for your organization, consider use of the
* Datadog archive capabilities instead of the log list API. See <a
Expand Down Expand Up @@ -698,7 +698,7 @@ public ApiResponse<LogsListResponse> listLogsGetWithHttpInfo(
}

/**
* Get a list of logs.
* Search logs (GET).
*
* <p>See {@link #listLogsGetWithHttpInfo}.
*
Expand Down
Loading

0 comments on commit b20595c

Please sign in to comment.