diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 74b9de40104c..2b49199abf00 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1586,6 +1586,23 @@ components: required: true schema: $ref: "#/components/schemas/RumPermanentRetentionFilterID" + RumRateLimitScopeIDParameter: + description: |- + The identifier of the scope the rate limit configuration applies to. + For the `application` scope, this is the RUM application ID. + in: path + name: scope_id + required: true + schema: + example: cd73a516-a481-4af5-8352-9b577465c77b + type: string + RumRateLimitScopeTypeParameter: + description: The type of scope the rate limit configuration applies to. + in: path + name: scope_type + required: true + schema: + $ref: "#/components/schemas/RumRateLimitScopeType" RumRetentionFilterIDParameter: description: Retention filter ID. in: path @@ -74528,6 +74545,179 @@ components: $ref: "#/components/schemas/RumPermanentRetentionFilterData" type: array type: object + RumRateLimitAdaptiveConfig: + description: The configuration used when `mode` is `adaptive`. + properties: + max_retention_rate: + description: The maximum fraction of sessions to retain, in the range `(0, 1]`. + example: 0.5 + exclusiveMinimum: true + format: double + maximum: 1 + minimum: 0 + type: number + required: + - max_retention_rate + type: object + RumRateLimitConfigAttributes: + description: The RUM rate limit configuration properties. + properties: + adaptive: + $ref: "#/components/schemas/RumRateLimitAdaptiveConfig" + custom: + $ref: "#/components/schemas/RumRateLimitCustomConfig" + mode: + $ref: "#/components/schemas/RumRateLimitMode" + org_id: + description: The ID of the organization the rate limit configuration belongs to. + example: 2 + format: int64 + type: integer + updated_at: + description: The date the rate limit configuration was last updated. + example: "2026-03-04T15:37:54.951447Z" + type: string + updated_by: + description: The handle of the user who last updated the rate limit configuration. + example: test@example.com + type: string + required: + - mode + - org_id + type: object + RumRateLimitConfigData: + description: The RUM rate limit configuration object. + properties: + attributes: + $ref: "#/components/schemas/RumRateLimitConfigAttributes" + id: + description: The identifier of the scope the rate limit configuration applies to. + example: cd73a516-a481-4af5-8352-9b577465c77b + type: string + type: + $ref: "#/components/schemas/RumRateLimitConfigType" + required: + - id + - type + - attributes + type: object + RumRateLimitConfigResponse: + description: The RUM rate limit configuration response. + properties: + data: + $ref: "#/components/schemas/RumRateLimitConfigData" + required: + - data + type: object + RumRateLimitConfigType: + default: rum_rate_limit_config + description: The type of the resource, always `rum_rate_limit_config`. + enum: + - rum_rate_limit_config + example: rum_rate_limit_config + type: string + x-enum-varnames: ["RUM_RATE_LIMIT_CONFIG"] + RumRateLimitConfigUpdateAttributes: + description: The RUM rate limit configuration properties to create or update. + properties: + adaptive: + $ref: "#/components/schemas/RumRateLimitAdaptiveConfig" + custom: + $ref: "#/components/schemas/RumRateLimitCustomConfig" + mode: + $ref: "#/components/schemas/RumRateLimitMode" + required: + - mode + type: object + RumRateLimitConfigUpdateData: + description: The RUM rate limit configuration to create or update. + properties: + attributes: + $ref: "#/components/schemas/RumRateLimitConfigUpdateAttributes" + id: + description: |- + The identifier of the scope the rate limit configuration applies to. + Must match `scope_id` in the path. + example: cd73a516-a481-4af5-8352-9b577465c77b + type: string + type: + $ref: "#/components/schemas/RumRateLimitConfigType" + required: + - id + - type + - attributes + type: object + RumRateLimitConfigUpdateRequest: + description: The body of a request to create or update a RUM rate limit configuration. + properties: + data: + $ref: "#/components/schemas/RumRateLimitConfigUpdateData" + required: + - data + type: object + RumRateLimitCustomConfig: + description: The configuration used when `mode` is `custom`. + properties: + daily_reset_time: + description: The time of day when the daily quota resets, in `HH:MM` 24-hour format. + example: "08:00" + pattern: "^([01]\\d|2[0-3]):[0-5]\\d$" + type: string + daily_reset_timezone: + description: The timezone offset used for the daily reset time, in `±HH:MM` format. + example: "+09:00" + pattern: "^[+-](0\\d|1[0-4]):[0-5]\\d$" + type: string + quota_reached_action: + $ref: "#/components/schemas/RumRateLimitQuotaReachedAction" + session_limit: + description: The maximum number of sessions allowed within the window. + example: 1000000 + format: int64 + minimum: 1 + type: integer + window_type: + $ref: "#/components/schemas/RumRateLimitWindowType" + required: + - window_type + - session_limit + - daily_reset_time + - daily_reset_timezone + - quota_reached_action + type: object + RumRateLimitMode: + description: |- + The rate limit mode. `custom` enforces a fixed session limit, while + `adaptive` dynamically adjusts retention. + enum: + - custom + - adaptive + example: custom + type: string + x-enum-varnames: ["CUSTOM", "ADAPTIVE"] + RumRateLimitQuotaReachedAction: + description: The action to take when the session quota is reached. + enum: + - stop + - slowdown + example: stop + type: string + x-enum-varnames: ["STOP", "SLOWDOWN"] + RumRateLimitScopeType: + default: application + description: The type of scope the rate limit configuration applies to. + enum: + - application + example: application + type: string + x-enum-varnames: ["APPLICATION"] + RumRateLimitWindowType: + description: The window type over which the session limit is enforced. + enum: + - daily + example: daily + type: string + x-enum-varnames: ["DAILY"] RumRetentionFilterAttributes: description: The object describing attributes of a RUM retention filter. properties: @@ -153409,6 +153599,142 @@ paths: tags: - Rum Metrics x-codegen-request-body-name: body + /api/v2/rum/config/rate-limit/{scope_type}/{scope_id}: + delete: + description: Delete the RUM rate limit configuration for a given scope. + operationId: DeleteRumRateLimitConfig + parameters: + - $ref: "#/components/parameters/RumRateLimitScopeTypeParameter" + - $ref: "#/components/parameters/RumRateLimitScopeIDParameter" + responses: + "204": + description: No Content + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a RUM rate limit configuration + tags: + - Rum Rate Limit + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get the RUM rate limit configuration for a given scope. + operationId: GetRumRateLimitConfig + parameters: + - $ref: "#/components/parameters/RumRateLimitScopeTypeParameter" + - $ref: "#/components/parameters/RumRateLimitScopeIDParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + custom: + daily_reset_time: "08:00" + daily_reset_timezone: "+09:00" + quota_reached_action: stop + session_limit: 1000000 + window_type: daily + mode: custom + org_id: 2 + updated_at: "2026-03-04T15:37:54.951447Z" + updated_by: test@example.com + id: cd73a516-a481-4af5-8352-9b577465c77b + type: rum_rate_limit_config + schema: + $ref: "#/components/schemas/RumRateLimitConfigResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a RUM rate limit configuration + tags: + - Rum Rate Limit + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + put: + description: |- + Create or update the RUM rate limit configuration for a given scope. + Returns the rate limit configuration object when the request is successful. + operationId: UpdateRumRateLimitConfig + parameters: + - $ref: "#/components/parameters/RumRateLimitScopeTypeParameter" + - $ref: "#/components/parameters/RumRateLimitScopeIDParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + custom: + daily_reset_time: "08:00" + daily_reset_timezone: "+09:00" + quota_reached_action: stop + session_limit: 1000000 + window_type: daily + mode: custom + id: cd73a516-a481-4af5-8352-9b577465c77b + type: rum_rate_limit_config + schema: + $ref: "#/components/schemas/RumRateLimitConfigUpdateRequest" + description: The definition of the RUM rate limit configuration to create or update. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + custom: + daily_reset_time: "08:00" + daily_reset_timezone: "+09:00" + quota_reached_action: stop + session_limit: 1000000 + window_type: daily + mode: custom + org_id: 2 + updated_at: "2026-03-04T21:52:53.526022Z" + updated_by: test@example.com + id: cd73a516-a481-4af5-8352-9b577465c77b + type: rum_rate_limit_config + schema: + $ref: "#/components/schemas/RumRateLimitConfigResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create or update a RUM rate limit configuration + tags: + - Rum Rate Limit + x-codegen-request-body-name: body + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/rum/events: get: description: |- @@ -179358,6 +179684,9 @@ tags: description: Find out more at url: https://docs.datadoghq.com/real_user_monitoring/platform/generate_metrics/ name: Rum Metrics + - description: |- + Manage RUM rate limit configurations for your organization's RUM applications. + name: Rum Rate Limit - description: Manage heatmap snapshots for RUM replay sessions. Create, update, delete, and retrieve snapshots to visualize user interactions on specific views. name: Rum Replay Heatmaps - description: Create and manage playlists of RUM replay sessions. Organize, categorize, and share collections of replay sessions for analysis and collaboration. diff --git a/examples/v2/rum-rate-limit/DeleteRumRateLimitConfig.ts b/examples/v2/rum-rate-limit/DeleteRumRateLimitConfig.ts new file mode 100644 index 000000000000..8e622558d2be --- /dev/null +++ b/examples/v2/rum-rate-limit/DeleteRumRateLimitConfig.ts @@ -0,0 +1,23 @@ +/** + * Delete a RUM rate limit configuration returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.deleteRumRateLimitConfig"] = true; +const apiInstance = new v2.RumRateLimitApi(configuration); + +const params: v2.RumRateLimitApiDeleteRumRateLimitConfigRequest = { + scopeType: "application", + scopeId: "cd73a516-a481-4af5-8352-9b577465c77b", +}; + +apiInstance + .deleteRumRateLimitConfig(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/rum-rate-limit/GetRumRateLimitConfig.ts b/examples/v2/rum-rate-limit/GetRumRateLimitConfig.ts new file mode 100644 index 000000000000..9a487abdad4b --- /dev/null +++ b/examples/v2/rum-rate-limit/GetRumRateLimitConfig.ts @@ -0,0 +1,23 @@ +/** + * Get a RUM rate limit configuration returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.getRumRateLimitConfig"] = true; +const apiInstance = new v2.RumRateLimitApi(configuration); + +const params: v2.RumRateLimitApiGetRumRateLimitConfigRequest = { + scopeType: "application", + scopeId: "cd73a516-a481-4af5-8352-9b577465c77b", +}; + +apiInstance + .getRumRateLimitConfig(params) + .then((data: v2.RumRateLimitConfigResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/rum-rate-limit/UpdateRumRateLimitConfig.ts b/examples/v2/rum-rate-limit/UpdateRumRateLimitConfig.ts new file mode 100644 index 000000000000..cb3545da7780 --- /dev/null +++ b/examples/v2/rum-rate-limit/UpdateRumRateLimitConfig.ts @@ -0,0 +1,42 @@ +/** + * Create or update a RUM rate limit configuration returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.updateRumRateLimitConfig"] = true; +const apiInstance = new v2.RumRateLimitApi(configuration); + +const params: v2.RumRateLimitApiUpdateRumRateLimitConfigRequest = { + body: { + data: { + attributes: { + adaptive: { + maxRetentionRate: 0.5, + }, + custom: { + dailyResetTime: "08:00", + dailyResetTimezone: "+09:00", + quotaReachedAction: "stop", + sessionLimit: 1000000, + windowType: "daily", + }, + mode: "custom", + }, + id: "cd73a516-a481-4af5-8352-9b577465c77b", + type: "rum_rate_limit_config", + }, + }, + scopeType: "application", + scopeId: "cd73a516-a481-4af5-8352-9b577465c77b", +}; + +apiInstance + .updateRumRateLimitConfig(params) + .then((data: v2.RumRateLimitConfigResponse) => { + 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 c747d6d5414b..3750a2d746f6 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -13405,6 +13405,43 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "RumMetricResponse", }, + "v2.GetRumRateLimitConfig": { + "scopeType": { + "type": "RumRateLimitScopeType", + "format": "", + }, + "scopeId": { + "type": "string", + "format": "", + }, + "operationResponseType": "RumRateLimitConfigResponse", + }, + "v2.UpdateRumRateLimitConfig": { + "scopeType": { + "type": "RumRateLimitScopeType", + "format": "", + }, + "scopeId": { + "type": "string", + "format": "", + }, + "body": { + "type": "RumRateLimitConfigUpdateRequest", + "format": "", + }, + "operationResponseType": "RumRateLimitConfigResponse", + }, + "v2.DeleteRumRateLimitConfig": { + "scopeType": { + "type": "RumRateLimitScopeType", + "format": "", + }, + "scopeId": { + "type": "string", + "format": "", + }, + "operationResponseType": "{}", + }, "v2.QueryAggregatedLongTasks": { "body": { "type": "AggregatedLongTasksRequest", diff --git a/features/v2/rum_rate_limit.feature b/features/v2/rum_rate_limit.feature new file mode 100644 index 000000000000..90869ed17829 --- /dev/null +++ b/features/v2/rum_rate_limit.feature @@ -0,0 +1,93 @@ +@endpoint(rum-rate-limit) @endpoint(rum-rate-limit-v2) +Feature: Rum Rate Limit + Manage RUM rate limit configurations for your organization's RUM + applications. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "RumRateLimit" API + + @generated @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM rate limit configuration returns "Bad Request" response + Given operation "UpdateRumRateLimitConfig" enabled + And new "UpdateRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"adaptive": {"max_retention_rate": 0.5}, "custom": {"daily_reset_time": "08:00", "daily_reset_timezone": "+09:00", "quota_reached_action": "stop", "session_limit": 1000000, "window_type": "daily"}, "mode": "custom"}, "id": "cd73a516-a481-4af5-8352-9b577465c77b", "type": "rum_rate_limit_config"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM rate limit configuration returns "Not Found" response + Given operation "UpdateRumRateLimitConfig" enabled + And new "UpdateRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"adaptive": {"max_retention_rate": 0.5}, "custom": {"daily_reset_time": "08:00", "daily_reset_timezone": "+09:00", "quota_reached_action": "stop", "session_limit": 1000000, "window_type": "daily"}, "mode": "custom"}, "id": "cd73a516-a481-4af5-8352-9b577465c77b", "type": "rum_rate_limit_config"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM rate limit configuration returns "OK" response + Given operation "UpdateRumRateLimitConfig" enabled + And new "UpdateRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"adaptive": {"max_retention_rate": 0.5}, "custom": {"daily_reset_time": "08:00", "daily_reset_timezone": "+09:00", "quota_reached_action": "stop", "session_limit": 1000000, "window_type": "daily"}, "mode": "custom"}, "id": "cd73a516-a481-4af5-8352-9b577465c77b", "type": "rum_rate_limit_config"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/rum-backend + Scenario: Delete a RUM rate limit configuration returns "Bad Request" response + Given operation "DeleteRumRateLimitConfig" enabled + And new "DeleteRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/rum-backend + Scenario: Delete a RUM rate limit configuration returns "No Content" response + Given operation "DeleteRumRateLimitConfig" enabled + And new "DeleteRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/rum-backend + Scenario: Delete a RUM rate limit configuration returns "Not Found" response + Given operation "DeleteRumRateLimitConfig" enabled + And new "DeleteRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/rum-backend + Scenario: Get a RUM rate limit configuration returns "Bad Request" response + Given operation "GetRumRateLimitConfig" enabled + And new "GetRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/rum-backend + Scenario: Get a RUM rate limit configuration returns "Not Found" response + Given operation "GetRumRateLimitConfig" enabled + And new "GetRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/rum-backend + Scenario: Get a RUM rate limit configuration returns "OK" response + Given operation "GetRumRateLimitConfig" enabled + And new "GetRumRateLimitConfig" request + And request contains "scope_type" parameter from "REPLACE.ME" + And request contains "scope_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index bf8c214ecee0..86948cc32b7d 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6181,6 +6181,24 @@ "type": "idempotent" } }, + "DeleteRumRateLimitConfig": { + "tag": "Rum Rate Limit", + "undo": { + "type": "idempotent" + } + }, + "GetRumRateLimitConfig": { + "tag": "Rum Rate Limit", + "undo": { + "type": "safe" + } + }, + "UpdateRumRateLimitConfig": { + "tag": "Rum Rate Limit", + "undo": { + "type": "idempotent" + } + }, "ListRUMEvents": { "tag": "RUM", "undo": { diff --git a/packages/datadog-api-client-common/configuration.ts b/packages/datadog-api-client-common/configuration.ts index 50b5b6f69b73..9b87eb33a5f8 100644 --- a/packages/datadog-api-client-common/configuration.ts +++ b/packages/datadog-api-client-common/configuration.ts @@ -613,6 +613,9 @@ export function createConfiguration( "v2.getSourcemaps": false, "v2.listSourcemaps": false, "v2.restoreSourcemaps": false, + "v2.deleteRumRateLimitConfig": false, + "v2.getRumRateLimitConfig": false, + "v2.updateRumRateLimitConfig": false, "v2.queryAggregatedLongTasks": false, "v2.queryAggregatedSignalsProblems": false, "v2.queryAggregatedWaterfall": false, diff --git a/packages/datadog-api-client-v2/apis/RumRateLimitApi.ts b/packages/datadog-api-client-v2/apis/RumRateLimitApi.ts new file mode 100644 index 000000000000..8982ff146c17 --- /dev/null +++ b/packages/datadog-api-client-v2/apis/RumRateLimitApi.ts @@ -0,0 +1,493 @@ +import { + BaseAPIRequestFactory, + RequiredError, +} from "../../datadog-api-client-common/baseapi"; +import { + Configuration, + applySecurityAuthentication, +} from "../../datadog-api-client-common/configuration"; +import { + RequestContext, + HttpMethod, + ResponseContext, +} from "../../datadog-api-client-common/http/http"; + +import { logger } from "../../../logger"; +import { ObjectSerializer } from "../models/ObjectSerializer"; +import { ApiException } from "../../datadog-api-client-common/exception"; + +import { APIErrorResponse } from "../models/APIErrorResponse"; +import { RumRateLimitConfigResponse } from "../models/RumRateLimitConfigResponse"; +import { RumRateLimitConfigUpdateRequest } from "../models/RumRateLimitConfigUpdateRequest"; +import { RumRateLimitScopeType } from "../models/RumRateLimitScopeType"; + +export class RumRateLimitApiRequestFactory extends BaseAPIRequestFactory { + public async deleteRumRateLimitConfig( + scopeType: RumRateLimitScopeType, + scopeId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'deleteRumRateLimitConfig'"); + if (!_config.unstableOperations["v2.deleteRumRateLimitConfig"]) { + throw new Error( + "Unstable operation 'deleteRumRateLimitConfig' is disabled" + ); + } + + // verify required parameter 'scopeType' is not null or undefined + if (scopeType === null || scopeType === undefined) { + throw new RequiredError("scopeType", "deleteRumRateLimitConfig"); + } + + // verify required parameter 'scopeId' is not null or undefined + if (scopeId === null || scopeId === undefined) { + throw new RequiredError("scopeId", "deleteRumRateLimitConfig"); + } + + // Path Params + const localVarPath = "/api/v2/rum/config/rate-limit/{scope_type}/{scope_id}" + .replace("{scope_type}", encodeURIComponent(String(scopeType))) + .replace("{scope_id}", encodeURIComponent(String(scopeId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.RumRateLimitApi.deleteRumRateLimitConfig") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getRumRateLimitConfig( + scopeType: RumRateLimitScopeType, + scopeId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'getRumRateLimitConfig'"); + if (!_config.unstableOperations["v2.getRumRateLimitConfig"]) { + throw new Error("Unstable operation 'getRumRateLimitConfig' is disabled"); + } + + // verify required parameter 'scopeType' is not null or undefined + if (scopeType === null || scopeType === undefined) { + throw new RequiredError("scopeType", "getRumRateLimitConfig"); + } + + // verify required parameter 'scopeId' is not null or undefined + if (scopeId === null || scopeId === undefined) { + throw new RequiredError("scopeId", "getRumRateLimitConfig"); + } + + // Path Params + const localVarPath = "/api/v2/rum/config/rate-limit/{scope_type}/{scope_id}" + .replace("{scope_type}", encodeURIComponent(String(scopeType))) + .replace("{scope_id}", encodeURIComponent(String(scopeId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.RumRateLimitApi.getRumRateLimitConfig") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async updateRumRateLimitConfig( + scopeType: RumRateLimitScopeType, + scopeId: string, + body: RumRateLimitConfigUpdateRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'updateRumRateLimitConfig'"); + if (!_config.unstableOperations["v2.updateRumRateLimitConfig"]) { + throw new Error( + "Unstable operation 'updateRumRateLimitConfig' is disabled" + ); + } + + // verify required parameter 'scopeType' is not null or undefined + if (scopeType === null || scopeType === undefined) { + throw new RequiredError("scopeType", "updateRumRateLimitConfig"); + } + + // verify required parameter 'scopeId' is not null or undefined + if (scopeId === null || scopeId === undefined) { + throw new RequiredError("scopeId", "updateRumRateLimitConfig"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateRumRateLimitConfig"); + } + + // Path Params + const localVarPath = "/api/v2/rum/config/rate-limit/{scope_type}/{scope_id}" + .replace("{scope_type}", encodeURIComponent(String(scopeType))) + .replace("{scope_id}", encodeURIComponent(String(scopeId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.RumRateLimitApi.updateRumRateLimitConfig") + .makeRequestContext(localVarPath, HttpMethod.PUT); + 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, "RumRateLimitConfigUpdateRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class RumRateLimitApiResponseProcessor { + /** + * 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 deleteRumRateLimitConfig + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteRumRateLimitConfig( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + 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) { + return; + } + + 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 + * + * @params response Response returned by the server for a request to getRumRateLimitConfig + * @throws ApiException if the response code was not in [200, 299] + */ + public async getRumRateLimitConfig( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RumRateLimitConfigResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RumRateLimitConfigResponse" + ) as RumRateLimitConfigResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + 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: RumRateLimitConfigResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RumRateLimitConfigResponse", + "" + ) as RumRateLimitConfigResponse; + 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 + * + * @params response Response returned by the server for a request to updateRumRateLimitConfig + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateRumRateLimitConfig( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RumRateLimitConfigResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RumRateLimitConfigResponse" + ) as RumRateLimitConfigResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + 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: RumRateLimitConfigResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RumRateLimitConfigResponse", + "" + ) as RumRateLimitConfigResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } +} + +export interface RumRateLimitApiDeleteRumRateLimitConfigRequest { + /** + * The type of scope the rate limit configuration applies to. + * @type RumRateLimitScopeType + */ + scopeType: RumRateLimitScopeType; + /** + * The identifier of the scope the rate limit configuration applies to. + * For the `application` scope, this is the RUM application ID. + * @type string + */ + scopeId: string; +} + +export interface RumRateLimitApiGetRumRateLimitConfigRequest { + /** + * The type of scope the rate limit configuration applies to. + * @type RumRateLimitScopeType + */ + scopeType: RumRateLimitScopeType; + /** + * The identifier of the scope the rate limit configuration applies to. + * For the `application` scope, this is the RUM application ID. + * @type string + */ + scopeId: string; +} + +export interface RumRateLimitApiUpdateRumRateLimitConfigRequest { + /** + * The type of scope the rate limit configuration applies to. + * @type RumRateLimitScopeType + */ + scopeType: RumRateLimitScopeType; + /** + * The identifier of the scope the rate limit configuration applies to. + * For the `application` scope, this is the RUM application ID. + * @type string + */ + scopeId: string; + /** + * The definition of the RUM rate limit configuration to create or update. + * @type RumRateLimitConfigUpdateRequest + */ + body: RumRateLimitConfigUpdateRequest; +} + +export class RumRateLimitApi { + private requestFactory: RumRateLimitApiRequestFactory; + private responseProcessor: RumRateLimitApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: RumRateLimitApiRequestFactory, + responseProcessor?: RumRateLimitApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = + requestFactory || new RumRateLimitApiRequestFactory(configuration); + this.responseProcessor = + responseProcessor || new RumRateLimitApiResponseProcessor(); + } + + /** + * Delete the RUM rate limit configuration for a given scope. + * @param param The request object + */ + public deleteRumRateLimitConfig( + param: RumRateLimitApiDeleteRumRateLimitConfigRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.deleteRumRateLimitConfig( + param.scopeType, + param.scopeId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteRumRateLimitConfig( + responseContext + ); + }); + }); + } + + /** + * Get the RUM rate limit configuration for a given scope. + * @param param The request object + */ + public getRumRateLimitConfig( + param: RumRateLimitApiGetRumRateLimitConfigRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.getRumRateLimitConfig( + param.scopeType, + param.scopeId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getRumRateLimitConfig(responseContext); + }); + }); + } + + /** + * Create or update the RUM rate limit configuration for a given scope. + * Returns the rate limit configuration object when the request is successful. + * @param param The request object + */ + public updateRumRateLimitConfig( + param: RumRateLimitApiUpdateRumRateLimitConfigRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.updateRumRateLimitConfig( + param.scopeType, + param.scopeId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateRumRateLimitConfig( + responseContext + ); + }); + }); + } +} diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 614197ef4d76..d1cd4a844b6d 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -1125,6 +1125,13 @@ export { RumMetricsApi, } from "./apis/RumMetricsApi"; +export { + RumRateLimitApiDeleteRumRateLimitConfigRequest, + RumRateLimitApiGetRumRateLimitConfigRequest, + RumRateLimitApiUpdateRumRateLimitConfigRequest, + RumRateLimitApi, +} from "./apis/RumRateLimitApi"; + export { RumReplayHeatmapsApiCreateReplayHeatmapSnapshotRequest, RumReplayHeatmapsApiDeleteReplayHeatmapSnapshotRequest, @@ -6201,6 +6208,19 @@ export { RUMProductScales } from "./models/RUMProductScales"; export { RUMQueryFilter } from "./models/RUMQueryFilter"; export { RUMQueryOptions } from "./models/RUMQueryOptions"; export { RUMQueryPageOptions } from "./models/RUMQueryPageOptions"; +export { RumRateLimitAdaptiveConfig } from "./models/RumRateLimitAdaptiveConfig"; +export { RumRateLimitConfigAttributes } from "./models/RumRateLimitConfigAttributes"; +export { RumRateLimitConfigData } from "./models/RumRateLimitConfigData"; +export { RumRateLimitConfigResponse } from "./models/RumRateLimitConfigResponse"; +export { RumRateLimitConfigType } from "./models/RumRateLimitConfigType"; +export { RumRateLimitConfigUpdateAttributes } from "./models/RumRateLimitConfigUpdateAttributes"; +export { RumRateLimitConfigUpdateData } from "./models/RumRateLimitConfigUpdateData"; +export { RumRateLimitConfigUpdateRequest } from "./models/RumRateLimitConfigUpdateRequest"; +export { RumRateLimitCustomConfig } from "./models/RumRateLimitCustomConfig"; +export { RumRateLimitMode } from "./models/RumRateLimitMode"; +export { RumRateLimitQuotaReachedAction } from "./models/RumRateLimitQuotaReachedAction"; +export { RumRateLimitScopeType } from "./models/RumRateLimitScopeType"; +export { RumRateLimitWindowType } from "./models/RumRateLimitWindowType"; export { RUMResponseLinks } from "./models/RUMResponseLinks"; export { RUMResponseMetadata } from "./models/RUMResponseMetadata"; export { RUMResponsePage } from "./models/RUMResponsePage"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 4c1b97230428..e370e9d6abf0 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -3517,6 +3517,14 @@ import { RumPermanentRetentionFilterUpdateAttributes } from "./RumPermanentReten import { RumPermanentRetentionFilterUpdateData } from "./RumPermanentRetentionFilterUpdateData"; import { RumPermanentRetentionFilterUpdateRequest } from "./RumPermanentRetentionFilterUpdateRequest"; import { RumPermanentRetentionFiltersResponse } from "./RumPermanentRetentionFiltersResponse"; +import { RumRateLimitAdaptiveConfig } from "./RumRateLimitAdaptiveConfig"; +import { RumRateLimitConfigAttributes } from "./RumRateLimitConfigAttributes"; +import { RumRateLimitConfigData } from "./RumRateLimitConfigData"; +import { RumRateLimitConfigResponse } from "./RumRateLimitConfigResponse"; +import { RumRateLimitConfigUpdateAttributes } from "./RumRateLimitConfigUpdateAttributes"; +import { RumRateLimitConfigUpdateData } from "./RumRateLimitConfigUpdateData"; +import { RumRateLimitConfigUpdateRequest } from "./RumRateLimitConfigUpdateRequest"; +import { RumRateLimitCustomConfig } from "./RumRateLimitCustomConfig"; import { RumRetentionFilterAttributes } from "./RumRetentionFilterAttributes"; import { RumRetentionFilterCreateAttributes } from "./RumRetentionFilterCreateAttributes"; import { RumRetentionFilterCreateData } from "./RumRetentionFilterCreateData"; @@ -6650,6 +6658,11 @@ const enumsMap: { [key: string]: any[] } = { "forced_replay_sessions", ], RumPermanentRetentionFilterType: ["permanent_retention_filters"], + RumRateLimitConfigType: ["rum_rate_limit_config"], + RumRateLimitMode: ["custom", "adaptive"], + RumRateLimitQuotaReachedAction: ["stop", "slowdown"], + RumRateLimitScopeType: ["application"], + RumRateLimitWindowType: ["daily"], RumRetentionFilterEventType: [ "session", "view", @@ -11663,6 +11676,14 @@ const typeMap: { [index: string]: any } = { RumPermanentRetentionFilterUpdateRequest: RumPermanentRetentionFilterUpdateRequest, RumPermanentRetentionFiltersResponse: RumPermanentRetentionFiltersResponse, + RumRateLimitAdaptiveConfig: RumRateLimitAdaptiveConfig, + RumRateLimitConfigAttributes: RumRateLimitConfigAttributes, + RumRateLimitConfigData: RumRateLimitConfigData, + RumRateLimitConfigResponse: RumRateLimitConfigResponse, + RumRateLimitConfigUpdateAttributes: RumRateLimitConfigUpdateAttributes, + RumRateLimitConfigUpdateData: RumRateLimitConfigUpdateData, + RumRateLimitConfigUpdateRequest: RumRateLimitConfigUpdateRequest, + RumRateLimitCustomConfig: RumRateLimitCustomConfig, RumRetentionFilterAttributes: RumRetentionFilterAttributes, RumRetentionFilterCreateAttributes: RumRetentionFilterCreateAttributes, RumRetentionFilterCreateData: RumRetentionFilterCreateData, diff --git a/packages/datadog-api-client-v2/models/RumRateLimitAdaptiveConfig.ts b/packages/datadog-api-client-v2/models/RumRateLimitAdaptiveConfig.ts new file mode 100644 index 000000000000..41b060917f94 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitAdaptiveConfig.ts @@ -0,0 +1,54 @@ +/** + * 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"; + +/** + * The configuration used when `mode` is `adaptive`. + */ +export class RumRateLimitAdaptiveConfig { + /** + * The maximum fraction of sessions to retain, in the range `(0, 1]`. + */ + "maxRetentionRate": 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 = { + maxRetentionRate: { + baseName: "max_retention_rate", + type: "number", + required: true, + format: "double", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumRateLimitAdaptiveConfig.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RumRateLimitConfigAttributes.ts b/packages/datadog-api-client-v2/models/RumRateLimitConfigAttributes.ts new file mode 100644 index 000000000000..98171f720b0d --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitConfigAttributes.ts @@ -0,0 +1,99 @@ +/** + * 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 { RumRateLimitAdaptiveConfig } from "./RumRateLimitAdaptiveConfig"; +import { RumRateLimitCustomConfig } from "./RumRateLimitCustomConfig"; +import { RumRateLimitMode } from "./RumRateLimitMode"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The RUM rate limit configuration properties. + */ +export class RumRateLimitConfigAttributes { + /** + * The configuration used when `mode` is `adaptive`. + */ + "adaptive"?: RumRateLimitAdaptiveConfig; + /** + * The configuration used when `mode` is `custom`. + */ + "custom"?: RumRateLimitCustomConfig; + /** + * The rate limit mode. `custom` enforces a fixed session limit, while + * `adaptive` dynamically adjusts retention. + */ + "mode": RumRateLimitMode; + /** + * The ID of the organization the rate limit configuration belongs to. + */ + "orgId": number; + /** + * The date the rate limit configuration was last updated. + */ + "updatedAt"?: string; + /** + * The handle of the user who last updated the rate limit configuration. + */ + "updatedBy"?: string; + + /** + * 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 = { + adaptive: { + baseName: "adaptive", + type: "RumRateLimitAdaptiveConfig", + }, + custom: { + baseName: "custom", + type: "RumRateLimitCustomConfig", + }, + mode: { + baseName: "mode", + type: "RumRateLimitMode", + required: true, + }, + orgId: { + baseName: "org_id", + type: "number", + required: true, + format: "int64", + }, + updatedAt: { + baseName: "updated_at", + type: "string", + }, + updatedBy: { + baseName: "updated_by", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumRateLimitConfigAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RumRateLimitConfigData.ts b/packages/datadog-api-client-v2/models/RumRateLimitConfigData.ts new file mode 100644 index 000000000000..fe6789d1350d --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitConfigData.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 { RumRateLimitConfigAttributes } from "./RumRateLimitConfigAttributes"; +import { RumRateLimitConfigType } from "./RumRateLimitConfigType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The RUM rate limit configuration object. + */ +export class RumRateLimitConfigData { + /** + * The RUM rate limit configuration properties. + */ + "attributes": RumRateLimitConfigAttributes; + /** + * The identifier of the scope the rate limit configuration applies to. + */ + "id": string; + /** + * The type of the resource, always `rum_rate_limit_config`. + */ + "type": RumRateLimitConfigType; + + /** + * 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 = { + attributes: { + baseName: "attributes", + type: "RumRateLimitConfigAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "RumRateLimitConfigType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumRateLimitConfigData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RumRateLimitConfigResponse.ts b/packages/datadog-api-client-v2/models/RumRateLimitConfigResponse.ts new file mode 100644 index 000000000000..ca9d09cbadec --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitConfigResponse.ts @@ -0,0 +1,54 @@ +/** + * 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 { RumRateLimitConfigData } from "./RumRateLimitConfigData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The RUM rate limit configuration response. + */ +export class RumRateLimitConfigResponse { + /** + * The RUM rate limit configuration object. + */ + "data": RumRateLimitConfigData; + + /** + * 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 = { + data: { + baseName: "data", + type: "RumRateLimitConfigData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumRateLimitConfigResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RumRateLimitConfigType.ts b/packages/datadog-api-client-v2/models/RumRateLimitConfigType.ts new file mode 100644 index 000000000000..f3e830e95dfe --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitConfigType.ts @@ -0,0 +1,16 @@ +/** + * 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 { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The type of the resource, always `rum_rate_limit_config`. + */ + +export type RumRateLimitConfigType = + | typeof RUM_RATE_LIMIT_CONFIG + | UnparsedObject; +export const RUM_RATE_LIMIT_CONFIG = "rum_rate_limit_config"; diff --git a/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateAttributes.ts b/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateAttributes.ts new file mode 100644 index 000000000000..5a804642c984 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateAttributes.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 { RumRateLimitAdaptiveConfig } from "./RumRateLimitAdaptiveConfig"; +import { RumRateLimitCustomConfig } from "./RumRateLimitCustomConfig"; +import { RumRateLimitMode } from "./RumRateLimitMode"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The RUM rate limit configuration properties to create or update. + */ +export class RumRateLimitConfigUpdateAttributes { + /** + * The configuration used when `mode` is `adaptive`. + */ + "adaptive"?: RumRateLimitAdaptiveConfig; + /** + * The configuration used when `mode` is `custom`. + */ + "custom"?: RumRateLimitCustomConfig; + /** + * The rate limit mode. `custom` enforces a fixed session limit, while + * `adaptive` dynamically adjusts retention. + */ + "mode": RumRateLimitMode; + + /** + * 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 = { + adaptive: { + baseName: "adaptive", + type: "RumRateLimitAdaptiveConfig", + }, + custom: { + baseName: "custom", + type: "RumRateLimitCustomConfig", + }, + mode: { + baseName: "mode", + type: "RumRateLimitMode", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumRateLimitConfigUpdateAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateData.ts b/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateData.ts new file mode 100644 index 000000000000..47290887bc0a --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateData.ts @@ -0,0 +1,74 @@ +/** + * 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 { RumRateLimitConfigType } from "./RumRateLimitConfigType"; +import { RumRateLimitConfigUpdateAttributes } from "./RumRateLimitConfigUpdateAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The RUM rate limit configuration to create or update. + */ +export class RumRateLimitConfigUpdateData { + /** + * The RUM rate limit configuration properties to create or update. + */ + "attributes": RumRateLimitConfigUpdateAttributes; + /** + * The identifier of the scope the rate limit configuration applies to. + * Must match `scope_id` in the path. + */ + "id": string; + /** + * The type of the resource, always `rum_rate_limit_config`. + */ + "type": RumRateLimitConfigType; + + /** + * 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 = { + attributes: { + baseName: "attributes", + type: "RumRateLimitConfigUpdateAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "RumRateLimitConfigType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumRateLimitConfigUpdateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateRequest.ts b/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateRequest.ts new file mode 100644 index 000000000000..0258959eef99 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitConfigUpdateRequest.ts @@ -0,0 +1,54 @@ +/** + * 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 { RumRateLimitConfigUpdateData } from "./RumRateLimitConfigUpdateData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The body of a request to create or update a RUM rate limit configuration. + */ +export class RumRateLimitConfigUpdateRequest { + /** + * The RUM rate limit configuration to create or update. + */ + "data": RumRateLimitConfigUpdateData; + + /** + * 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 = { + data: { + baseName: "data", + type: "RumRateLimitConfigUpdateData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumRateLimitConfigUpdateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RumRateLimitCustomConfig.ts b/packages/datadog-api-client-v2/models/RumRateLimitCustomConfig.ts new file mode 100644 index 000000000000..172cf369e136 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitCustomConfig.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 { RumRateLimitQuotaReachedAction } from "./RumRateLimitQuotaReachedAction"; +import { RumRateLimitWindowType } from "./RumRateLimitWindowType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The configuration used when `mode` is `custom`. + */ +export class RumRateLimitCustomConfig { + /** + * The time of day when the daily quota resets, in `HH:MM` 24-hour format. + */ + "dailyResetTime": string; + /** + * The timezone offset used for the daily reset time, in `±HH:MM` format. + */ + "dailyResetTimezone": string; + /** + * The action to take when the session quota is reached. + */ + "quotaReachedAction": RumRateLimitQuotaReachedAction; + /** + * The maximum number of sessions allowed within the window. + */ + "sessionLimit": number; + /** + * The window type over which the session limit is enforced. + */ + "windowType": RumRateLimitWindowType; + + /** + * 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 = { + dailyResetTime: { + baseName: "daily_reset_time", + type: "string", + required: true, + }, + dailyResetTimezone: { + baseName: "daily_reset_timezone", + type: "string", + required: true, + }, + quotaReachedAction: { + baseName: "quota_reached_action", + type: "RumRateLimitQuotaReachedAction", + required: true, + }, + sessionLimit: { + baseName: "session_limit", + type: "number", + required: true, + format: "int64", + }, + windowType: { + baseName: "window_type", + type: "RumRateLimitWindowType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumRateLimitCustomConfig.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RumRateLimitMode.ts b/packages/datadog-api-client-v2/models/RumRateLimitMode.ts new file mode 100644 index 000000000000..a4d32994132d --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitMode.ts @@ -0,0 +1,16 @@ +/** + * 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 { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The rate limit mode. `custom` enforces a fixed session limit, while + * `adaptive` dynamically adjusts retention. + */ + +export type RumRateLimitMode = typeof CUSTOM | typeof ADAPTIVE | UnparsedObject; +export const CUSTOM = "custom"; +export const ADAPTIVE = "adaptive"; diff --git a/packages/datadog-api-client-v2/models/RumRateLimitQuotaReachedAction.ts b/packages/datadog-api-client-v2/models/RumRateLimitQuotaReachedAction.ts new file mode 100644 index 000000000000..30261021c891 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitQuotaReachedAction.ts @@ -0,0 +1,18 @@ +/** + * 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 { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The action to take when the session quota is reached. + */ + +export type RumRateLimitQuotaReachedAction = + | typeof STOP + | typeof SLOWDOWN + | UnparsedObject; +export const STOP = "stop"; +export const SLOWDOWN = "slowdown"; diff --git a/packages/datadog-api-client-v2/models/RumRateLimitScopeType.ts b/packages/datadog-api-client-v2/models/RumRateLimitScopeType.ts new file mode 100644 index 000000000000..5cb918b55f1b --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitScopeType.ts @@ -0,0 +1,14 @@ +/** + * 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 { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The type of scope the rate limit configuration applies to. + */ + +export type RumRateLimitScopeType = typeof APPLICATION | UnparsedObject; +export const APPLICATION = "application"; diff --git a/packages/datadog-api-client-v2/models/RumRateLimitWindowType.ts b/packages/datadog-api-client-v2/models/RumRateLimitWindowType.ts new file mode 100644 index 000000000000..4e9b190a6d7c --- /dev/null +++ b/packages/datadog-api-client-v2/models/RumRateLimitWindowType.ts @@ -0,0 +1,14 @@ +/** + * 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 { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The window type over which the session limit is enforced. + */ + +export type RumRateLimitWindowType = typeof DAILY | UnparsedObject; +export const DAILY = "daily";