Skip to content

Commit 05f8012

Browse files
api-clients-generation-pipeline[bot]sdeprezci.datadog-api-spec
authored
Clean synthetics test CRUD endpoints (#322)
* Remove fields * Regenerate client from commit d87077d of spec repo Co-authored-by: sdeprez <sdeprez@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 43c3133 commit 05f8012

File tree

11 files changed

+533
-403
lines changed

11 files changed

+533
-403
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.2.0",
7-
"regenerated": "2020-05-27 16:17:57.973723",
8-
"spec_repo_commit": "0392d55"
7+
"regenerated": "2020-05-28 16:27:44.754167",
8+
"spec_repo_commit": "d87077d"
99
},
1010
"v2": {
1111
"apigentools_version": "1.2.0",
12-
"regenerated": "2020-05-27 16:18:04.310374",
13-
"spec_repo_commit": "0392d55"
12+
"regenerated": "2020-05-28 16:27:50.801227",
13+
"spec_repo_commit": "d87077d"
1414
}
1515
}
1616
}

api_docs/v1/SyntheticsApi.md

Lines changed: 82 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Method | HTTP request | Description
88
[**deleteTests**](SyntheticsApi.md#deleteTests) | **POST** /api/v1/synthetics/tests/delete | Delete tests
99
[**getAPITestLatestResults**](SyntheticsApi.md#getAPITestLatestResults) | **GET** /api/v1/synthetics/tests/{public_id}/results | Get the test&#39;s latest results summaries (API)
1010
[**getAPITestResult**](SyntheticsApi.md#getAPITestResult) | **GET** /api/v1/synthetics/tests/{public_id}/results/{result_id} | Get a test result (API)
11+
[**getBrowserTest**](SyntheticsApi.md#getBrowserTest) | **GET** /api/v1/synthetics/tests/browser/{public_id} | Get a browser test configuration
1112
[**getBrowserTestLatestResults**](SyntheticsApi.md#getBrowserTestLatestResults) | **GET** /api/v1/synthetics/tests/browser/{public_id}/results | Get the test&#39;s latest results summaries (browser)
1213
[**getBrowserTestResult**](SyntheticsApi.md#getBrowserTestResult) | **GET** /api/v1/synthetics/tests/browser/{public_id}/results/{result_id} | Get a test result (browser)
1314
[**getTest**](SyntheticsApi.md#getTest) | **GET** /api/v1/synthetics/tests/{public_id} | Get a test configuration
@@ -19,7 +20,7 @@ Method | HTTP request | Description
1920

2021
## createTest
2122

22-
> SyntheticsTestDetails createTest().body(body).fromTestId(fromTestId).execute();
23+
> SyntheticsTestDetails createTest().body(body).execute();
2324
2425
Create a test
2526

@@ -54,11 +55,9 @@ public class Example {
5455

5556
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
5657
SyntheticsTestDetails body = new SyntheticsTestDetails(); // SyntheticsTestDetails | Details of the test to create.
57-
String fromTestId = "fromTestId_example"; // String | Public ID of the test to clone, undefined if the test is newly created.
5858
try {
5959
SyntheticsTestDetails result = api.createTest()
6060
.body(body)
61-
.fromTestId(fromTestId)
6261
.execute();
6362
System.out.println(result);
6463
} catch (ApiException e) {
@@ -78,7 +77,6 @@ public class Example {
7877
Name | Type | Description | Notes
7978
------------- | ------------- | ------------- | -------------
8079
**body** | [**SyntheticsTestDetails**](SyntheticsTestDetails.md)| Details of the test to create. |
81-
**fromTestId** | **String**| Public ID of the test to clone, undefined if the test is newly created. | [optional]
8280

8381
### Return type
8482

@@ -355,6 +353,86 @@ Name | Type | Description | Notes
355353
| **404** | - Synthetic is not activated for the user - Test or result is not owned by the user | - |
356354

357355

356+
## getBrowserTest
357+
358+
> SyntheticsTestDetails getBrowserTest(publicId).execute();
359+
360+
Get a browser test configuration
361+
362+
Get the detailed configuration (including steps) associated with a Synthetics browser test.
363+
364+
### Example
365+
366+
```java
367+
// Import classes:
368+
import com.datadog.api.v1.client.ApiClient;
369+
import com.datadog.api.v1.client.ApiException;
370+
import com.datadog.api.v1.client.Configuration;
371+
import com.datadog.api.v1.client.auth.*;
372+
import com.datadog.api.v1.client.models.*;
373+
import com.datadog.api.v1.client.api.SyntheticsApi;
374+
375+
public class Example {
376+
public static void main(String[] args) {
377+
ApiClient defaultClient = Configuration.getDefaultApiClient();
378+
// Configure the Datadog site to send API calls to
379+
HashMap<String, String> serverVariables = new HashMap<String, String>();
380+
String site = System.getenv("DD_SITE");
381+
if (site != null) {
382+
serverVariables.put("site", site);
383+
defaultClient.setServerVariables(serverVariables);
384+
}
385+
// Configure API key authorization:
386+
HashMap<String, String> secrets = new HashMap<String, String>();
387+
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
388+
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
389+
defaultClient.configureApiKeys(secrets);
390+
391+
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
392+
String publicId = "publicId_example"; // String | The public ID of the test to get details from.
393+
try {
394+
SyntheticsTestDetails result = api.getBrowserTest(publicId)
395+
.execute();
396+
System.out.println(result);
397+
} catch (ApiException e) {
398+
System.err.println("Exception when calling SyntheticsApi#getBrowserTest");
399+
System.err.println("Status code: " + e.getCode());
400+
System.err.println("Reason: " + e.getResponseBody());
401+
System.err.println("Response headers: " + e.getResponseHeaders());
402+
e.printStackTrace();
403+
}
404+
}
405+
}
406+
```
407+
408+
### Parameters
409+
410+
411+
Name | Type | Description | Notes
412+
------------- | ------------- | ------------- | -------------
413+
**publicId** | **String**| The public ID of the test to get details from. |
414+
415+
### Return type
416+
417+
[**SyntheticsTestDetails**](SyntheticsTestDetails.md)
418+
419+
### Authorization
420+
421+
[apiKeyAuth](../README.md#apiKeyAuth), [appKeyAuth](../README.md#appKeyAuth)
422+
423+
### HTTP request headers
424+
425+
- **Content-Type**: Not defined
426+
- **Accept**: application/json
427+
428+
### HTTP response details
429+
| Status code | Description | Response headers |
430+
|-------------|-------------|------------------|
431+
| **200** | OK | - |
432+
| **403** | Forbidden | - |
433+
| **404** | - Synthetic is not activated for the user - Test is not owned by the user | - |
434+
435+
358436
## getBrowserTestLatestResults
359437

360438
> SyntheticsGetBrowserTestLatestResultsResponse getBrowserTestLatestResults(publicId).fromTs(fromTs).toTs(toTs).probeDc(probeDc).execute();

api_docs/v1/SyntheticsStep.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
# SyntheticsStep
4+
5+
The steps used in a Synthetics browser test.
6+
## Properties
7+
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**allowFailure** | **Boolean** | A boolean set to allow this step to fail. | [optional]
11+
**name** | **String** | The name of the step. | [optional]
12+
**params** | **Object** | The parameters of the step. | [optional]
13+
**timeout** | [**BigDecimal**](BigDecimal.md) | The time before declaring a step failed. | [optional]
14+
**type** | [**SyntheticsStepType**](SyntheticsStepType.md) | | [optional]
15+
16+
17+

api_docs/v1/SyntheticsTestAuthor.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

api_docs/v1/SyntheticsTestDetails.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ Object containing details about your Synthetic test.
88
Name | Type | Description | Notes
99
------------ | ------------- | ------------- | -------------
1010
**config** | [**SyntheticsTestConfig**](SyntheticsTestConfig.md) | | [optional]
11-
**createdAt** | **String** | The test creation date. | [optional]
12-
**createdBy** | [**SyntheticsTestAuthor**](SyntheticsTestAuthor.md) | | [optional]
1311
**locations** | **List&lt;String&gt;** | Array of locations used to run the test. | [optional]
1412
**message** | **String** | Notification message associated with the test. | [optional]
15-
**modifiedAt** | **String** | Last timestamp the test was modified. | [optional]
16-
**modifiedBy** | [**SyntheticsTestAuthor**](SyntheticsTestAuthor.md) | | [optional]
1713
**monitorId** | **Long** | The associated monitor ID. | [optional]
1814
**name** | **String** | Name of the test. | [optional]
1915
**options** | [**SyntheticsTestOptions**](SyntheticsTestOptions.md) | | [optional]
2016
**publicId** | **String** | The test public ID. | [optional]
2117
**status** | [**SyntheticsTestPauseStatus**](SyntheticsTestPauseStatus.md) | | [optional]
18+
**steps** | [**List&lt;SyntheticsStep&gt;**](SyntheticsStep.md) | The steps of the test (only for browser tests). | [optional]
2219
**subtype** | [**SyntheticsTestDetailsSubType**](SyntheticsTestDetailsSubType.md) | | [optional]
2320
**tags** | **List&lt;String&gt;** | Array of tags attached to the test. | [optional]
2421
**type** | [**SyntheticsTestDetailsType**](SyntheticsTestDetailsType.md) | | [optional]

src/main/java/com/datadog/api/v1/client/api/SyntheticsApi.java

Lines changed: 102 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void setApiClient(ApiClient apiClient) {
5555
}
5656

5757

58-
private ApiResponse<SyntheticsTestDetails> createTestWithHttpInfo(SyntheticsTestDetails body, String fromTestId) throws ApiException {
58+
private ApiResponse<SyntheticsTestDetails> createTestWithHttpInfo(SyntheticsTestDetails body) throws ApiException {
5959
Object localVarPostBody = body;
6060

6161
// verify the required parameter 'body' is set
@@ -72,7 +72,6 @@ private ApiResponse<SyntheticsTestDetails> createTestWithHttpInfo(SyntheticsTest
7272
Map<String, String> localVarCookieParams = new HashMap<String, String>();
7373
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
7474

75-
localVarQueryParams.addAll(apiClient.parameterToPairs("", "from_test_id", fromTestId));
7675

7776
// Set Operation-ID header for telemetry
7877
localVarHeaderParams.put("DD-OPERATION-ID", "createTest");
@@ -101,7 +100,6 @@ private ApiResponse<SyntheticsTestDetails> createTestWithHttpInfo(SyntheticsTest
101100

102101
public class APIcreateTestRequest {
103102
private SyntheticsTestDetails body;
104-
private String fromTestId;
105103

106104
private APIcreateTestRequest() {
107105
}
@@ -116,16 +114,6 @@ public APIcreateTestRequest body(SyntheticsTestDetails body) {
116114
return this;
117115
}
118116

119-
/**
120-
* Set fromTestId
121-
* @param fromTestId Public ID of the test to clone, undefined if the test is newly created. (optional)
122-
* @return APIcreateTestRequest
123-
*/
124-
public APIcreateTestRequest fromTestId(String fromTestId) {
125-
this.fromTestId = fromTestId;
126-
return this;
127-
}
128-
129117
/**
130118
* Execute createTest request
131119
* @return SyntheticsTestDetails
@@ -160,7 +148,7 @@ public SyntheticsTestDetails execute() throws ApiException {
160148
161149
*/
162150
public ApiResponse<SyntheticsTestDetails> executeWithHttpInfo() throws ApiException {
163-
return createTestWithHttpInfo(body, fromTestId);
151+
return createTestWithHttpInfo(body);
164152
}
165153
}
166154

@@ -530,6 +518,106 @@ public APIgetAPITestResultRequest getAPITestResult(String publicId, String resul
530518
return new APIgetAPITestResultRequest(publicId, resultId);
531519
}
532520

521+
private ApiResponse<SyntheticsTestDetails> getBrowserTestWithHttpInfo(String publicId) throws ApiException {
522+
Object localVarPostBody = null;
523+
524+
// verify the required parameter 'publicId' is set
525+
if (publicId == null) {
526+
throw new ApiException(400, "Missing the required parameter 'publicId' when calling getBrowserTest");
527+
}
528+
529+
// create path and map variables
530+
String localVarPath = "/api/v1/synthetics/tests/browser/{public_id}"
531+
.replaceAll("\\{" + "public_id" + "\\}", apiClient.escapeString(publicId.toString()));
532+
533+
// query params
534+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
535+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
536+
Map<String, String> localVarCookieParams = new HashMap<String, String>();
537+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
538+
539+
540+
// Set Operation-ID header for telemetry
541+
localVarHeaderParams.put("DD-OPERATION-ID", "getBrowserTest");
542+
543+
544+
545+
546+
final String[] localVarAccepts = {
547+
"application/json"
548+
};
549+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
550+
551+
final String[] localVarContentTypes = {
552+
553+
};
554+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
555+
556+
String[] localVarAuthNames = new String[] { "apiKeyAuth", "appKeyAuth" };
557+
558+
GenericType<SyntheticsTestDetails> localVarReturnType = new GenericType<SyntheticsTestDetails>() {};
559+
560+
return apiClient.invokeAPI("SyntheticsApi.getBrowserTest", localVarPath, "GET", localVarQueryParams, localVarPostBody,
561+
localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType,
562+
localVarAuthNames, localVarReturnType, null);
563+
}
564+
565+
public class APIgetBrowserTestRequest {
566+
private String publicId;
567+
568+
private APIgetBrowserTestRequest(String publicId) {
569+
this.publicId = publicId;
570+
}
571+
572+
/**
573+
* Execute getBrowserTest request
574+
* @return SyntheticsTestDetails
575+
* @throws ApiException if fails to make API call
576+
* @http.response.details
577+
<table summary="Response Details" border="1">
578+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
579+
<tr><td> 200 </td><td> OK </td><td> - </td></tr>
580+
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
581+
<tr><td> 404 </td><td> - Synthetic is not activated for the user - Test is not owned by the user </td><td> - </td></tr>
582+
</table>
583+
584+
*/
585+
586+
public SyntheticsTestDetails execute() throws ApiException {
587+
return this.executeWithHttpInfo().getData();
588+
}
589+
590+
/**
591+
* Execute getBrowserTest request with HTTP info returned
592+
* @return ApiResponse&lt;SyntheticsTestDetails&gt;
593+
* @throws ApiException if fails to make API call
594+
* @http.response.details
595+
<table summary="Response Details" border="1">
596+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
597+
<tr><td> 200 </td><td> OK </td><td> - </td></tr>
598+
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
599+
<tr><td> 404 </td><td> - Synthetic is not activated for the user - Test is not owned by the user </td><td> - </td></tr>
600+
</table>
601+
602+
*/
603+
public ApiResponse<SyntheticsTestDetails> executeWithHttpInfo() throws ApiException {
604+
return getBrowserTestWithHttpInfo(publicId);
605+
}
606+
}
607+
608+
/**
609+
* Get a browser test configuration
610+
* Get the detailed configuration (including steps) associated with a Synthetics browser test.
611+
* @param publicId The public ID of the test to get details from. (required)
612+
* @return getBrowserTestRequest
613+
* @throws ApiException if fails to make API call
614+
615+
616+
*/
617+
public APIgetBrowserTestRequest getBrowserTest(String publicId) throws ApiException {
618+
return new APIgetBrowserTestRequest(publicId);
619+
}
620+
533621
private ApiResponse<SyntheticsGetBrowserTestLatestResultsResponse> getBrowserTestLatestResultsWithHttpInfo(String publicId, Long fromTs, Long toTs, List<String> probeDc) throws ApiException {
534622
Object localVarPostBody = null;
535623

0 commit comments

Comments
 (0)