Skip to content

Commit

Permalink
Regenerate client from commit 6046874 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Oct 28, 2021
1 parent f3edeac commit 9b2f8e2
Show file tree
Hide file tree
Showing 14 changed files with 434 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-10-27 12:49:54.845542",
"spec_repo_commit": "0b58986"
"regenerated": "2021-10-28 12:41:00.646977",
"spec_repo_commit": "6046874"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2021-10-27 12:49:54.873851",
"spec_repo_commit": "0b58986"
"regenerated": "2021-10-28 12:41:00.670531",
"spec_repo_commit": "6046874"
}
}
}
49 changes: 49 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11060,6 +11060,25 @@ components:
type: string
type: array
type: object
SyntheticsTriggerPublicIdentifiers:
description: List of identifiers of Synthetics tests to trigger.
properties:
public_ids:
description: An array of IDs of Synthetics tests to trigger.
example: []
items:
description: The ID of a Synthetics test to trigger.
example: abc-def-123
type: string
type: array
type: object
SyntheticsTriggerTestBody:
description: Either an object describing the Synthetics tests to trigger, or
a list of Synthetics test IDs.
oneOf:
- $ref: '#/components/schemas/SyntheticsTriggerPublicIdentifiers'
- $ref: '#/components/schemas/SyntheticsCITestBody'
type: object
SyntheticsUpdateTestPauseStatusPayload:
description: Object to start or pause an existing Synthetic test.
properties:
Expand Down Expand Up @@ -22359,6 +22378,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/SyntheticsTriggerTestBody'
description: 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
61 changes: 61 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 @@ -1652,6 +1653,66 @@ 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 = {
// SyntheticsTriggerTestBody | Identifiers of the tests to trigger.
body: {
publicIds: [],
},
};

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** | **SyntheticsTriggerTestBody** | 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 {"public_ids": []}
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 {"public_ids": ["{{ 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 @@ -541,6 +541,8 @@ models/SyntheticsTiming.ts
models/SyntheticsTriggerCITestLocation.ts
models/SyntheticsTriggerCITestRunResult.ts
models/SyntheticsTriggerCITestsResponse.ts
models/SyntheticsTriggerPublicIdentifiers.ts
models/SyntheticsTriggerTestBody.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 @@ -25,6 +25,7 @@ import { SyntheticsPrivateLocation } from "../models/SyntheticsPrivateLocation";
import { SyntheticsPrivateLocationCreationResponse } from "../models/SyntheticsPrivateLocationCreationResponse";
import { SyntheticsTestDetails } from "../models/SyntheticsTestDetails";
import { SyntheticsTriggerCITestsResponse } from "../models/SyntheticsTriggerCITestsResponse";
import { SyntheticsTriggerTestBody } from "../models/SyntheticsTriggerTestBody";
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 Identifiers of the tests to trigger.
*/
public async triggerTests(
body: SyntheticsTriggerTestBody,
_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, "SyntheticsTriggerTestBody", ""),
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 @@ -162,6 +162,7 @@ export {
SyntheticsApiGetSyntheticsCIBatchRequest,
SyntheticsApiGetTestRequest,
SyntheticsApiTriggerCITestsRequest,
SyntheticsApiTriggerTestsRequest,
SyntheticsApiUpdateAPITestRequest,
SyntheticsApiUpdateBrowserTestRequest,
SyntheticsApiUpdatePrivateLocationRequest,
Expand Down
6 changes: 6 additions & 0 deletions packages/datadog-api-client-v1/models/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ import { SyntheticsTiming } from "./SyntheticsTiming";
import { SyntheticsTriggerCITestLocation } from "./SyntheticsTriggerCITestLocation";
import { SyntheticsTriggerCITestRunResult } from "./SyntheticsTriggerCITestRunResult";
import { SyntheticsTriggerCITestsResponse } from "./SyntheticsTriggerCITestsResponse";
import { SyntheticsTriggerPublicIdentifiers } from "./SyntheticsTriggerPublicIdentifiers";
import { SyntheticsUpdateTestPauseStatusPayload } from "./SyntheticsUpdateTestPauseStatusPayload";
import { SyntheticsVariableParser } from "./SyntheticsVariableParser";
import { TableWidgetDefinition } from "./TableWidgetDefinition";
Expand Down Expand Up @@ -1019,6 +1020,7 @@ const typeMap: { [index: string]: any } = {
SyntheticsTriggerCITestLocation: SyntheticsTriggerCITestLocation,
SyntheticsTriggerCITestRunResult: SyntheticsTriggerCITestRunResult,
SyntheticsTriggerCITestsResponse: SyntheticsTriggerCITestsResponse,
SyntheticsTriggerPublicIdentifiers: SyntheticsTriggerPublicIdentifiers,
SyntheticsUpdateTestPauseStatusPayload:
SyntheticsUpdateTestPauseStatusPayload,
SyntheticsVariableParser: SyntheticsVariableParser,
Expand Down Expand Up @@ -1195,6 +1197,10 @@ const oneOfMap: { [index: string]: string[] } = {
"SyntheticsAssertionJSONPathTarget",
"SyntheticsAssertionTarget",
],
SyntheticsTriggerTestBody: [
"SyntheticsCITestBody",
"SyntheticsTriggerPublicIdentifiers",
],
WidgetDefinition: [
"AlertGraphWidgetDefinition",
"AlertValueWidgetDefinition",
Expand Down
Loading

0 comments on commit 9b2f8e2

Please sign in to comment.