From 77a185def8ac129f919573cff232f4f83a0bc81d Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:27:03 +0000 Subject: [PATCH] Add Synthetics endpoint to fetch uptimes in API spec (#1792) * add support for top level indexing * Regenerate client from commit 3b4747f4 of spec repo --------- Co-authored-by: Sherzod Karimov Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 143 ++++++++++++++++++ .../frozen.json | 1 + .../recording.har | 67 ++++++++ .../frozen.json | 1 + .../recording.har | 67 ++++++++ examples/v1/synthetics/FetchUptimes.ts | 25 +++ features/support/scenarios_model_mapping.ts | 7 + features/support/templating.ts | 3 + features/v1/synthetics.feature | 17 +++ features/v1/undo.json | 6 + .../apis/SyntheticsApi.ts | 135 +++++++++++++++++ packages/datadog-api-client-v1/index.ts | 4 + .../models/ObjectSerializer.ts | 6 + .../models/SyntheticsFetchUptimesPayload.ts | 73 +++++++++ .../models/SyntheticsTestUptime.ts | 79 ++++++++++ .../models/SyntheticsUptime.ts | 92 +++++++++++ 17 files changed, 730 insertions(+), 4 deletions(-) create mode 100644 cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/frozen.json create mode 100644 cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/recording.har create mode 100644 cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/frozen.json create mode 100644 cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/recording.har create mode 100644 examples/v1/synthetics/FetchUptimes.ts create mode 100644 packages/datadog-api-client-v1/models/SyntheticsFetchUptimesPayload.ts create mode 100644 packages/datadog-api-client-v1/models/SyntheticsTestUptime.ts create mode 100644 packages/datadog-api-client-v1/models/SyntheticsUptime.ts diff --git a/.apigentools-info b/.apigentools-info index 4754d4af8e4..06a84d6455a 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-02 13:39:26.970748", - "spec_repo_commit": "e02e4f4c" + "regenerated": "2024-10-02 14:33:57.486086", + "spec_repo_commit": "3b4747f4" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-02 13:39:26.985809", - "spec_repo_commit": "e02e4f4c" + "regenerated": "2024-10-02 14:33:57.582216", + "spec_repo_commit": "3b4747f4" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index fa65f3a5d10..28ad73f8c53 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -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: @@ -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. @@ -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: @@ -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. diff --git a/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/frozen.json b/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/frozen.json new file mode 100644 index 00000000000..79a04ed657a --- /dev/null +++ b/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/frozen.json @@ -0,0 +1 @@ +"2024-10-02T14:22:00.562Z" diff --git a/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/recording.har b/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/recording.har new file mode 100644 index 00000000000..f2465a7baae --- /dev/null +++ b/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/recording.har @@ -0,0 +1,67 @@ +{ + "log": { + "_recordingName": "Synthetics/Fetch uptime for multiple tests returns \"- JSON format is wrong\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "23da9bb74dd412c237ee8406f9945944", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 39, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 570, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"from_ts\":0,\"public_ids\":[],\"to_ts\":0}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/synthetics/tests/uptimes" + }, + "response": { + "bodySize": 79, + "content": { + "mimeType": "application/json", + "size": 79, + "text": "{\"errors\":[\"Minimum number of elements in parameter 'public_ids' should be 1\"]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 664, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 400, + "statusText": "Bad Request" + }, + "startedDateTime": "2024-10-02T14:22:00.573Z", + "time": 81 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/frozen.json b/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/frozen.json new file mode 100644 index 00000000000..2093548a11d --- /dev/null +++ b/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/frozen.json @@ -0,0 +1 @@ +"2024-09-11T13:09:28.349Z" diff --git a/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/recording.har b/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/recording.har new file mode 100644 index 00000000000..298bf7bd85a --- /dev/null +++ b/cassettes/v1/Synthetics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/recording.har @@ -0,0 +1,67 @@ +{ + "log": { + "_recordingName": "Synthetics/Fetch uptime for multiple tests returns \"OK.\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "5bb349ef4e2317c9387395651078521d", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 70, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 570, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"from_ts\":1726041488,\"public_ids\":[\"p8m-9gw-nte\"],\"to_ts\":1726055954}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/synthetics/tests/uptimes" + }, + "response": { + "bodySize": 314, + "content": { + "mimeType": "application/json", + "size": 314, + "text": "[{\"from_ts\":1726041488,\"to_ts\":1726055954,\"overall\":{\"name\":\"[Synthetics] Synthetics test\",\"preview\":false,\"monitor_type\":\"synthetics alert\",\"monitor_modified\":1726060063,\"errors\":null,\"span_precision\":0,\"history\":[[1726004543,0],[1726053503,1]],\"uptime\":83.05682373046875},\"public_id\":\"p8m-9gw-nte\",\"groups\":[]}]\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 665, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2024-09-11T13:09:28.358Z", + "time": 508 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/examples/v1/synthetics/FetchUptimes.ts b/examples/v1/synthetics/FetchUptimes.ts new file mode 100644 index 00000000000..0babadff65e --- /dev/null +++ b/examples/v1/synthetics/FetchUptimes.ts @@ -0,0 +1,25 @@ +/** + * Fetch uptime for multiple tests returns "OK." response + */ + +import { client, v1 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v1.SyntheticsApi(configuration); + +const params: v1.SyntheticsApiFetchUptimesRequest = { + body: { + fromTs: 1726041488, + publicIds: ["p8m-9gw-nte"], + toTs: 1726055954, + }, +}; + +apiInstance + .fetchUptimes(params) + .then((data: v1.SyntheticsTestUptime[]) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 992314134ab..54d3e6ce632 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -2108,6 +2108,13 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "SyntheticsTriggerCITestsResponse", }, + "v1.FetchUptimes": { + "body": { + "type": "SyntheticsFetchUptimesPayload", + "format": "", + }, + "operationResponseType": "Array", + }, "v1.GetTest": { "publicId": { "type": "string", diff --git a/features/support/templating.ts b/features/support/templating.ts index 705f94efd87..7396d5975d2 100644 --- a/features/support/templating.ts +++ b/features/support/templating.ts @@ -125,6 +125,9 @@ function pathLookup(data: any, dottedPath: string): any { continue; } for (const part of dotPath.split("[")) { + if (part === "") { + continue; + } if (part.includes("]")) { const results = result as any[]; result = results[parseInt(part)]; diff --git a/features/v1/synthetics.feature b/features/v1/synthetics.feature index d2e4068308d..c5e2eae1bdf 100644 --- a/features/v1/synthetics.feature +++ b/features/v1/synthetics.feature @@ -469,6 +469,23 @@ Feature: Synthetics Then the response status is 200 OK And the response "name" is equal to "{{ synthetics_api_test.name }}-updated" + @team:DataDog/synthetics-ct + Scenario: Fetch uptime for multiple tests returns "- JSON format is wrong" response + Given new "FetchUptimes" request + And body with value {"from_ts": 0, "public_ids": [], "to_ts": 0} + When the request is sent + Then the response status is 400 - JSON format is wrong + + @replay-only @team:DataDog/synthetics-ct + Scenario: Fetch uptime for multiple tests returns "OK." response + Given new "FetchUptimes" request + And body with value {"from_ts": 1726041488, "public_ids": ["p8m-9gw-nte"], "to_ts": 1726055954} + When the request is sent + Then the response status is 200 OK + And the response "[0].public_id" is equal to "p8m-9gw-nte" + And the response "[0].overall.uptime" is equal to 83.05682373046875 + And the response "[0].overall.history" has length 2 + @generated @skip @team:DataDog/synthetics-ct Scenario: Get a Mobile test returns "- Synthetic Monitoring is not activated for the user" response Given new "GetMobileTest" request diff --git a/features/v1/undo.json b/features/v1/undo.json index a6bfcfb9a25..85e17f2caf4 100644 --- a/features/v1/undo.json +++ b/features/v1/undo.json @@ -1233,6 +1233,12 @@ "type": "idempotent" } }, + "FetchUptimes": { + "tag": "Synthetics", + "undo": { + "type": "idempotent" + } + }, "GetTest": { "tag": "Synthetics", "undo": { diff --git a/packages/datadog-api-client-v1/apis/SyntheticsApi.ts b/packages/datadog-api-client-v1/apis/SyntheticsApi.ts index 198991d3d74..9a5cbc80aa9 100644 --- a/packages/datadog-api-client-v1/apis/SyntheticsApi.ts +++ b/packages/datadog-api-client-v1/apis/SyntheticsApi.ts @@ -25,6 +25,7 @@ import { SyntheticsBrowserTestResultFull } from "../models/SyntheticsBrowserTest import { SyntheticsCITestBody } from "../models/SyntheticsCITestBody"; import { SyntheticsDeleteTestsPayload } from "../models/SyntheticsDeleteTestsPayload"; import { SyntheticsDeleteTestsResponse } from "../models/SyntheticsDeleteTestsResponse"; +import { SyntheticsFetchUptimesPayload } from "../models/SyntheticsFetchUptimesPayload"; import { SyntheticsGetAPITestLatestResultsResponse } from "../models/SyntheticsGetAPITestLatestResultsResponse"; import { SyntheticsGetBrowserTestLatestResultsResponse } from "../models/SyntheticsGetBrowserTestLatestResultsResponse"; import { SyntheticsGlobalVariable } from "../models/SyntheticsGlobalVariable"; @@ -37,6 +38,7 @@ import { SyntheticsPatchTestBody } from "../models/SyntheticsPatchTestBody"; import { SyntheticsPrivateLocation } from "../models/SyntheticsPrivateLocation"; import { SyntheticsPrivateLocationCreationResponse } from "../models/SyntheticsPrivateLocationCreationResponse"; import { SyntheticsTestDetails } from "../models/SyntheticsTestDetails"; +import { SyntheticsTestUptime } from "../models/SyntheticsTestUptime"; import { SyntheticsTriggerBody } from "../models/SyntheticsTriggerBody"; import { SyntheticsTriggerCITestsResponse } from "../models/SyntheticsTriggerCITestsResponse"; import { SyntheticsUpdateTestPauseStatusPayload } from "../models/SyntheticsUpdateTestPauseStatusPayload"; @@ -414,6 +416,48 @@ export class SyntheticsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async fetchUptimes( + body: SyntheticsFetchUptimesPayload, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "fetchUptimes"); + } + + // Path Params + const localVarPath = "/api/v1/synthetics/tests/uptimes"; + + // Make Request Context + const requestContext = _config + .getServer("v1.SyntheticsApi.fetchUptimes") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "SyntheticsFetchUptimesPayload", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async getAPITest( publicId: string, _options?: Configuration @@ -1910,6 +1954,68 @@ 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 fetchUptimes + * @throws ApiException if the response code was not in [200, 299] + */ + public async fetchUptimes( + response: ResponseContext + ): Promise> { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: Array = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Array" + ) as Array; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Array = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Array", + "" + ) as Array; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + 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 @@ -3399,6 +3505,14 @@ export interface SyntheticsApiEditGlobalVariableRequest { body: SyntheticsGlobalVariableRequest; } +export interface SyntheticsApiFetchUptimesRequest { + /** + * Public ID list of the Synthetic tests and timeframe. + * @type SyntheticsFetchUptimesPayload + */ + body: SyntheticsFetchUptimesPayload; +} + export interface SyntheticsApiGetAPITestRequest { /** * The public ID of the test to get details from. @@ -3845,6 +3959,27 @@ export class SyntheticsApi { }); } + /** + * Fetch uptime for multiple Synthetic tests by ID. + * @param param The request object + */ + public fetchUptimes( + param: SyntheticsApiFetchUptimesRequest, + options?: Configuration + ): Promise> { + const requestContextPromise = this.requestFactory.fetchUptimes( + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.fetchUptimes(responseContext); + }); + }); + } + /** * Get the detailed configuration associated with * a Synthetic API test. diff --git a/packages/datadog-api-client-v1/index.ts b/packages/datadog-api-client-v1/index.ts index c6e05d3e75b..9ade78bc125 100644 --- a/packages/datadog-api-client-v1/index.ts +++ b/packages/datadog-api-client-v1/index.ts @@ -237,6 +237,7 @@ export { SyntheticsApiDeletePrivateLocationRequest, SyntheticsApiDeleteTestsRequest, SyntheticsApiEditGlobalVariableRequest, + SyntheticsApiFetchUptimesRequest, SyntheticsApiGetAPITestRequest, SyntheticsApiGetAPITestLatestResultsRequest, SyntheticsApiGetAPITestResultRequest, @@ -939,6 +940,7 @@ export { SyntheticsDeleteTestsPayload } from "./models/SyntheticsDeleteTestsPayl export { SyntheticsDeleteTestsResponse } from "./models/SyntheticsDeleteTestsResponse"; export { SyntheticsDevice } from "./models/SyntheticsDevice"; export { SyntheticsDeviceID } from "./models/SyntheticsDeviceID"; +export { SyntheticsFetchUptimesPayload } from "./models/SyntheticsFetchUptimesPayload"; export { SyntheticsGetAPITestLatestResultsResponse } from "./models/SyntheticsGetAPITestLatestResultsResponse"; export { SyntheticsGetBrowserTestLatestResultsResponse } from "./models/SyntheticsGetBrowserTestLatestResultsResponse"; export { SyntheticsGlobalVariable } from "./models/SyntheticsGlobalVariable"; @@ -1015,6 +1017,7 @@ export { SyntheticsTestRequestCertificate } from "./models/SyntheticsTestRequest export { SyntheticsTestRequestCertificateItem } from "./models/SyntheticsTestRequestCertificateItem"; export { SyntheticsTestRequestPort } from "./models/SyntheticsTestRequestPort"; export { SyntheticsTestRequestProxy } from "./models/SyntheticsTestRequestProxy"; +export { SyntheticsTestUptime } from "./models/SyntheticsTestUptime"; export { SyntheticsTiming } from "./models/SyntheticsTiming"; export { SyntheticsTriggerBody } from "./models/SyntheticsTriggerBody"; export { SyntheticsTriggerCITestLocation } from "./models/SyntheticsTriggerCITestLocation"; @@ -1022,6 +1025,7 @@ export { SyntheticsTriggerCITestRunResult } from "./models/SyntheticsTriggerCITe export { SyntheticsTriggerCITestsResponse } from "./models/SyntheticsTriggerCITestsResponse"; export { SyntheticsTriggerTest } from "./models/SyntheticsTriggerTest"; export { SyntheticsUpdateTestPauseStatusPayload } from "./models/SyntheticsUpdateTestPauseStatusPayload"; +export { SyntheticsUptime } from "./models/SyntheticsUptime"; export { SyntheticsVariableParser } from "./models/SyntheticsVariableParser"; export { SyntheticsWarningType } from "./models/SyntheticsWarningType"; export { TableWidgetCellDisplayMode } from "./models/TableWidgetCellDisplayMode"; diff --git a/packages/datadog-api-client-v1/models/ObjectSerializer.ts b/packages/datadog-api-client-v1/models/ObjectSerializer.ts index 0dda71aa2ba..dd313b003ad 100644 --- a/packages/datadog-api-client-v1/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v1/models/ObjectSerializer.ts @@ -435,6 +435,7 @@ import { SyntheticsDeleteTestsPayload } from "./SyntheticsDeleteTestsPayload"; import { SyntheticsDeleteTestsResponse } from "./SyntheticsDeleteTestsResponse"; import { SyntheticsDeletedTest } from "./SyntheticsDeletedTest"; import { SyntheticsDevice } from "./SyntheticsDevice"; +import { SyntheticsFetchUptimesPayload } from "./SyntheticsFetchUptimesPayload"; import { SyntheticsGetAPITestLatestResultsResponse } from "./SyntheticsGetAPITestLatestResultsResponse"; import { SyntheticsGetBrowserTestLatestResultsResponse } from "./SyntheticsGetBrowserTestLatestResultsResponse"; import { SyntheticsGlobalVariable } from "./SyntheticsGlobalVariable"; @@ -488,6 +489,7 @@ import { SyntheticsTestRequestBodyFile } from "./SyntheticsTestRequestBodyFile"; import { SyntheticsTestRequestCertificate } from "./SyntheticsTestRequestCertificate"; import { SyntheticsTestRequestCertificateItem } from "./SyntheticsTestRequestCertificateItem"; import { SyntheticsTestRequestProxy } from "./SyntheticsTestRequestProxy"; +import { SyntheticsTestUptime } from "./SyntheticsTestUptime"; import { SyntheticsTiming } from "./SyntheticsTiming"; import { SyntheticsTriggerBody } from "./SyntheticsTriggerBody"; import { SyntheticsTriggerCITestLocation } from "./SyntheticsTriggerCITestLocation"; @@ -495,6 +497,7 @@ import { SyntheticsTriggerCITestRunResult } from "./SyntheticsTriggerCITestRunRe import { SyntheticsTriggerCITestsResponse } from "./SyntheticsTriggerCITestsResponse"; import { SyntheticsTriggerTest } from "./SyntheticsTriggerTest"; import { SyntheticsUpdateTestPauseStatusPayload } from "./SyntheticsUpdateTestPauseStatusPayload"; +import { SyntheticsUptime } from "./SyntheticsUptime"; import { SyntheticsVariableParser } from "./SyntheticsVariableParser"; import { TableWidgetDefinition } from "./TableWidgetDefinition"; import { TableWidgetRequest } from "./TableWidgetRequest"; @@ -2319,6 +2322,7 @@ const typeMap: { [index: string]: any } = { SyntheticsDeleteTestsResponse: SyntheticsDeleteTestsResponse, SyntheticsDeletedTest: SyntheticsDeletedTest, SyntheticsDevice: SyntheticsDevice, + SyntheticsFetchUptimesPayload: SyntheticsFetchUptimesPayload, SyntheticsGetAPITestLatestResultsResponse: SyntheticsGetAPITestLatestResultsResponse, SyntheticsGetBrowserTestLatestResultsResponse: @@ -2385,6 +2389,7 @@ const typeMap: { [index: string]: any } = { SyntheticsTestRequestCertificate: SyntheticsTestRequestCertificate, SyntheticsTestRequestCertificateItem: SyntheticsTestRequestCertificateItem, SyntheticsTestRequestProxy: SyntheticsTestRequestProxy, + SyntheticsTestUptime: SyntheticsTestUptime, SyntheticsTiming: SyntheticsTiming, SyntheticsTriggerBody: SyntheticsTriggerBody, SyntheticsTriggerCITestLocation: SyntheticsTriggerCITestLocation, @@ -2393,6 +2398,7 @@ const typeMap: { [index: string]: any } = { SyntheticsTriggerTest: SyntheticsTriggerTest, SyntheticsUpdateTestPauseStatusPayload: SyntheticsUpdateTestPauseStatusPayload, + SyntheticsUptime: SyntheticsUptime, SyntheticsVariableParser: SyntheticsVariableParser, TableWidgetDefinition: TableWidgetDefinition, TableWidgetRequest: TableWidgetRequest, diff --git a/packages/datadog-api-client-v1/models/SyntheticsFetchUptimesPayload.ts b/packages/datadog-api-client-v1/models/SyntheticsFetchUptimesPayload.ts new file mode 100644 index 00000000000..68b464cbaaf --- /dev/null +++ b/packages/datadog-api-client-v1/models/SyntheticsFetchUptimesPayload.ts @@ -0,0 +1,73 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Object containing IDs of Synthetic tests and a timeframe. + */ +export class SyntheticsFetchUptimesPayload { + /** + * Timestamp in seconds (Unix epoch) for the start of uptime. + */ + "fromTs": number; + /** + * An array of Synthetic test IDs you want to delete. + */ + "publicIds": Array; + /** + * Timestamp in seconds (Unix epoch) for the end of uptime. + */ + "toTs": number; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + fromTs: { + baseName: "from_ts", + type: "number", + required: true, + format: "int64", + }, + publicIds: { + baseName: "public_ids", + type: "Array", + required: true, + }, + toTs: { + baseName: "to_ts", + type: "number", + required: true, + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return SyntheticsFetchUptimesPayload.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v1/models/SyntheticsTestUptime.ts b/packages/datadog-api-client-v1/models/SyntheticsTestUptime.ts new file mode 100644 index 00000000000..3e2ef70513c --- /dev/null +++ b/packages/datadog-api-client-v1/models/SyntheticsTestUptime.ts @@ -0,0 +1,79 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { SyntheticsUptime } from "./SyntheticsUptime"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Object containing the uptime for a Synthetic test ID. + */ +export class SyntheticsTestUptime { + /** + * Timestamp in seconds for the start of uptime. + */ + "fromTs"?: number; + /** + * Object containing the uptime information. + */ + "overall"?: SyntheticsUptime; + /** + * A Synthetic test ID. + */ + "publicId"?: string; + /** + * Timestamp in seconds for the end of uptime. + */ + "toTs"?: number; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + fromTs: { + baseName: "from_ts", + type: "number", + format: "int64", + }, + overall: { + baseName: "overall", + type: "SyntheticsUptime", + }, + publicId: { + baseName: "public_id", + type: "string", + }, + toTs: { + baseName: "to_ts", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return SyntheticsTestUptime.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v1/models/SyntheticsUptime.ts b/packages/datadog-api-client-v1/models/SyntheticsUptime.ts new file mode 100644 index 00000000000..59ac6f088cd --- /dev/null +++ b/packages/datadog-api-client-v1/models/SyntheticsUptime.ts @@ -0,0 +1,92 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { SLOHistoryResponseErrorWithType } from "./SLOHistoryResponseErrorWithType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Object containing the uptime information. + */ +export class SyntheticsUptime { + /** + * An array of error objects returned while querying the history data for the service level objective. + */ + "errors"?: Array; + /** + * The location name + */ + "group"?: string; + /** + * 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. + */ + "history"?: Array<[number, number]>; + /** + * The number of decimal places to which the SLI value is accurate for the given from-to timestamps. + */ + "spanPrecision"?: number; + /** + * The overall uptime. + */ + "uptime"?: number; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + }, + group: { + baseName: "group", + type: "string", + }, + history: { + baseName: "history", + type: "Array<[number, number]>", + format: "double", + }, + spanPrecision: { + baseName: "span_precision", + type: "number", + format: "double", + }, + uptime: { + baseName: "uptime", + type: "number", + format: "double", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return SyntheticsUptime.attributeTypeMap; + } + + public constructor() {} +}