-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update header for logs search endpoints (#2637)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
58c4d71
commit b20595c
Showing
9 changed files
with
196 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.