diff --git a/.apigentools-info b/.apigentools-info index b7142392f2f..605e0b904d4 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.5.1.dev2", - "regenerated": "2021-10-12 09:02:05.158756", - "spec_repo_commit": "06c7795" + "regenerated": "2021-10-13 18:32:46.184063", + "spec_repo_commit": "b612d1b" }, "v2": { "apigentools_version": "1.5.1.dev2", - "regenerated": "2021-10-12 09:02:59.059051", - "spec_repo_commit": "06c7795" + "regenerated": "2021-10-13 18:33:39.862790", + "spec_repo_commit": "b612d1b" } } } \ No newline at end of file diff --git a/docs/v1/UsageMeteringApi.md b/docs/v1/UsageMeteringApi.md index fda3155dd33..5de5f40a7e8 100644 --- a/docs/v1/UsageMeteringApi.md +++ b/docs/v1/UsageMeteringApi.md @@ -29,6 +29,7 @@ All URIs are relative to *https://api.datadoghq.com* | [**getUsageNetworkHosts**](UsageMeteringApi.md#getUsageNetworkHosts) | **GET** /api/v1/usage/network_hosts | Get hourly usage for Network Hosts | | [**getUsageProfiling**](UsageMeteringApi.md#getUsageProfiling) | **GET** /api/v1/usage/profiling | Get hourly usage for profiled hosts | | [**getUsageRumSessions**](UsageMeteringApi.md#getUsageRumSessions) | **GET** /api/v1/usage/rum_sessions | Get hourly usage for RUM Sessions | +| [**getUsageSDS**](UsageMeteringApi.md#getUsageSDS) | **GET** /api/v1/usage/sds | Get hourly usage for Sensitive Data Scanner | | [**getUsageSNMP**](UsageMeteringApi.md#getUsageSNMP) | **GET** /api/v1/usage/snmp | Get hourly usage for SNMP devices | | [**getUsageSummary**](UsageMeteringApi.md#getUsageSummary) | **GET** /api/v1/usage/summary | Get usage across your multi-org account | | [**getUsageSynthetics**](UsageMeteringApi.md#getUsageSynthetics) | **GET** /api/v1/usage/synthetics | Get hourly usage for Synthetics Checks | @@ -1606,6 +1607,68 @@ 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) +## **getUsageSDS** + +> UsageSDSResponse getUsageSDS() + +Get hourly usage for Sensitive Data Scanner + +### Example + +```typescript +import { v1 } from "@datadog/datadog-api-client"; +import * as fs from "fs"; + +const configuration = v1.createConfiguration(); +const apiInstance = new v1.UsageMeteringApi(configuration); + +let params: v1.UsageMeteringApiGetUsageSDSRequest = { + // Date | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. + startHr: new Date("1970-01-01T00:00:00.00Z"), + // Date | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. (optional) + endHr: new Date("1970-01-01T00:00:00.00Z"), +}; + +apiInstance + .getUsageSDS(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 | +| ----------- | ---------- | --------------------------------------------------------------------------------------------------------------------- | -------------------------------- | +| **startHr** | [**Date**] | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. | defaults to undefined | +| **endHr** | [**Date**] | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. | (optional) defaults to undefined | + +### Return type + +**UsageSDSResponse** + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json;datetime-format=rfc3339 + +### HTTP response details + +| Status code | Description | Response headers | +| ----------- | ---------------------------------- | ---------------- | +| **200** | OK | - | +| **400** | Bad Request | - | +| **403** | Forbidden - User is not authorized | - | + +[[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) + ## **getUsageSNMP** > UsageSNMPResponse getUsageSNMP() diff --git a/features/v1/undo.json b/features/v1/undo.json index d93de63d81a..4c5bf02cc7b 100644 --- a/features/v1/undo.json +++ b/features/v1/undo.json @@ -1262,6 +1262,12 @@ "type": "safe" } }, + "GetUsageSDS": { + "tag": "Usage Metering", + "undo": { + "type": "safe" + } + }, "GetUsageSNMP": { "tag": "Usage Metering", "undo": { diff --git a/features/v1/usage_metering.feature b/features/v1/usage_metering.feature index ced1bd90d60..a365fffbd76 100644 --- a/features/v1/usage_metering.feature +++ b/features/v1/usage_metering.feature @@ -199,6 +199,18 @@ Feature: Usage Metering When the request is sent Then the response status is 200 OK + @generated @skip + Scenario: Get hourly usage for Sensitive Data Scanner returns "Bad Request" response + Given new "GetUsageSDS" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip + Scenario: Get hourly usage for Sensitive Data Scanner returns "OK" response + Given new "GetUsageSDS" request + When the request is sent + Then the response status is 200 OK + @generated @skip Scenario: Get hourly usage for Synthetics API Checks returns "Bad Request" response Given new "GetUsageSyntheticsAPI" request diff --git a/packages/datadog-api-client-v1/.openapi-generator/FILES b/packages/datadog-api-client-v1/.openapi-generator/FILES index db1bdb496ee..f8ac7027522 100644 --- a/packages/datadog-api-client-v1/.openapi-generator/FILES +++ b/packages/datadog-api-client-v1/.openapi-generator/FILES @@ -618,6 +618,8 @@ models/UsageProfilingResponse.ts models/UsageReportsType.ts models/UsageRumSessionsHour.ts models/UsageRumSessionsResponse.ts +models/UsageSDSHour.ts +models/UsageSDSResponse.ts models/UsageSNMPHour.ts models/UsageSNMPResponse.ts models/UsageSort.ts diff --git a/packages/datadog-api-client-v1/apis/UsageMeteringApi.ts b/packages/datadog-api-client-v1/apis/UsageMeteringApi.ts index 687dcb3eb3d..3b42e576df4 100644 --- a/packages/datadog-api-client-v1/apis/UsageMeteringApi.ts +++ b/packages/datadog-api-client-v1/apis/UsageMeteringApi.ts @@ -31,6 +31,7 @@ import { UsageNetworkFlowsResponse } from "../models/UsageNetworkFlowsResponse"; import { UsageNetworkHostsResponse } from "../models/UsageNetworkHostsResponse"; import { UsageProfilingResponse } from "../models/UsageProfilingResponse"; import { UsageRumSessionsResponse } from "../models/UsageRumSessionsResponse"; +import { UsageSDSResponse } from "../models/UsageSDSResponse"; import { UsageSNMPResponse } from "../models/UsageSNMPResponse"; import { UsageSort } from "../models/UsageSort"; import { UsageSortDirection } from "../models/UsageSortDirection"; @@ -1821,6 +1822,72 @@ export class UsageMeteringApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + /** + * Get hourly usage for Sensitive Data Scanner + * Get hourly usage for Sensitive Data Scanner + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. + * @param endHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. + */ + public async getUsageSDS( + startHr: Date, + endHr?: Date, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'startHr' is not null or undefined + if (startHr === null || startHr === undefined) { + throw new RequiredError( + "Required parameter startHr was null or undefined when calling getUsageSDS." + ); + } + + // Path Params + const localVarPath = "/api/v1/usage/sds"; + + // Make Request Context + const requestContext = getServer( + _config, + "UsageMeteringApi.getUsageSDS" + ).makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); + requestContext.setHttpConfig(_config.httpConfig); + + // Query Params + if (startHr !== undefined) { + requestContext.setQueryParam( + "start_hr", + ObjectSerializer.serialize(startHr, "Date", "date-time") + ); + } + if (endHr !== undefined) { + requestContext.setQueryParam( + "end_hr", + ObjectSerializer.serialize(endHr, "Date", "date-time") + ); + } + + // Header Params + + // Form Params + + // Body Params + + 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; + } + /** * Get hourly usage for SNMP devices. * Get hourly usage for SNMP devices @@ -3712,6 +3779,61 @@ export class UsageMeteringApiResponseProcessor { ); } + /** + * 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 getUsageSDS + * @throws ApiException if the response code was not in [200, 299] + */ + public async getUsageSDS( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: UsageSDSResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "UsageSDSResponse", + "" + ) as UsageSDSResponse; + 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(400, body); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: APIErrorResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "APIErrorResponse", + "" + ) as APIErrorResponse; + throw new ApiException(403, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: UsageSDSResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "UsageSDSResponse", + "" + ) as UsageSDSResponse; + 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 diff --git a/packages/datadog-api-client-v1/index.ts b/packages/datadog-api-client-v1/index.ts index 2a960234815..8932f0f4bc7 100644 --- a/packages/datadog-api-client-v1/index.ts +++ b/packages/datadog-api-client-v1/index.ts @@ -197,6 +197,7 @@ export { UsageMeteringApiGetUsageNetworkHostsRequest, UsageMeteringApiGetUsageProfilingRequest, UsageMeteringApiGetUsageRumSessionsRequest, + UsageMeteringApiGetUsageSDSRequest, UsageMeteringApiGetUsageSNMPRequest, UsageMeteringApiGetUsageSummaryRequest, UsageMeteringApiGetUsageSyntheticsRequest, diff --git a/packages/datadog-api-client-v1/models/ObjectSerializer.ts b/packages/datadog-api-client-v1/models/ObjectSerializer.ts index ac3551bc263..cd8a371a083 100644 --- a/packages/datadog-api-client-v1/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v1/models/ObjectSerializer.ts @@ -415,6 +415,8 @@ import { UsageProfilingHour } from "./UsageProfilingHour"; import { UsageProfilingResponse } from "./UsageProfilingResponse"; import { UsageRumSessionsHour } from "./UsageRumSessionsHour"; import { UsageRumSessionsResponse } from "./UsageRumSessionsResponse"; +import { UsageSDSHour } from "./UsageSDSHour"; +import { UsageSDSResponse } from "./UsageSDSResponse"; import { UsageSNMPHour } from "./UsageSNMPHour"; import { UsageSNMPResponse } from "./UsageSNMPResponse"; import { UsageSpecifiedCustomReportsAttributes } from "./UsageSpecifiedCustomReportsAttributes"; @@ -1077,6 +1079,8 @@ const typeMap: { [index: string]: any } = { UsageProfilingResponse: UsageProfilingResponse, UsageRumSessionsHour: UsageRumSessionsHour, UsageRumSessionsResponse: UsageRumSessionsResponse, + UsageSDSHour: UsageSDSHour, + UsageSDSResponse: UsageSDSResponse, UsageSNMPHour: UsageSNMPHour, UsageSNMPResponse: UsageSNMPResponse, UsageSpecifiedCustomReportsAttributes: UsageSpecifiedCustomReportsAttributes, diff --git a/packages/datadog-api-client-v1/models/UsageSDSHour.ts b/packages/datadog-api-client-v1/models/UsageSDSHour.ts new file mode 100644 index 00000000000..0d7b61535dc --- /dev/null +++ b/packages/datadog-api-client-v1/models/UsageSDSHour.ts @@ -0,0 +1,108 @@ +/** + * 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. + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ObjectSerializer } from "./ObjectSerializer"; + +/** + * Sensitive Data Scanner usage for a given organization for a given hour. + */ + +export class UsageSDSHour { + /** + * The hour for the usage. + */ + "hour"?: Date; + /** + * The total number of bytes scanned of logs usage by the Sensitive Data Scanner from the start of the given hour’s month until the given hour. + */ + "logsScannedBytes"?: number; + /** + * The total number of bytes scanned across all usage types by the Sensitive Data Scanner from the start of the given hour’s month until the given hour. + */ + "totalScannedBytes"?: number; + + "unparsedObject"?: any; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: { + [key: string]: { baseName: string; type: string; format: string }; + } = { + hour: { + baseName: "hour", + type: "Date", + format: "date-time", + }, + logsScannedBytes: { + baseName: "logs_scanned_bytes", + type: "number", + format: "int64", + }, + totalScannedBytes: { + baseName: "total_scanned_bytes", + type: "number", + format: "int64", + }, + }; + + static getAttributeTypeMap() { + return UsageSDSHour.attributeTypeMap; + } + + static deserialize(data: { [key: string]: any }): UsageSDSHour { + const res = new UsageSDSHour(); + + res.hour = ObjectSerializer.deserialize(data.hour, "Date", "date-time"); + + res.logsScannedBytes = ObjectSerializer.deserialize( + data.logs_scanned_bytes, + "number", + "int64" + ); + + res.totalScannedBytes = ObjectSerializer.deserialize( + data.total_scanned_bytes, + "number", + "int64" + ); + + return res; + } + + static serialize(data: UsageSDSHour): { [key: string]: any } { + const attributeTypes = UsageSDSHour.getAttributeTypeMap(); + const res: { [index: string]: any } = {}; + for (const [key, value] of Object.entries(data)) { + if (!(key in attributeTypes)) { + throw new TypeError(`${key} attribute not in schema`); + } + } + if (data?.unparsedObject !== undefined) { + return data.unparsedObject; + } + res.hour = ObjectSerializer.serialize(data.hour, "Date", "date-time"); + + res.logs_scanned_bytes = ObjectSerializer.serialize( + data.logsScannedBytes, + "number", + "int64" + ); + + res.total_scanned_bytes = ObjectSerializer.serialize( + data.totalScannedBytes, + "number", + "int64" + ); + + return res; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v1/models/UsageSDSResponse.ts b/packages/datadog-api-client-v1/models/UsageSDSResponse.ts new file mode 100644 index 00000000000..98095c5462c --- /dev/null +++ b/packages/datadog-api-client-v1/models/UsageSDSResponse.ts @@ -0,0 +1,75 @@ +/** + * 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. + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { UsageSDSHour } from "./UsageSDSHour"; +import { ObjectSerializer } from "./ObjectSerializer"; + +/** + * Response containing the Sensitive Data Scanner usage for each hour for a given organization. + */ + +export class UsageSDSResponse { + /** + * Get hourly usage for Sensitive Data Scanner. + */ + "usage"?: Array; + + "unparsedObject"?: any; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: { + [key: string]: { baseName: string; type: string; format: string }; + } = { + usage: { + baseName: "usage", + type: "Array", + format: "", + }, + }; + + static getAttributeTypeMap() { + return UsageSDSResponse.attributeTypeMap; + } + + static deserialize(data: { [key: string]: any }): UsageSDSResponse { + const res = new UsageSDSResponse(); + + res.usage = ObjectSerializer.deserialize( + data.usage, + "Array", + "" + ); + + return res; + } + + static serialize(data: UsageSDSResponse): { [key: string]: any } { + const attributeTypes = UsageSDSResponse.getAttributeTypeMap(); + const res: { [index: string]: any } = {}; + for (const [key, value] of Object.entries(data)) { + if (!(key in attributeTypes)) { + throw new TypeError(`${key} attribute not in schema`); + } + } + if (data?.unparsedObject !== undefined) { + return data.unparsedObject; + } + res.usage = ObjectSerializer.serialize( + data.usage, + "Array", + "" + ); + + return res; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v1/models/UsageSummaryDate.ts b/packages/datadog-api-client-v1/models/UsageSummaryDate.ts index 4876b2367f4..bd8dee4ba67 100644 --- a/packages/datadog-api-client-v1/models/UsageSummaryDate.ts +++ b/packages/datadog-api-client-v1/models/UsageSummaryDate.ts @@ -176,6 +176,14 @@ export class UsageSummaryDate { * Shows the sum of RUM Sessions (browser and mobile) over all hours in the current date for all organizations. */ "rumTotalSessionCountSum"?: number; + /** + * Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for all organizations. + */ + "sdsLogsScannedBytesSum"?: number; + /** + * Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for all organizations. + */ + "sdsTotalScannedBytesSum"?: number; /** * Shows the sum of all Synthetic browser tests over all hours in the current date for all organizations. */ @@ -404,6 +412,16 @@ export class UsageSummaryDate { type: "number", format: "int64", }, + sdsLogsScannedBytesSum: { + baseName: "sds_logs_scanned_bytes_sum", + type: "number", + format: "int64", + }, + sdsTotalScannedBytesSum: { + baseName: "sds_total_scanned_bytes_sum", + type: "number", + format: "int64", + }, syntheticsBrowserCheckCallsCountSum: { baseName: "synthetics_browser_check_calls_count_sum", type: "number", @@ -674,6 +692,18 @@ export class UsageSummaryDate { "int64" ); + res.sdsLogsScannedBytesSum = ObjectSerializer.deserialize( + data.sds_logs_scanned_bytes_sum, + "number", + "int64" + ); + + res.sdsTotalScannedBytesSum = ObjectSerializer.deserialize( + data.sds_total_scanned_bytes_sum, + "number", + "int64" + ); + res.syntheticsBrowserCheckCallsCountSum = ObjectSerializer.deserialize( data.synthetics_browser_check_calls_count_sum, "number", @@ -955,6 +985,18 @@ export class UsageSummaryDate { "int64" ); + res.sds_logs_scanned_bytes_sum = ObjectSerializer.serialize( + data.sdsLogsScannedBytesSum, + "number", + "int64" + ); + + res.sds_total_scanned_bytes_sum = ObjectSerializer.serialize( + data.sdsTotalScannedBytesSum, + "number", + "int64" + ); + res.synthetics_browser_check_calls_count_sum = ObjectSerializer.serialize( data.syntheticsBrowserCheckCallsCountSum, "number", diff --git a/packages/datadog-api-client-v1/models/UsageSummaryDateOrg.ts b/packages/datadog-api-client-v1/models/UsageSummaryDateOrg.ts index 8012e1cf6dc..fc04c2f27c1 100644 --- a/packages/datadog-api-client-v1/models/UsageSummaryDateOrg.ts +++ b/packages/datadog-api-client-v1/models/UsageSummaryDateOrg.ts @@ -179,6 +179,14 @@ export class UsageSummaryDateOrg { * Shows the sum of RUM Sessions (browser and mobile) over all hours in the current date for the given org. */ "rumTotalSessionCountSum"?: number; + /** + * Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for all organizations. + */ + "sdsLogsScannedBytesSum"?: number; + /** + * Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for all organizations. + */ + "sdsTotalScannedBytesSum"?: number; /** * Shows the sum of all Synthetic browser tests over all hours in the current date for the given org. */ @@ -412,6 +420,16 @@ export class UsageSummaryDateOrg { type: "number", format: "int64", }, + sdsLogsScannedBytesSum: { + baseName: "sds_logs_scanned_bytes_sum", + type: "number", + format: "int64", + }, + sdsTotalScannedBytesSum: { + baseName: "sds_total_scanned_bytes_sum", + type: "number", + format: "int64", + }, syntheticsBrowserCheckCallsCountSum: { baseName: "synthetics_browser_check_calls_count_sum", type: "number", @@ -680,6 +698,18 @@ export class UsageSummaryDateOrg { "int64" ); + res.sdsLogsScannedBytesSum = ObjectSerializer.deserialize( + data.sds_logs_scanned_bytes_sum, + "number", + "int64" + ); + + res.sdsTotalScannedBytesSum = ObjectSerializer.deserialize( + data.sds_total_scanned_bytes_sum, + "number", + "int64" + ); + res.syntheticsBrowserCheckCallsCountSum = ObjectSerializer.deserialize( data.synthetics_browser_check_calls_count_sum, "number", @@ -959,6 +989,18 @@ export class UsageSummaryDateOrg { "int64" ); + res.sds_logs_scanned_bytes_sum = ObjectSerializer.serialize( + data.sdsLogsScannedBytesSum, + "number", + "int64" + ); + + res.sds_total_scanned_bytes_sum = ObjectSerializer.serialize( + data.sdsTotalScannedBytesSum, + "number", + "int64" + ); + res.synthetics_browser_check_calls_count_sum = ObjectSerializer.serialize( data.syntheticsBrowserCheckCallsCountSum, "number", diff --git a/packages/datadog-api-client-v1/models/UsageSummaryResponse.ts b/packages/datadog-api-client-v1/models/UsageSummaryResponse.ts index b1d88665b9c..28d4e96a06f 100644 --- a/packages/datadog-api-client-v1/models/UsageSummaryResponse.ts +++ b/packages/datadog-api-client-v1/models/UsageSummaryResponse.ts @@ -202,6 +202,14 @@ export class UsageSummaryResponse { * Shows the sum of RUM Sessions (browser and mobile) over all hours in the current months for all organizations. */ "rumTotalSessionCountAggSum"?: number; + /** + * Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for all organizations. + */ + "sdsLogsScannedBytesSum"?: number; + /** + * Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for all organizations. + */ + "sdsTotalScannedBytesSum"?: number; /** * Shows the first date of usage in the current months for all organizations. */ @@ -473,6 +481,16 @@ export class UsageSummaryResponse { type: "number", format: "int64", }, + sdsLogsScannedBytesSum: { + baseName: "sds_logs_scanned_bytes_sum", + type: "number", + format: "int64", + }, + sdsTotalScannedBytesSum: { + baseName: "sds_total_scanned_bytes_sum", + type: "number", + format: "int64", + }, startDate: { baseName: "start_date", type: "Date", @@ -800,6 +818,18 @@ export class UsageSummaryResponse { "int64" ); + res.sdsLogsScannedBytesSum = ObjectSerializer.deserialize( + data.sds_logs_scanned_bytes_sum, + "number", + "int64" + ); + + res.sdsTotalScannedBytesSum = ObjectSerializer.deserialize( + data.sds_total_scanned_bytes_sum, + "number", + "int64" + ); + res.startDate = ObjectSerializer.deserialize( data.start_date, "Date", @@ -1139,6 +1169,18 @@ export class UsageSummaryResponse { "int64" ); + res.sds_logs_scanned_bytes_sum = ObjectSerializer.serialize( + data.sdsLogsScannedBytesSum, + "number", + "int64" + ); + + res.sds_total_scanned_bytes_sum = ObjectSerializer.serialize( + data.sdsTotalScannedBytesSum, + "number", + "int64" + ); + res.start_date = ObjectSerializer.serialize( data.startDate, "Date", diff --git a/packages/datadog-api-client-v1/types/ObjectParamAPI.ts b/packages/datadog-api-client-v1/types/ObjectParamAPI.ts index b00f9367ea0..68eeb186490 100644 --- a/packages/datadog-api-client-v1/types/ObjectParamAPI.ts +++ b/packages/datadog-api-client-v1/types/ObjectParamAPI.ts @@ -139,6 +139,7 @@ import { UsageNetworkFlowsResponse } from "../models/UsageNetworkFlowsResponse"; import { UsageNetworkHostsResponse } from "../models/UsageNetworkHostsResponse"; import { UsageProfilingResponse } from "../models/UsageProfilingResponse"; import { UsageRumSessionsResponse } from "../models/UsageRumSessionsResponse"; +import { UsageSDSResponse } from "../models/UsageSDSResponse"; import { UsageSNMPResponse } from "../models/UsageSNMPResponse"; import { UsageSort } from "../models/UsageSort"; import { UsageSortDirection } from "../models/UsageSortDirection"; @@ -5123,6 +5124,21 @@ export interface UsageMeteringApiGetUsageRumSessionsRequest { type?: string; } +export interface UsageMeteringApiGetUsageSDSRequest { + /** + * Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. + * @type Date + * @memberof UsageMeteringApigetUsageSDS + */ + startHr: Date; + /** + * Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. + * @type Date + * @memberof UsageMeteringApigetUsageSDS + */ + endHr?: Date; +} + export interface UsageMeteringApiGetUsageSNMPRequest { /** * Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. @@ -5639,6 +5655,20 @@ export class ObjectUsageMeteringApi { .toPromise(); } + /** + * Get hourly usage for Sensitive Data Scanner + * Get hourly usage for Sensitive Data Scanner + * @param param the request object + */ + public getUsageSDS( + param: UsageMeteringApiGetUsageSDSRequest, + options?: Configuration + ): Promise { + return this.api + .getUsageSDS(param.startHr, param.endHr, options) + .toPromise(); + } + /** * Get hourly usage for SNMP devices. * Get hourly usage for SNMP devices diff --git a/packages/datadog-api-client-v1/types/ObservableAPI.ts b/packages/datadog-api-client-v1/types/ObservableAPI.ts index b12c6f6abc4..19bd5b252ab 100644 --- a/packages/datadog-api-client-v1/types/ObservableAPI.ts +++ b/packages/datadog-api-client-v1/types/ObservableAPI.ts @@ -140,6 +140,7 @@ import { UsageNetworkFlowsResponse } from "../models/UsageNetworkFlowsResponse"; import { UsageNetworkHostsResponse } from "../models/UsageNetworkHostsResponse"; import { UsageProfilingResponse } from "../models/UsageProfilingResponse"; import { UsageRumSessionsResponse } from "../models/UsageRumSessionsResponse"; +import { UsageSDSResponse } from "../models/UsageSDSResponse"; import { UsageSNMPResponse } from "../models/UsageSNMPResponse"; import { UsageSort } from "../models/UsageSort"; import { UsageSortDirection } from "../models/UsageSortDirection"; @@ -8724,6 +8725,51 @@ export class ObservableUsageMeteringApi { }) ); } + /** + * Get hourly usage for Sensitive Data Scanner + * Get hourly usage for Sensitive Data Scanner + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. + * @param endHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. + */ + public getUsageSDS( + startHr: Date, + endHr?: Date, + _options?: Configuration + ): Observable { + const requestContextPromise = this.requestFactory.getUsageSDS( + startHr, + endHr, + _options + ); + + // build promise chain + let middlewarePreObservable = from_(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe( + mergeMap((ctx: RequestContext) => middleware.pre(ctx)) + ); + } + + return middlewarePreObservable + .pipe( + mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx)) + ) + .pipe( + mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe( + mergeMap((rsp: ResponseContext) => middleware.post(rsp)) + ); + } + return middlewarePostObservable.pipe( + map((rsp: ResponseContext) => + this.responseProcessor.getUsageSDS(rsp) + ) + ); + }) + ); + } /** * Get hourly usage for SNMP devices. * Get hourly usage for SNMP devices diff --git a/packages/datadog-api-client-v1/types/PromiseAPI.ts b/packages/datadog-api-client-v1/types/PromiseAPI.ts index aaa1728a578..8ea8043ae8e 100644 --- a/packages/datadog-api-client-v1/types/PromiseAPI.ts +++ b/packages/datadog-api-client-v1/types/PromiseAPI.ts @@ -139,6 +139,7 @@ import { UsageNetworkFlowsResponse } from "../models/UsageNetworkFlowsResponse"; import { UsageNetworkHostsResponse } from "../models/UsageNetworkHostsResponse"; import { UsageProfilingResponse } from "../models/UsageProfilingResponse"; import { UsageRumSessionsResponse } from "../models/UsageRumSessionsResponse"; +import { UsageSDSResponse } from "../models/UsageSDSResponse"; import { UsageSNMPResponse } from "../models/UsageSNMPResponse"; import { UsageSort } from "../models/UsageSort"; import { UsageSortDirection } from "../models/UsageSortDirection"; @@ -3529,6 +3530,21 @@ export class PromiseUsageMeteringApi { return result.toPromise(); } + /** + * Get hourly usage for Sensitive Data Scanner + * Get hourly usage for Sensitive Data Scanner + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. + * @param endHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. + */ + public getUsageSDS( + startHr: Date, + endHr?: Date, + _options?: Configuration + ): Promise { + const result = this.api.getUsageSDS(startHr, endHr, _options); + return result.toPromise(); + } + /** * Get hourly usage for SNMP devices. * Get hourly usage for SNMP devices