Skip to content

Commit

Permalink
Regenerate client from commit 1dc9f35 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Nov 9, 2021
1 parent 8097752 commit 8d487e3
Show file tree
Hide file tree
Showing 14 changed files with 440 additions and 4 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.5.1.dev2",
"regenerated": "2021-11-09 09:32:41.902363",
"spec_repo_commit": "66dd726"
"regenerated": "2021-11-09 10:43:53.860764",
"spec_repo_commit": "1dc9f35"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2021-11-09 09:32:41.936003",
"spec_repo_commit": "66dd726"
"regenerated": "2021-11-09 10:43:53.891574",
"spec_repo_commit": "1dc9f35"
}
}
}
53 changes: 53 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11056,6 +11056,17 @@ components:
format: double
type: number
type: object
SyntheticsTriggerBody:
description: Object describing the synthetics tests to trigger.
properties:
tests:
description: Individual synthetics test.
items:
$ref: '#/components/schemas/SyntheticsTriggerTest'
type: array
required:
- tests
type: object
SyntheticsTriggerCITestLocation:
description: Synthetics location.
properties:
Expand Down Expand Up @@ -11106,6 +11117,18 @@ components:
type: string
type: array
type: object
SyntheticsTriggerTest:
description: Test configuration for Synthetics
properties:
metadata:
$ref: '#/components/schemas/SyntheticsCIBatchMetadata'
public_id:
description: The public ID of the Synthetics test to trigger.
example: aaa-aaa-aaa
type: string
required:
- public_id
type: object
SyntheticsUpdateTestPauseStatusPayload:
description: Object to start or pause an existing Synthetic test.
properties:
Expand Down Expand Up @@ -22528,6 +22551,36 @@ paths:
x-menu-order: 14
x-undo:
type: idempotent
/api/v1/synthetics/tests/trigger:
post:
description: Trigger a set of Synthetics tests.
operationId: TriggerTests
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SyntheticsTriggerBody'
description: The identifiers of the tests to trigger.
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/SyntheticsTriggerCITestsResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
summary: Trigger some Synthetics tests
tags:
- Synthetics
x-codegen-request-body-name: body
x-undo:
type: safe
/api/v1/synthetics/tests/trigger/ci:
post:
description: Trigger a set of Synthetics tests for continuous integration.
Expand Down
79 changes: 79 additions & 0 deletions docs/v1/SyntheticsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All URIs are relative to *https://api.datadoghq.com*
| [**listLocations**](SyntheticsApi.md#listLocations) | **GET** /api/v1/synthetics/locations | Get all locations (public and private) |
| [**listTests**](SyntheticsApi.md#listTests) | **GET** /api/v1/synthetics/tests | Get the list of all tests |
| [**triggerCITests**](SyntheticsApi.md#triggerCITests) | **POST** /api/v1/synthetics/tests/trigger/ci | Trigger tests from CI/CD pipelines |
| [**triggerTests**](SyntheticsApi.md#triggerTests) | **POST** /api/v1/synthetics/tests/trigger | Trigger some Synthetics tests |
| [**updateAPITest**](SyntheticsApi.md#updateAPITest) | **PUT** /api/v1/synthetics/tests/api/{public_id} | Edit an API test |
| [**updateBrowserTest**](SyntheticsApi.md#updateBrowserTest) | **PUT** /api/v1/synthetics/tests/browser/{public_id} | Edit a browser test |
| [**updatePrivateLocation**](SyntheticsApi.md#updatePrivateLocation) | **PUT** /api/v1/synthetics/private-locations/{location_id} | Edit a private location |
Expand Down Expand Up @@ -1656,6 +1657,84 @@ apiInstance

[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

## **triggerTests**

> SyntheticsTriggerCITestsResponse triggerTests(body)
Trigger a set of Synthetics tests.

### Example

```typescript
import { v1 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v1.createConfiguration();
const apiInstance = new v1.SyntheticsApi(configuration);

let params: v1.SyntheticsApiTriggerTestsRequest = {
// SyntheticsTriggerBody | The identifiers of the tests to trigger.
body: {
tests: [
{
metadata: {
ci: {
pipeline: {
url: "url_example",
},
provider: {
name: "name_example",
},
},
git: {
branch: "branch_example",
commitSha: "commitSha_example",
},
},
publicId: "aaa-aaa-aaa",
},
],
},
};

apiInstance
.triggerTests(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
```

### Parameters

| Name | Type | Description | Notes |
| -------- | ------------------------- | ---------------------------------------- | ----- |
| **body** | **SyntheticsTriggerBody** | The identifiers of the tests to trigger. |

### Return type

**SyntheticsTriggerCITestsResponse**

### Authorization

[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

### HTTP response details

| Status code | Description | Response headers |
| ----------- | ----------- | ---------------- |
| **200** | OK | - |
| **400** | Bad Request | - |

[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

## **updateAPITest**

> SyntheticsAPITest updateAPITest(body)
Expand Down
14 changes: 14 additions & 0 deletions features/v1/synthetics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,20 @@ Feature: Synthetics
When the request is sent
Then the response status is 200 OK - Returns a boolean indicating if the update was successful.

@generated @skip
Scenario: Trigger some Synthetics tests returns "Bad Request" response
Given new "TriggerTests" request
And body with value {"tests": [{"metadata": {"ci": {"pipeline": {"url": null}, "provider": {"name": null}}, "git": {"branch": null, "commitSha": null}}, "public_id": "aaa-aaa-aaa"}]}
When the request is sent
Then the response status is 400 Bad Request

Scenario: Trigger some Synthetics tests returns "OK" response
Given there is a valid "synthetics_api_test" in the system
And new "TriggerTests" request
And body with value {"tests": [{"metadata": {"ci": {"pipeline": {"url": null}, "provider": {"name": null}}, "git": {"branch": null, "commitSha": null}}, "public_id": "{{ synthetics_api_test.public_id }}"}]}
When the request is sent
Then the response status is 200 OK

@generated @skip
Scenario: Trigger tests from CI/CD pipelines returns "JSON format is wrong" response
Given new "TriggerCITests" request
Expand Down
6 changes: 6 additions & 0 deletions features/v1/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,12 @@
"type": "idempotent"
}
},
"TriggerTests": {
"tag": "Synthetics",
"undo": {
"type": "safe"
}
},
"TriggerCITests": {
"tag": "Synthetics",
"undo": {
Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-api-client-v1/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,11 @@ models/SyntheticsTestRequest.ts
models/SyntheticsTestRequestCertificate.ts
models/SyntheticsTestRequestCertificateItem.ts
models/SyntheticsTiming.ts
models/SyntheticsTriggerBody.ts
models/SyntheticsTriggerCITestLocation.ts
models/SyntheticsTriggerCITestRunResult.ts
models/SyntheticsTriggerCITestsResponse.ts
models/SyntheticsTriggerTest.ts
models/SyntheticsUpdateTestPauseStatusPayload.ts
models/SyntheticsVariableParser.ts
models/SyntheticsWarningType.ts
Expand Down
111 changes: 111 additions & 0 deletions packages/datadog-api-client-v1/apis/SyntheticsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { SyntheticsLocations } from "../models/SyntheticsLocations";
import { SyntheticsPrivateLocation } from "../models/SyntheticsPrivateLocation";
import { SyntheticsPrivateLocationCreationResponse } from "../models/SyntheticsPrivateLocationCreationResponse";
import { SyntheticsTestDetails } from "../models/SyntheticsTestDetails";
import { SyntheticsTriggerBody } from "../models/SyntheticsTriggerBody";
import { SyntheticsTriggerCITestsResponse } from "../models/SyntheticsTriggerCITestsResponse";
import { SyntheticsUpdateTestPauseStatusPayload } from "../models/SyntheticsUpdateTestPauseStatusPayload";

Expand Down Expand Up @@ -1396,6 +1397,67 @@ export class SyntheticsApiRequestFactory extends BaseAPIRequestFactory {
return requestContext;
}

/**
* Trigger a set of Synthetics tests.
* Trigger some Synthetics tests
* @param body The identifiers of the tests to trigger.
*/
public async triggerTests(
body: SyntheticsTriggerBody,
_options?: Configuration
): Promise<RequestContext> {
const _config = _options || this.configuration;

// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError(
"Required parameter body was null or undefined when calling triggerTests."
);
}

// Path Params
const localVarPath = "/api/v1/synthetics/tests/trigger";

// Make Request Context
const requestContext = getServer(
_config,
"SyntheticsApi.triggerTests"
).makeRequestContext(localVarPath, HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
requestContext.setHttpConfig(_config.httpConfig);

// Query Params

// Header Params

// Form Params

// Body Params
const contentType = ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "SyntheticsTriggerBody", ""),
contentType
);
requestContext.setBody(serializedBody);

let authMethod = null;
// Apply auth methods
authMethod = _config.authMethods["apiKeyAuth"];
if (authMethod) {
await authMethod.applySecurityAuthentication(requestContext);
}
// Apply auth methods
authMethod = _config.authMethods["appKeyAuth"];
if (authMethod) {
await authMethod.applySecurityAuthentication(requestContext);
}

return requestContext;
}

/**
* Edit the configuration of a Synthetic API test.
* Edit an API test
Expand Down Expand Up @@ -2894,6 +2956,55 @@ export class SyntheticsApiResponseProcessor {
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to triggerTests
* @throws ApiException if the response code was not in [200, 299]
*/
public async triggerTests(
response: ResponseContext
): Promise<SyntheticsTriggerCITestsResponse> {
const contentType = ObjectSerializer.normalizeMediaType(
response.headers["content-type"]
);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: SyntheticsTriggerCITestsResponse =
ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"SyntheticsTriggerCITestsResponse",
""
) as SyntheticsTriggerCITestsResponse;
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) {
const body: APIErrorResponse = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"APIErrorResponse",
""
) as APIErrorResponse;
throw new ApiException<APIErrorResponse>(400, body);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: SyntheticsTriggerCITestsResponse =
ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"SyntheticsTriggerCITestsResponse",
""
) as SyntheticsTriggerCITestsResponse;
return body;
}

const body = (await response.body.text()) || "";
throw new ApiException<string>(
response.httpStatusCode,
'Unknown API Status Code!\nBody: "' + body + '"'
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client-v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export {
SyntheticsApiGetSyntheticsCIBatchRequest,
SyntheticsApiGetTestRequest,
SyntheticsApiTriggerCITestsRequest,
SyntheticsApiTriggerTestsRequest,
SyntheticsApiUpdateAPITestRequest,
SyntheticsApiUpdateBrowserTestRequest,
SyntheticsApiUpdatePrivateLocationRequest,
Expand Down
4 changes: 4 additions & 0 deletions packages/datadog-api-client-v1/models/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,11 @@ import { SyntheticsTestRequest } from "./SyntheticsTestRequest";
import { SyntheticsTestRequestCertificate } from "./SyntheticsTestRequestCertificate";
import { SyntheticsTestRequestCertificateItem } from "./SyntheticsTestRequestCertificateItem";
import { SyntheticsTiming } from "./SyntheticsTiming";
import { SyntheticsTriggerBody } from "./SyntheticsTriggerBody";
import { SyntheticsTriggerCITestLocation } from "./SyntheticsTriggerCITestLocation";
import { SyntheticsTriggerCITestRunResult } from "./SyntheticsTriggerCITestRunResult";
import { SyntheticsTriggerCITestsResponse } from "./SyntheticsTriggerCITestsResponse";
import { SyntheticsTriggerTest } from "./SyntheticsTriggerTest";
import { SyntheticsUpdateTestPauseStatusPayload } from "./SyntheticsUpdateTestPauseStatusPayload";
import { SyntheticsVariableParser } from "./SyntheticsVariableParser";
import { TableWidgetDefinition } from "./TableWidgetDefinition";
Expand Down Expand Up @@ -1363,9 +1365,11 @@ const typeMap: { [index: string]: any } = {
SyntheticsTestRequestCertificate: SyntheticsTestRequestCertificate,
SyntheticsTestRequestCertificateItem: SyntheticsTestRequestCertificateItem,
SyntheticsTiming: SyntheticsTiming,
SyntheticsTriggerBody: SyntheticsTriggerBody,
SyntheticsTriggerCITestLocation: SyntheticsTriggerCITestLocation,
SyntheticsTriggerCITestRunResult: SyntheticsTriggerCITestRunResult,
SyntheticsTriggerCITestsResponse: SyntheticsTriggerCITestsResponse,
SyntheticsTriggerTest: SyntheticsTriggerTest,
SyntheticsUpdateTestPauseStatusPayload:
SyntheticsUpdateTestPauseStatusPayload,
SyntheticsVariableParser: SyntheticsVariableParser,
Expand Down
Loading

0 comments on commit 8d487e3

Please sign in to comment.