Skip to content
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-10-02 13:39:23.929055",
"spec_repo_commit": "e02e4f4c"
"regenerated": "2024-10-02 14:33:44.583261",
"spec_repo_commit": "3b4747f4"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-02 13:39:23.943702",
"spec_repo_commit": "e02e4f4c"
"regenerated": "2024-10-02 14:33:44.597775",
"spec_repo_commit": "3b4747f4"
}
}
}
143 changes: 143 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15194,6 +15194,32 @@ components:
- EDGE_LAPTOP_LARGE
- EDGE_TABLET
- EDGE_MOBILE_SMALL
SyntheticsFetchUptimesPayload:
description: Object containing IDs of Synthetic tests and a timeframe.
properties:
from_ts:
description: Timestamp in seconds (Unix epoch) for the start of uptime.
example: 0
format: int64
type: integer
public_ids:
description: An array of Synthetic test IDs you want to delete.
example: []
items:
description: A Synthetic test ID.
example: abc-def-123
type: string
type: array
to_ts:
description: Timestamp in seconds (Unix epoch) for the end of uptime.
example: 0
format: int64
type: integer
required:
- from_ts
- to_ts
- public_ids
type: object
SyntheticsGetAPITestLatestResultsResponse:
description: Object with the latest Synthetic API test run.
properties:
Expand Down Expand Up @@ -17283,6 +17309,24 @@ components:
description: String Port number to use when performing the test. Supports templated
variables.
type: string
SyntheticsTestUptime:
description: Object containing the uptime for a Synthetic test ID.
properties:
from_ts:
description: Timestamp in seconds for the start of uptime.
format: int64
type: integer
overall:
$ref: '#/components/schemas/SyntheticsUptime'
public_id:
description: A Synthetic test ID.
example: abc-def-123
type: string
to_ts:
description: Timestamp in seconds for the end of uptime.
format: int64
type: integer
type: object
SyntheticsTiming:
description: 'Object containing all metrics and their values collected for a
Synthetic API test.
Expand Down Expand Up @@ -17406,6 +17450,62 @@ components:
new_status:
$ref: '#/components/schemas/SyntheticsTestPauseStatus'
type: object
SyntheticsUptime:
description: Object containing the uptime information.
properties:
errors:
description: An array of error objects returned while querying the history
data for the service level objective.
items:
$ref: '#/components/schemas/SLOHistoryResponseErrorWithType'
nullable: true
type: array
group:
description: The location name
example: name
type: string
history:
description: 'The state transition history for the monitor, represented
as an array of

pairs. Each pair is an array where the first element is the transition
timestamp

in Unix epoch format (integer) and the second element is the state (integer).

For the state, an integer value of `0` indicates uptime, `1` indicates
downtime,

and `2` indicates no data.'
example:
- - 1579212382
- 0
items:
description: An array of transitions
example:
- 1579212382
- 0
items:
description: A timeseries data point which is a tuple of (timestamp,
value).
format: double
type: number
maxItems: 2
minItems: 2
type: array
type: array
span_precision:
description: The number of decimal places to which the SLI value is accurate
for the given from-to timestamps.
example: 2.0
format: double
type: number
uptime:
description: The overall uptime.
example: 99.99
format: double
type: number
type: object
SyntheticsVariableParser:
description: Details of the parser to use for the global variable.
example:
Expand Down Expand Up @@ -32934,6 +33034,49 @@ paths:
operator: OR
permissions:
- synthetics_write
/api/v1/synthetics/tests/uptimes:
post:
description: Fetch uptime for multiple Synthetic tests by ID.
operationId: FetchUptimes
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SyntheticsFetchUptimesPayload'
description: Public ID list of the Synthetic tests and timeframe.
required: true
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/SyntheticsTestUptime'
type: array
description: OK.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: '- JSON format is wrong'
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- synthetics_read
summary: Fetch uptime for multiple tests
tags:
- Synthetics
x-codegen-request-body-name: body
/api/v1/synthetics/tests/{public_id}:
get:
description: Get the detailed configuration associated with a Synthetic test.
Expand Down
33 changes: 33 additions & 0 deletions examples/v1/synthetics/FetchUptimes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Fetch uptime for multiple tests returns "OK." response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsFetchUptimesPayload;
import com.datadog.api.client.v1.model.SyntheticsTestUptime;
import java.util.Collections;
import java.util.List;

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

SyntheticsFetchUptimesPayload body =
new SyntheticsFetchUptimesPayload()
.fromTs(1726041488L)
.publicIds(Collections.singletonList("p8m-9gw-nte"))
.toTs(1726055954L);

try {
List<SyntheticsTestUptime> result = apiInstance.fetchUptimes(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#fetchUptimes");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
134 changes: 134 additions & 0 deletions src/main/java/com/datadog/api/client/v1/api/SyntheticsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.datadog.api.client.v1.model.SyntheticsCITestBody;
import com.datadog.api.client.v1.model.SyntheticsDeleteTestsPayload;
import com.datadog.api.client.v1.model.SyntheticsDeleteTestsResponse;
import com.datadog.api.client.v1.model.SyntheticsFetchUptimesPayload;
import com.datadog.api.client.v1.model.SyntheticsGetAPITestLatestResultsResponse;
import com.datadog.api.client.v1.model.SyntheticsGetBrowserTestLatestResultsResponse;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariable;
Expand All @@ -25,6 +26,7 @@
import com.datadog.api.client.v1.model.SyntheticsPrivateLocation;
import com.datadog.api.client.v1.model.SyntheticsPrivateLocationCreationResponse;
import com.datadog.api.client.v1.model.SyntheticsTestDetails;
import com.datadog.api.client.v1.model.SyntheticsTestUptime;
import com.datadog.api.client.v1.model.SyntheticsTriggerBody;
import com.datadog.api.client.v1.model.SyntheticsTriggerCITestsResponse;
import com.datadog.api.client.v1.model.SyntheticsUpdateTestPauseStatusPayload;
Expand Down Expand Up @@ -1304,6 +1306,138 @@ public ApiResponse<SyntheticsGlobalVariable> editGlobalVariableWithHttpInfo(
new GenericType<SyntheticsGlobalVariable>() {});
}

/**
* Fetch uptime for multiple tests.
*
* <p>See {@link #fetchUptimesWithHttpInfo}.
*
* @param body Public ID list of the Synthetic tests and timeframe. (required)
* @return List&lt;SyntheticsTestUptime&gt;
* @throws ApiException if fails to make API call
*/
public List<SyntheticsTestUptime> fetchUptimes(SyntheticsFetchUptimesPayload body)
throws ApiException {
return fetchUptimesWithHttpInfo(body).getData();
}

/**
* Fetch uptime for multiple tests.
*
* <p>See {@link #fetchUptimesWithHttpInfoAsync}.
*
* @param body Public ID list of the Synthetic tests and timeframe. (required)
* @return CompletableFuture&lt;List&lt;SyntheticsTestUptime&gt;&gt;
*/
public CompletableFuture<List<SyntheticsTestUptime>> fetchUptimesAsync(
SyntheticsFetchUptimesPayload body) {
return fetchUptimesWithHttpInfoAsync(body)
.thenApply(
response -> {
return response.getData();
});
}

/**
* Fetch uptime for multiple Synthetic tests by ID.
*
* @param body Public ID list of the Synthetic tests and timeframe. (required)
* @return ApiResponse&lt;List&lt;SyntheticsTestUptime&gt;&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK. </td><td> - </td></tr>
* <tr><td> 400 </td><td> - JSON format is wrong </td><td> - </td></tr>
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<List<SyntheticsTestUptime>> fetchUptimesWithHttpInfo(
SyntheticsFetchUptimesPayload body) throws ApiException {
Object localVarPostBody = body;

// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(
400, "Missing the required parameter 'body' when calling fetchUptimes");
}
// create path and map variables
String localVarPath = "/api/v1/synthetics/tests/uptimes";

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v1.SyntheticsApi.fetchUptimes",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"});
return apiClient.invokeAPI(
"POST",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<List<SyntheticsTestUptime>>() {});
}

/**
* Fetch uptime for multiple tests.
*
* <p>See {@link #fetchUptimesWithHttpInfo}.
*
* @param body Public ID list of the Synthetic tests and timeframe. (required)
* @return CompletableFuture&lt;ApiResponse&lt;List&lt;SyntheticsTestUptime&gt;&gt;&gt;
*/
public CompletableFuture<ApiResponse<List<SyntheticsTestUptime>>> fetchUptimesWithHttpInfoAsync(
SyntheticsFetchUptimesPayload body) {
Object localVarPostBody = body;

// verify the required parameter 'body' is set
if (body == null) {
CompletableFuture<ApiResponse<List<SyntheticsTestUptime>>> result = new CompletableFuture<>();
result.completeExceptionally(
new ApiException(400, "Missing the required parameter 'body' when calling fetchUptimes"));
return result;
}
// create path and map variables
String localVarPath = "/api/v1/synthetics/tests/uptimes";

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v1.SyntheticsApi.fetchUptimes",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<List<SyntheticsTestUptime>>> result = new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"POST",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<List<SyntheticsTestUptime>>() {});
}

/**
* Get an API test.
*
Expand Down
Loading