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.5",
"regenerated": "2023-08-30 08:43:00.573454",
"spec_repo_commit": "fee86b40"
"regenerated": "2023-08-30 11:45:15.156195",
"spec_repo_commit": "2f2fd804"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-08-30 08:43:00.591173",
"spec_repo_commit": "fee86b40"
"regenerated": "2023-08-30 11:45:15.170455",
"spec_repo_commit": "2f2fd804"
}
}
}
13 changes: 11 additions & 2 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27990,14 +27990,19 @@ paths:
- description: Used for pagination. The number of tests returned in the page.
in: query
name: page_size
required: false
schema:
type: string
default: 100
format: int64
type: integer
- description: Used for pagination. Which page you want to retrieve. Starts
at zero.
in: query
name: page_number
required: false
schema:
type: string
format: int64
type: integer
responses:
'200':
content:
Expand Down Expand Up @@ -28027,6 +28032,10 @@ paths:
summary: Get the list of all Synthetic tests
tags:
- Synthetics
x-pagination:
limitParam: page_size
pageParam: page_number
resultsPath: tests
/api/v1/synthetics/tests/api:
post:
description: Create a Synthetic API test.
Expand Down
28 changes: 28 additions & 0 deletions examples/v1/synthetics/ListTests_1938827783.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests."
// response with pagination

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.api.SyntheticsApi.ListTestsOptionalParameters;
import com.datadog.api.client.v1.model.SyntheticsTestDetails;

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

try {
PaginationIterable<SyntheticsTestDetails> iterable =
apiInstance.listTestsWithPagination(new ListTestsOptionalParameters().pageSize(2L));

for (SyntheticsTestDetails item : iterable) {
System.out.println(item);
}
} catch (RuntimeException e) {
System.err.println("Exception when calling SyntheticsApi#listTestsWithPagination");
System.err.println("Reason: " + e.getMessage());
e.printStackTrace();
}
}
}
74 changes: 65 additions & 9 deletions src/main/java/com/datadog/api/client/v1/api/SyntheticsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.ApiResponse;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.Pair;
import com.datadog.api.client.v1.model.SyntheticsAPITest;
import com.datadog.api.client.v1.model.SyntheticsAPITestResultFull;
Expand All @@ -28,6 +29,7 @@
import jakarta.ws.rs.core.GenericType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -3108,16 +3110,17 @@ public CompletableFuture<ApiResponse<SyntheticsLocations>> listLocationsWithHttp

/** Manage optional parameters to listTests. */
public static class ListTestsOptionalParameters {
private String pageSize;
private String pageNumber;
private Long pageSize;
private Long pageNumber;

/**
* Set pageSize.
*
* @param pageSize Used for pagination. The number of tests returned in the page. (optional)
* @param pageSize Used for pagination. The number of tests returned in the page. (optional,
* default to 100)
* @return ListTestsOptionalParameters
*/
public ListTestsOptionalParameters pageSize(String pageSize) {
public ListTestsOptionalParameters pageSize(Long pageSize) {
this.pageSize = pageSize;
return this;
}
Expand All @@ -3129,7 +3132,7 @@ public ListTestsOptionalParameters pageSize(String pageSize) {
* (optional)
* @return ListTestsOptionalParameters
*/
public ListTestsOptionalParameters pageNumber(String pageNumber) {
public ListTestsOptionalParameters pageNumber(Long pageNumber) {
this.pageNumber = pageNumber;
return this;
}
Expand Down Expand Up @@ -3193,6 +3196,59 @@ public CompletableFuture<SyntheticsListTestsResponse> listTestsAsync(
});
}

/**
* Get the list of all Synthetic tests.
*
* <p>See {@link #listTestsWithHttpInfo}.
*
* @return PaginationIterable&lt;SyntheticsTestDetails&gt;
*/
public PaginationIterable<SyntheticsTestDetails> listTestsWithPagination() {
ListTestsOptionalParameters parameters = new ListTestsOptionalParameters();
return listTestsWithPagination(parameters);
}

/**
* Get the list of all Synthetic tests.
*
* <p>See {@link #listTestsWithHttpInfo}.
*
* @return SyntheticsListTestsResponse
*/
public PaginationIterable<SyntheticsTestDetails> listTestsWithPagination(
ListTestsOptionalParameters parameters) {
String resultsPath = "getTests";
String valueGetterPath = "";
String valueSetterPath = "pageNumber";
Boolean valueSetterParamOptional = true;
parameters.pageNumber(0l);
Long limit;

if (parameters.pageSize == null) {
limit = 100l;
parameters.pageSize(limit);
} else {
limit = parameters.pageSize;
}

LinkedHashMap<String, Object> args = new LinkedHashMap<String, Object>();
args.put("optionalParams", parameters);

PaginationIterable iterator =
new PaginationIterable(
this,
"listTests",
resultsPath,
valueGetterPath,
valueSetterPath,
valueSetterParamOptional,
false,
limit,
args);

return iterator;
}

/**
* Get the list of all Synthetic tests.
*
Expand All @@ -3212,8 +3268,8 @@ public CompletableFuture<SyntheticsListTestsResponse> listTestsAsync(
public ApiResponse<SyntheticsListTestsResponse> listTestsWithHttpInfo(
ListTestsOptionalParameters parameters) throws ApiException {
Object localVarPostBody = null;
String pageSize = parameters.pageSize;
String pageNumber = parameters.pageNumber;
Long pageSize = parameters.pageSize;
Long pageNumber = parameters.pageNumber;
// create path and map variables
String localVarPath = "/api/v1/synthetics/tests";

Expand Down Expand Up @@ -3254,8 +3310,8 @@ public ApiResponse<SyntheticsListTestsResponse> listTestsWithHttpInfo(
public CompletableFuture<ApiResponse<SyntheticsListTestsResponse>> listTestsWithHttpInfoAsync(
ListTestsOptionalParameters parameters) {
Object localVarPostBody = null;
String pageSize = parameters.pageSize;
String pageNumber = parameters.pageNumber;
Long pageSize = parameters.pageSize;
Long pageNumber = parameters.pageNumber;
// create path and map variables
String localVarPath = "/api/v1/synthetics/tests";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-08-30T09:42:25.568Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[
{
"httpRequest": {
"headers": {},
"method": "GET",
"path": "/api/v1/synthetics/tests",
"queryStringParameters": {
"page_size": [
"2"
],
"page_number": [
"0"
]
},
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"tests\":[{\"public_id\":\"888-nvp-kbw\",\"name\":\"tf-TestAccDatadogSyntheticsTestBrowserMML_Basic-local-1689951468-updated\",\"status\":\"paused\",\"type\":\"browser\",\"tags\":[\"foo:bar\",\"baz\"],\"created_at\":\"2023-07-21T14:57:51.688079+00:00\",\"modified_at\":\"2023-07-21T14:58:21.332326+00:00\",\"config\":{\"assertions\":[],\"configVariables\":[],\"request\":{\"method\":\"GET\",\"timeout\":60,\"url\":\"https://www.datadoghq.com\"},\"variables\":[]},\"message\":\"Notify @datadog.user\",\"options\":{\"device_ids\":[\"laptop_large\"],\"min_location_failed\":1,\"tick_every\":900},\"locations\":[\"aws:eu-central-1\"],\"monitor_id\":126283369,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"}},{\"public_id\":\"i9r-v4f-v3u\",\"name\":\"tf-TestAccDatadogSyntheticsBrowserTest_Updated_RumSettings-local-1689951491-updated-rumsettings\",\"status\":\"live\",\"type\":\"browser\",\"tags\":[\"foo:bar\",\"buz\"],\"created_at\":\"2023-07-21T14:58:17.635359+00:00\",\"modified_at\":\"2023-08-28T14:37:49.734465+00:00\",\"config\":{\"assertions\":[],\"configVariables\":[],\"request\":{\"method\":\"GET\",\"headers\":{\"Accept\":\"application/xml\",\"X-Datadog-Trace-ID\":\"987654321\"},\"url\":\"https://docs.datadoghq.com\"},\"setCookie\":\"\",\"variables\":[{\"example\":\"7956\",\"name\":\"MY_PATTERN_VAR\",\"pattern\":\"{{numeric(4)}}\",\"secure\":false,\"type\":\"text\"}]},\"message\":\"Notify @pagerduty\",\"options\":{\"device_ids\":[\"chrome.laptop_large\",\"chrome.tablet\"],\"ignoreServerCertificateError\":false,\"disableCors\":false,\"disableCsp\":false,\"noScreenshot\":false,\"tick_every\":1800,\"min_failure_duration\":10,\"min_location_failed\":1,\"retry\":{\"count\":3,\"interval\":500},\"monitor_options\":{\"renotify_interval\":120},\"ci\":{\"executionRule\":\"skipped\"},\"rumSettings\":{\"isEnabled\":false},\"enableProfiling\":false,\"enableSecurityTesting\":false},\"locations\":[\"aws:eu-central-1\"],\"monitor_id\":126283421,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"}}],\"total\":3}",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "8bd3539f-e2a3-d4f5-897f-5d75b0a8fdce"
},
{
"httpRequest": {
"headers": {},
"method": "GET",
"path": "/api/v1/synthetics/tests",
"queryStringParameters": {
"page_size": [
"2"
],
"page_number": [
"1"
]
},
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"tests\":[{\"public_id\":\"p34-3up-y6p\",\"name\":\"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response_1692944481\",\"status\":\"live\",\"type\":\"api\",\"tags\":[\"testing:api\"],\"created_at\":\"2023-08-25T06:21:21.640836+00:00\",\"modified_at\":\"2023-08-25T06:21:21.640836+00:00\",\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"xPath\":\"target-xpath\",\"targetValue\":\"0\",\"operator\":\"contains\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"headers\":{\"unique\":\"examplecreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1692944481\"},\"method\":\"GET\",\"timeout\":10,\"url\":\"https://datadoghq.com\",\"proxy\":{\"url\":\"https://datadoghq.com\",\"headers\":{}},\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"persistCookies\":true}},\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response_1692944481\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60,\"httpVersion\":\"http2\"},\"locations\":[\"aws:us-east-2\"],\"subtype\":\"http\",\"monitor_id\":130283608,\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"}}],\"total\":3}",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "7ec174e7-0c2c-2725-d1fa-011cd87e22f9"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,14 @@ Feature: Synthetics
When the request is sent
Then the response status is 200 OK - Returns the list of all Synthetic tests.

@replay-only @skip-validation @team:DataDog/synthetics-app @with-pagination
Scenario: Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests." response with pagination
Given new "ListTests" request
And request contains "page_size" parameter with value 2
When the request with pagination is sent
Then the response status is 200 OK - Returns the list of all Synthetic tests.
And the response has 3 items

@generated @skip @team:DataDog/synthetics-app
Scenario: Get the list of all Synthetic tests returns "Synthetic Monitoring is not activated for the user." response
Given new "ListTests" request
Expand Down