From 764d1bce86a2998a9601707bd2298292861dfe90 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 19 Aug 2026 23:08:46 +0000 Subject: [PATCH] Regenerate client from commit 8f7e449 of spec repo --- .generator/schemas/v2/openapi.yaml | 387 ++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 91 ++++ .../DeleteRumQuotaConfig.py | 15 + .../rum-retention-quota/GetRumQuotaConfig.py | 17 + .../UpsertRumQuotaConfig.py | 47 +++ .../v2/api/rum_retention_quota_api.py | 188 +++++++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../rum_retention_quota_adaptive_config.py | 40 ++ .../rum_retention_quota_config_attributes.py | 91 ++++ .../model/rum_retention_quota_config_data.py | 56 +++ .../rum_retention_quota_config_response.py | 40 ++ .../model/rum_retention_quota_config_type.py | 35 ++ ...etention_quota_config_update_attributes.py | 67 +++ .../rum_retention_quota_config_update_data.py | 61 +++ ...m_retention_quota_config_update_request.py | 40 ++ .../rum_retention_quota_custom_config.py | 82 ++++ .../v2/model/rum_retention_quota_mode.py | 39 ++ .../rum_retention_quota_reached_action.py | 38 ++ .../model/rum_retention_quota_scope_type.py | 35 ++ .../model/rum_retention_quota_window_type.py | 35 ++ src/datadog_api_client/v2/models/__init__.py | 28 ++ tests/v2/features/rum_retention_quota.feature | 100 +++++ tests/v2/features/undo.json | 18 + 24 files changed, 1559 insertions(+) create mode 100644 examples/v2/rum-retention-quota/DeleteRumQuotaConfig.py create mode 100644 examples/v2/rum-retention-quota/GetRumQuotaConfig.py create mode 100644 examples/v2/rum-retention-quota/UpsertRumQuotaConfig.py create mode 100644 src/datadog_api_client/v2/api/rum_retention_quota_api.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_adaptive_config.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_config_attributes.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_config_data.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_config_response.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_config_type.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_config_update_attributes.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_config_update_data.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_config_update_request.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_custom_config.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_mode.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_reached_action.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_scope_type.py create mode 100644 src/datadog_api_client/v2/model/rum_retention_quota_window_type.py create mode 100644 tests/v2/features/rum_retention_quota.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 982af41880..62c3dcc984 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1788,6 +1788,23 @@ components: required: true schema: type: string + RumRetentionQuotaScopeIDParameter: + description: |- + The identifier of the scope the retention quota 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 + RumRetentionQuotaScopeTypeParameter: + description: The type of scope the retention quota configuration applies to. + in: path + name: scope_type + required: true + schema: + $ref: "#/components/schemas/RumRetentionQuotaScopeType" SAMLConfigurationUUIDPathParameter: description: The UUID of the SAML configuration. in: path @@ -90311,6 +90328,180 @@ components: $ref: "#/components/schemas/RumRetentionFilterData" type: array type: object + RumRetentionQuotaAdaptiveConfig: + 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 + RumRetentionQuotaConfigAttributes: + description: The RUM retention quota configuration properties. + properties: + adaptive: + $ref: "#/components/schemas/RumRetentionQuotaAdaptiveConfig" + custom: + $ref: "#/components/schemas/RumRetentionQuotaCustomConfig" + mode: + $ref: "#/components/schemas/RumRetentionQuotaMode" + org_id: + description: The ID of the organization the retention quota configuration belongs to. + example: 2 + format: int64 + type: integer + updated_at: + description: The date the retention quota configuration was last updated. + example: "2026-03-04T15:37:54.951447Z" + format: date-time + type: string + updated_by: + description: The handle of the user who last updated the retention quota configuration. + example: test@example.com + type: string + required: + - mode + - org_id + type: object + RumRetentionQuotaConfigData: + description: The RUM retention quota configuration object. + properties: + attributes: + $ref: "#/components/schemas/RumRetentionQuotaConfigAttributes" + id: + description: The identifier of the scope the retention quota configuration applies to. + example: cd73a516-a481-4af5-8352-9b577465c77b + type: string + type: + $ref: "#/components/schemas/RumRetentionQuotaConfigType" + required: + - id + - type + - attributes + type: object + RumRetentionQuotaConfigResponse: + description: The RUM retention quota configuration response. + properties: + data: + $ref: "#/components/schemas/RumRetentionQuotaConfigData" + required: + - data + type: object + RumRetentionQuotaConfigType: + default: rum_quota_config + description: The type of the resource, always `rum_quota_config`. + enum: + - rum_quota_config + example: rum_quota_config + type: string + x-enum-varnames: ["RUM_QUOTA_CONFIG"] + RumRetentionQuotaConfigUpdateAttributes: + description: The RUM retention quota configuration properties to create or update. + properties: + adaptive: + $ref: "#/components/schemas/RumRetentionQuotaAdaptiveConfig" + custom: + $ref: "#/components/schemas/RumRetentionQuotaCustomConfig" + mode: + $ref: "#/components/schemas/RumRetentionQuotaMode" + required: + - mode + type: object + RumRetentionQuotaConfigUpdateData: + description: The RUM retention quota configuration to create or update. + properties: + attributes: + $ref: "#/components/schemas/RumRetentionQuotaConfigUpdateAttributes" + id: + description: |- + The identifier of the scope the retention quota configuration applies to. + Must match `scope_id` in the path. + example: cd73a516-a481-4af5-8352-9b577465c77b + type: string + type: + $ref: "#/components/schemas/RumRetentionQuotaConfigType" + required: + - id + - type + - attributes + type: object + RumRetentionQuotaConfigUpdateRequest: + description: The body of a request to create or update a RUM retention quota configuration. + properties: + data: + $ref: "#/components/schemas/RumRetentionQuotaConfigUpdateData" + required: + - data + type: object + RumRetentionQuotaCustomConfig: + 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/RumRetentionQuotaReachedAction" + session_limit: + description: The maximum number of sessions allowed within the window. Must be at least `1000`. + example: 1000000 + format: int64 + minimum: 1000 + type: integer + window_type: + $ref: "#/components/schemas/RumRetentionQuotaWindowType" + required: + - window_type + - session_limit + - daily_reset_time + - daily_reset_timezone + - quota_reached_action + type: object + RumRetentionQuotaMode: + description: |- + The retention quota mode. `custom` enforces a fixed session limit, while + `adaptive` dynamically adjusts retention. + enum: + - custom + - adaptive + example: custom + type: string + x-enum-varnames: ["CUSTOM", "ADAPTIVE"] + RumRetentionQuotaReachedAction: + description: The action to take when the session quota is reached. + enum: + - stop + - slowdown + example: stop + type: string + x-enum-varnames: ["STOP", "SLOWDOWN"] + RumRetentionQuotaScopeType: + default: application + description: The type of scope the retention quota configuration applies to. + enum: + - application + example: application + type: string + x-enum-varnames: ["APPLICATION"] + RumRetentionQuotaWindowType: + description: The window type over which the session limit is enforced. + enum: + - daily + example: daily + type: string + x-enum-varnames: ["DAILY"] RumSdkConfigAllowedTracingUrlList: description: A list of URL configurations for distributed tracing. items: @@ -184026,6 +184217,199 @@ paths: tags: - Rum Metrics x-codegen-request-body-name: body + /api/v2/rum/config/retention-quota/{scope_type}/{scope_id}: + delete: + description: Delete the RUM retention quota configuration for a given scope. + operationId: DeleteRumQuotaConfig + parameters: + - $ref: "#/components/parameters/RumRetentionQuotaScopeTypeParameter" + - $ref: "#/components/parameters/RumRetentionQuotaScopeIDParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a RUM retention quota configuration + tags: + - RUM Retention Quota + x-permission: + operator: OR + permissions: + - rum_retention_filters_write + get: + description: Get the RUM retention quota configuration for a given scope. + operationId: GetRumQuotaConfig + parameters: + - $ref: "#/components/parameters/RumRetentionQuotaScopeTypeParameter" + - $ref: "#/components/parameters/RumRetentionQuotaScopeIDParameter" + 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_quota_config + schema: + $ref: "#/components/schemas/RumRetentionQuotaConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a RUM retention quota configuration + tags: + - RUM Retention Quota + x-permission: + operator: OR + permissions: + - rum_retention_filters_read + put: + description: |- + Create or update the RUM retention quota configuration for a given scope. + Returns the retention quota configuration object when the request is successful. + operationId: UpsertRumQuotaConfig + parameters: + - $ref: "#/components/parameters/RumRetentionQuotaScopeTypeParameter" + - $ref: "#/components/parameters/RumRetentionQuotaScopeIDParameter" + 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_quota_config + schema: + $ref: "#/components/schemas/RumRetentionQuotaConfigUpdateRequest" + description: The definition of the RUM retention quota 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_quota_config + schema: + $ref: "#/components/schemas/RumRetentionQuotaConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create or update a RUM retention quota config + tags: + - RUM Retention Quota + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - rum_retention_filters_write /api/v2/rum/events: get: description: |- @@ -214490,6 +214874,9 @@ tags: description: Find out more at url: https://docs.datadoghq.com/real_user_monitoring/ name: RUM Remote Config + - description: |- + Manage RUM retention quota configurations for your organization's RUM applications. + name: RUM Retention Quota - description: View and manage Reference Tables in your organization. name: Reference Tables - description: |- diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index be0d328f51..93e493d595 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -781,6 +781,13 @@ datadog\_api\_client.v2.api.rum\_retention\_filters\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.rum\_retention\_quota\_api module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.rum_retention_quota_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.salesforce\_integration\_api module --------------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index d1ddaac1fe..10e33126b2 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -38588,6 +38588,97 @@ datadog\_api\_client.v2.model.rum\_retention\_filters\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.rum\_retention\_quota\_adaptive\_config module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_adaptive_config + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_config\_attributes module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_config_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_config\_data module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_config_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_config\_response module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_config_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_config\_type module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_config_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_config\_update\_attributes module +-------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_config_update_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_config\_update\_data module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_config_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_config\_update\_request module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_config_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_custom\_config module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_custom_config + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_mode module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_mode + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_reached\_action module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_reached_action + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_scope\_type module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_scope_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.rum\_retention\_quota\_window\_type module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.rum_retention_quota_window_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.rum\_sdk\_config\_attributes module ----------------------------------------------------------------- diff --git a/examples/v2/rum-retention-quota/DeleteRumQuotaConfig.py b/examples/v2/rum-retention-quota/DeleteRumQuotaConfig.py new file mode 100644 index 0000000000..684a4257ca --- /dev/null +++ b/examples/v2/rum-retention-quota/DeleteRumQuotaConfig.py @@ -0,0 +1,15 @@ +""" +Delete a RUM retention quota configuration returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.rum_retention_quota_api import RUMRetentionQuotaApi +from datadog_api_client.v2.model.rum_retention_quota_scope_type import RumRetentionQuotaScopeType + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = RUMRetentionQuotaApi(api_client) + api_instance.delete_rum_quota_config( + scope_type=RumRetentionQuotaScopeType.APPLICATION, + scope_id="ced16651-97b6-4e67-8590-8caec3af0695", + ) diff --git a/examples/v2/rum-retention-quota/GetRumQuotaConfig.py b/examples/v2/rum-retention-quota/GetRumQuotaConfig.py new file mode 100644 index 0000000000..fb288bc8c3 --- /dev/null +++ b/examples/v2/rum-retention-quota/GetRumQuotaConfig.py @@ -0,0 +1,17 @@ +""" +Get a RUM retention quota configuration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.rum_retention_quota_api import RUMRetentionQuotaApi +from datadog_api_client.v2.model.rum_retention_quota_scope_type import RumRetentionQuotaScopeType + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = RUMRetentionQuotaApi(api_client) + response = api_instance.get_rum_quota_config( + scope_type=RumRetentionQuotaScopeType.APPLICATION, + scope_id="ced16651-97b6-4e67-8590-8caec3af0695", + ) + + print(response) diff --git a/examples/v2/rum-retention-quota/UpsertRumQuotaConfig.py b/examples/v2/rum-retention-quota/UpsertRumQuotaConfig.py new file mode 100644 index 0000000000..4839680a2b --- /dev/null +++ b/examples/v2/rum-retention-quota/UpsertRumQuotaConfig.py @@ -0,0 +1,47 @@ +""" +Create or update a RUM retention quota config returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.rum_retention_quota_api import RUMRetentionQuotaApi +from datadog_api_client.v2.model.rum_retention_quota_adaptive_config import RumRetentionQuotaAdaptiveConfig +from datadog_api_client.v2.model.rum_retention_quota_config_type import RumRetentionQuotaConfigType +from datadog_api_client.v2.model.rum_retention_quota_config_update_attributes import ( + RumRetentionQuotaConfigUpdateAttributes, +) +from datadog_api_client.v2.model.rum_retention_quota_config_update_data import RumRetentionQuotaConfigUpdateData +from datadog_api_client.v2.model.rum_retention_quota_config_update_request import RumRetentionQuotaConfigUpdateRequest +from datadog_api_client.v2.model.rum_retention_quota_custom_config import RumRetentionQuotaCustomConfig +from datadog_api_client.v2.model.rum_retention_quota_mode import RumRetentionQuotaMode +from datadog_api_client.v2.model.rum_retention_quota_reached_action import RumRetentionQuotaReachedAction +from datadog_api_client.v2.model.rum_retention_quota_scope_type import RumRetentionQuotaScopeType +from datadog_api_client.v2.model.rum_retention_quota_window_type import RumRetentionQuotaWindowType + +body = RumRetentionQuotaConfigUpdateRequest( + data=RumRetentionQuotaConfigUpdateData( + attributes=RumRetentionQuotaConfigUpdateAttributes( + adaptive=RumRetentionQuotaAdaptiveConfig( + max_retention_rate=0.5, + ), + custom=RumRetentionQuotaCustomConfig( + daily_reset_time="08:00", + daily_reset_timezone="+09:00", + quota_reached_action=RumRetentionQuotaReachedAction.STOP, + session_limit=1000000, + window_type=RumRetentionQuotaWindowType.DAILY, + ), + mode=RumRetentionQuotaMode.CUSTOM, + ), + id="ced16651-97b6-4e67-8590-8caec3af0695", + type=RumRetentionQuotaConfigType.RUM_QUOTA_CONFIG, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = RUMRetentionQuotaApi(api_client) + response = api_instance.upsert_rum_quota_config( + scope_type=RumRetentionQuotaScopeType.APPLICATION, scope_id="ced16651-97b6-4e67-8590-8caec3af0695", body=body + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/rum_retention_quota_api.py b/src/datadog_api_client/v2/api/rum_retention_quota_api.py new file mode 100644 index 0000000000..a833f15c82 --- /dev/null +++ b/src/datadog_api_client/v2/api/rum_retention_quota_api.py @@ -0,0 +1,188 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.v2.model.rum_retention_quota_scope_type import RumRetentionQuotaScopeType +from datadog_api_client.v2.model.rum_retention_quota_config_response import RumRetentionQuotaConfigResponse +from datadog_api_client.v2.model.rum_retention_quota_config_update_request import RumRetentionQuotaConfigUpdateRequest + + +class RUMRetentionQuotaApi: + """ + Manage RUM retention quota configurations for your organization's RUM applications. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._delete_rum_quota_config_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}", + "operation_id": "delete_rum_quota_config", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "scope_type": { + "required": True, + "openapi_types": (RumRetentionQuotaScopeType,), + "attribute": "scope_type", + "location": "path", + }, + "scope_id": { + "required": True, + "openapi_types": (str,), + "attribute": "scope_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_rum_quota_config_endpoint = _Endpoint( + settings={ + "response_type": (RumRetentionQuotaConfigResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}", + "operation_id": "get_rum_quota_config", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "scope_type": { + "required": True, + "openapi_types": (RumRetentionQuotaScopeType,), + "attribute": "scope_type", + "location": "path", + }, + "scope_id": { + "required": True, + "openapi_types": (str,), + "attribute": "scope_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._upsert_rum_quota_config_endpoint = _Endpoint( + settings={ + "response_type": (RumRetentionQuotaConfigResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/rum/config/retention-quota/{scope_type}/{scope_id}", + "operation_id": "upsert_rum_quota_config", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "scope_type": { + "required": True, + "openapi_types": (RumRetentionQuotaScopeType,), + "attribute": "scope_type", + "location": "path", + }, + "scope_id": { + "required": True, + "openapi_types": (str,), + "attribute": "scope_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (RumRetentionQuotaConfigUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def delete_rum_quota_config( + self, + scope_type: RumRetentionQuotaScopeType, + scope_id: str, + ) -> None: + """Delete a RUM retention quota configuration. + + Delete the RUM retention quota configuration for a given scope. + + :param scope_type: The type of scope the retention quota configuration applies to. + :type scope_type: RumRetentionQuotaScopeType + :param scope_id: The identifier of the scope the retention quota configuration applies to. + For the ``application`` scope, this is the RUM application ID. + :type scope_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["scope_type"] = scope_type + + kwargs["scope_id"] = scope_id + + return self._delete_rum_quota_config_endpoint.call_with_http_info(**kwargs) + + def get_rum_quota_config( + self, + scope_type: RumRetentionQuotaScopeType, + scope_id: str, + ) -> RumRetentionQuotaConfigResponse: + """Get a RUM retention quota configuration. + + Get the RUM retention quota configuration for a given scope. + + :param scope_type: The type of scope the retention quota configuration applies to. + :type scope_type: RumRetentionQuotaScopeType + :param scope_id: The identifier of the scope the retention quota configuration applies to. + For the ``application`` scope, this is the RUM application ID. + :type scope_id: str + :rtype: RumRetentionQuotaConfigResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["scope_type"] = scope_type + + kwargs["scope_id"] = scope_id + + return self._get_rum_quota_config_endpoint.call_with_http_info(**kwargs) + + def upsert_rum_quota_config( + self, + scope_type: RumRetentionQuotaScopeType, + scope_id: str, + body: RumRetentionQuotaConfigUpdateRequest, + ) -> RumRetentionQuotaConfigResponse: + """Create or update a RUM retention quota config. + + Create or update the RUM retention quota configuration for a given scope. + Returns the retention quota configuration object when the request is successful. + + :param scope_type: The type of scope the retention quota configuration applies to. + :type scope_type: RumRetentionQuotaScopeType + :param scope_id: The identifier of the scope the retention quota configuration applies to. + For the ``application`` scope, this is the RUM application ID. + :type scope_id: str + :param body: The definition of the RUM retention quota configuration to create or update. + :type body: RumRetentionQuotaConfigUpdateRequest + :rtype: RumRetentionQuotaConfigResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["scope_type"] = scope_type + + kwargs["scope_id"] = scope_id + + kwargs["body"] = body + + return self._upsert_rum_quota_config_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index ca86ad5591..a32889760f 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -97,6 +97,7 @@ from datadog_api_client.v2.api.rum_insights_api import RUMInsightsApi from datadog_api_client.v2.api.rum_operations_api import RUMOperationsApi from datadog_api_client.v2.api.rum_remote_config_api import RUMRemoteConfigApi +from datadog_api_client.v2.api.rum_retention_quota_api import RUMRetentionQuotaApi from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi from datadog_api_client.v2.api.report_schedules_api import ReportSchedulesApi from datadog_api_client.v2.api.reporting_and_sharing_api import ReportingAndSharingApi @@ -241,6 +242,7 @@ "RUMInsightsApi", "RUMOperationsApi", "RUMRemoteConfigApi", + "RUMRetentionQuotaApi", "ReferenceTablesApi", "ReportSchedulesApi", "ReportingAndSharingApi", diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_adaptive_config.py b/src/datadog_api_client/v2/model/rum_retention_quota_adaptive_config.py new file mode 100644 index 0000000000..27ad0e331e --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_adaptive_config.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class RumRetentionQuotaAdaptiveConfig(ModelNormal): + validations = { + "max_retention_rate": { + "inclusive_maximum": 1, + "exclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + return { + "max_retention_rate": (float,), + } + + attribute_map = { + "max_retention_rate": "max_retention_rate", + } + + def __init__(self_, max_retention_rate: float, **kwargs): + """ + The configuration used when ``mode`` is ``adaptive``. + + :param max_retention_rate: The maximum fraction of sessions to retain, in the range ``(0, 1]``. + :type max_retention_rate: float + """ + super().__init__(kwargs) + + self_.max_retention_rate = max_retention_rate diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_config_attributes.py b/src/datadog_api_client/v2/model/rum_retention_quota_config_attributes.py new file mode 100644 index 0000000000..892026bdb3 --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_config_attributes.py @@ -0,0 +1,91 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.rum_retention_quota_adaptive_config import RumRetentionQuotaAdaptiveConfig + from datadog_api_client.v2.model.rum_retention_quota_custom_config import RumRetentionQuotaCustomConfig + from datadog_api_client.v2.model.rum_retention_quota_mode import RumRetentionQuotaMode + + +class RumRetentionQuotaConfigAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.rum_retention_quota_adaptive_config import RumRetentionQuotaAdaptiveConfig + from datadog_api_client.v2.model.rum_retention_quota_custom_config import RumRetentionQuotaCustomConfig + from datadog_api_client.v2.model.rum_retention_quota_mode import RumRetentionQuotaMode + + return { + "adaptive": (RumRetentionQuotaAdaptiveConfig,), + "custom": (RumRetentionQuotaCustomConfig,), + "mode": (RumRetentionQuotaMode,), + "org_id": (int,), + "updated_at": (datetime,), + "updated_by": (str,), + } + + attribute_map = { + "adaptive": "adaptive", + "custom": "custom", + "mode": "mode", + "org_id": "org_id", + "updated_at": "updated_at", + "updated_by": "updated_by", + } + + def __init__( + self_, + mode: RumRetentionQuotaMode, + org_id: int, + adaptive: Union[RumRetentionQuotaAdaptiveConfig, UnsetType] = unset, + custom: Union[RumRetentionQuotaCustomConfig, UnsetType] = unset, + updated_at: Union[datetime, UnsetType] = unset, + updated_by: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The RUM retention quota configuration properties. + + :param adaptive: The configuration used when ``mode`` is ``adaptive``. + :type adaptive: RumRetentionQuotaAdaptiveConfig, optional + + :param custom: The configuration used when ``mode`` is ``custom``. + :type custom: RumRetentionQuotaCustomConfig, optional + + :param mode: The retention quota mode. ``custom`` enforces a fixed session limit, while + ``adaptive`` dynamically adjusts retention. + :type mode: RumRetentionQuotaMode + + :param org_id: The ID of the organization the retention quota configuration belongs to. + :type org_id: int + + :param updated_at: The date the retention quota configuration was last updated. + :type updated_at: datetime, optional + + :param updated_by: The handle of the user who last updated the retention quota configuration. + :type updated_by: str, optional + """ + if adaptive is not unset: + kwargs["adaptive"] = adaptive + if custom is not unset: + kwargs["custom"] = custom + if updated_at is not unset: + kwargs["updated_at"] = updated_at + if updated_by is not unset: + kwargs["updated_by"] = updated_by + super().__init__(kwargs) + + self_.mode = mode + self_.org_id = org_id diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_config_data.py b/src/datadog_api_client/v2/model/rum_retention_quota_config_data.py new file mode 100644 index 0000000000..ec2d1fb060 --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_config_data.py @@ -0,0 +1,56 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.rum_retention_quota_config_attributes import RumRetentionQuotaConfigAttributes + from datadog_api_client.v2.model.rum_retention_quota_config_type import RumRetentionQuotaConfigType + + +class RumRetentionQuotaConfigData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.rum_retention_quota_config_attributes import RumRetentionQuotaConfigAttributes + from datadog_api_client.v2.model.rum_retention_quota_config_type import RumRetentionQuotaConfigType + + return { + "attributes": (RumRetentionQuotaConfigAttributes,), + "id": (str,), + "type": (RumRetentionQuotaConfigType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: RumRetentionQuotaConfigAttributes, id: str, type: RumRetentionQuotaConfigType, **kwargs + ): + """ + The RUM retention quota configuration object. + + :param attributes: The RUM retention quota configuration properties. + :type attributes: RumRetentionQuotaConfigAttributes + + :param id: The identifier of the scope the retention quota configuration applies to. + :type id: str + + :param type: The type of the resource, always ``rum_quota_config``. + :type type: RumRetentionQuotaConfigType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_config_response.py b/src/datadog_api_client/v2/model/rum_retention_quota_config_response.py new file mode 100644 index 0000000000..c83279f5cf --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_config_response.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.rum_retention_quota_config_data import RumRetentionQuotaConfigData + + +class RumRetentionQuotaConfigResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.rum_retention_quota_config_data import RumRetentionQuotaConfigData + + return { + "data": (RumRetentionQuotaConfigData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: RumRetentionQuotaConfigData, **kwargs): + """ + The RUM retention quota configuration response. + + :param data: The RUM retention quota configuration object. + :type data: RumRetentionQuotaConfigData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_config_type.py b/src/datadog_api_client/v2/model/rum_retention_quota_config_type.py new file mode 100644 index 0000000000..f640e18c2c --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_config_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class RumRetentionQuotaConfigType(ModelSimple): + """ + The type of the resource, always `rum_quota_config`. + + :param value: If omitted defaults to "rum_quota_config". Must be one of ["rum_quota_config"]. + :type value: str + """ + + allowed_values = { + "rum_quota_config", + } + RUM_QUOTA_CONFIG: ClassVar["RumRetentionQuotaConfigType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +RumRetentionQuotaConfigType.RUM_QUOTA_CONFIG = RumRetentionQuotaConfigType("rum_quota_config") diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_config_update_attributes.py b/src/datadog_api_client/v2/model/rum_retention_quota_config_update_attributes.py new file mode 100644 index 0000000000..e36da834af --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_config_update_attributes.py @@ -0,0 +1,67 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.rum_retention_quota_adaptive_config import RumRetentionQuotaAdaptiveConfig + from datadog_api_client.v2.model.rum_retention_quota_custom_config import RumRetentionQuotaCustomConfig + from datadog_api_client.v2.model.rum_retention_quota_mode import RumRetentionQuotaMode + + +class RumRetentionQuotaConfigUpdateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.rum_retention_quota_adaptive_config import RumRetentionQuotaAdaptiveConfig + from datadog_api_client.v2.model.rum_retention_quota_custom_config import RumRetentionQuotaCustomConfig + from datadog_api_client.v2.model.rum_retention_quota_mode import RumRetentionQuotaMode + + return { + "adaptive": (RumRetentionQuotaAdaptiveConfig,), + "custom": (RumRetentionQuotaCustomConfig,), + "mode": (RumRetentionQuotaMode,), + } + + attribute_map = { + "adaptive": "adaptive", + "custom": "custom", + "mode": "mode", + } + + def __init__( + self_, + mode: RumRetentionQuotaMode, + adaptive: Union[RumRetentionQuotaAdaptiveConfig, UnsetType] = unset, + custom: Union[RumRetentionQuotaCustomConfig, UnsetType] = unset, + **kwargs, + ): + """ + The RUM retention quota configuration properties to create or update. + + :param adaptive: The configuration used when ``mode`` is ``adaptive``. + :type adaptive: RumRetentionQuotaAdaptiveConfig, optional + + :param custom: The configuration used when ``mode`` is ``custom``. + :type custom: RumRetentionQuotaCustomConfig, optional + + :param mode: The retention quota mode. ``custom`` enforces a fixed session limit, while + ``adaptive`` dynamically adjusts retention. + :type mode: RumRetentionQuotaMode + """ + if adaptive is not unset: + kwargs["adaptive"] = adaptive + if custom is not unset: + kwargs["custom"] = custom + super().__init__(kwargs) + + self_.mode = mode diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_config_update_data.py b/src/datadog_api_client/v2/model/rum_retention_quota_config_update_data.py new file mode 100644 index 0000000000..b2336bc82b --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_config_update_data.py @@ -0,0 +1,61 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.rum_retention_quota_config_update_attributes import ( + RumRetentionQuotaConfigUpdateAttributes, + ) + from datadog_api_client.v2.model.rum_retention_quota_config_type import RumRetentionQuotaConfigType + + +class RumRetentionQuotaConfigUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.rum_retention_quota_config_update_attributes import ( + RumRetentionQuotaConfigUpdateAttributes, + ) + from datadog_api_client.v2.model.rum_retention_quota_config_type import RumRetentionQuotaConfigType + + return { + "attributes": (RumRetentionQuotaConfigUpdateAttributes,), + "id": (str,), + "type": (RumRetentionQuotaConfigType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: RumRetentionQuotaConfigUpdateAttributes, id: str, type: RumRetentionQuotaConfigType, **kwargs + ): + """ + The RUM retention quota configuration to create or update. + + :param attributes: The RUM retention quota configuration properties to create or update. + :type attributes: RumRetentionQuotaConfigUpdateAttributes + + :param id: The identifier of the scope the retention quota configuration applies to. + Must match ``scope_id`` in the path. + :type id: str + + :param type: The type of the resource, always ``rum_quota_config``. + :type type: RumRetentionQuotaConfigType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_config_update_request.py b/src/datadog_api_client/v2/model/rum_retention_quota_config_update_request.py new file mode 100644 index 0000000000..5d058852bc --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_config_update_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.rum_retention_quota_config_update_data import RumRetentionQuotaConfigUpdateData + + +class RumRetentionQuotaConfigUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.rum_retention_quota_config_update_data import RumRetentionQuotaConfigUpdateData + + return { + "data": (RumRetentionQuotaConfigUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: RumRetentionQuotaConfigUpdateData, **kwargs): + """ + The body of a request to create or update a RUM retention quota configuration. + + :param data: The RUM retention quota configuration to create or update. + :type data: RumRetentionQuotaConfigUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_custom_config.py b/src/datadog_api_client/v2/model/rum_retention_quota_custom_config.py new file mode 100644 index 0000000000..770fcba442 --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_custom_config.py @@ -0,0 +1,82 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.rum_retention_quota_reached_action import RumRetentionQuotaReachedAction + from datadog_api_client.v2.model.rum_retention_quota_window_type import RumRetentionQuotaWindowType + + +class RumRetentionQuotaCustomConfig(ModelNormal): + validations = { + "daily_reset_time": {}, + "daily_reset_timezone": {}, + "session_limit": { + "inclusive_minimum": 1000, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.rum_retention_quota_reached_action import RumRetentionQuotaReachedAction + from datadog_api_client.v2.model.rum_retention_quota_window_type import RumRetentionQuotaWindowType + + return { + "daily_reset_time": (str,), + "daily_reset_timezone": (str,), + "quota_reached_action": (RumRetentionQuotaReachedAction,), + "session_limit": (int,), + "window_type": (RumRetentionQuotaWindowType,), + } + + attribute_map = { + "daily_reset_time": "daily_reset_time", + "daily_reset_timezone": "daily_reset_timezone", + "quota_reached_action": "quota_reached_action", + "session_limit": "session_limit", + "window_type": "window_type", + } + + def __init__( + self_, + daily_reset_time: str, + daily_reset_timezone: str, + quota_reached_action: RumRetentionQuotaReachedAction, + session_limit: int, + window_type: RumRetentionQuotaWindowType, + **kwargs, + ): + """ + The configuration used when ``mode`` is ``custom``. + + :param daily_reset_time: The time of day when the daily quota resets, in ``HH:MM`` 24-hour format. + :type daily_reset_time: str + + :param daily_reset_timezone: The timezone offset used for the daily reset time, in ``±HH:MM`` format. + :type daily_reset_timezone: str + + :param quota_reached_action: The action to take when the session quota is reached. + :type quota_reached_action: RumRetentionQuotaReachedAction + + :param session_limit: The maximum number of sessions allowed within the window. Must be at least ``1000``. + :type session_limit: int + + :param window_type: The window type over which the session limit is enforced. + :type window_type: RumRetentionQuotaWindowType + """ + super().__init__(kwargs) + + self_.daily_reset_time = daily_reset_time + self_.daily_reset_timezone = daily_reset_timezone + self_.quota_reached_action = quota_reached_action + self_.session_limit = session_limit + self_.window_type = window_type diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_mode.py b/src/datadog_api_client/v2/model/rum_retention_quota_mode.py new file mode 100644 index 0000000000..7a2c6acebb --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_mode.py @@ -0,0 +1,39 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class RumRetentionQuotaMode(ModelSimple): + """ + The retention quota mode. `custom` enforces a fixed session limit, while + `adaptive` dynamically adjusts retention. + + :param value: Must be one of ["custom", "adaptive"]. + :type value: str + """ + + allowed_values = { + "custom", + "adaptive", + } + CUSTOM: ClassVar["RumRetentionQuotaMode"] + ADAPTIVE: ClassVar["RumRetentionQuotaMode"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +RumRetentionQuotaMode.CUSTOM = RumRetentionQuotaMode("custom") +RumRetentionQuotaMode.ADAPTIVE = RumRetentionQuotaMode("adaptive") diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_reached_action.py b/src/datadog_api_client/v2/model/rum_retention_quota_reached_action.py new file mode 100644 index 0000000000..d85a0a8257 --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_reached_action.py @@ -0,0 +1,38 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class RumRetentionQuotaReachedAction(ModelSimple): + """ + The action to take when the session quota is reached. + + :param value: Must be one of ["stop", "slowdown"]. + :type value: str + """ + + allowed_values = { + "stop", + "slowdown", + } + STOP: ClassVar["RumRetentionQuotaReachedAction"] + SLOWDOWN: ClassVar["RumRetentionQuotaReachedAction"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +RumRetentionQuotaReachedAction.STOP = RumRetentionQuotaReachedAction("stop") +RumRetentionQuotaReachedAction.SLOWDOWN = RumRetentionQuotaReachedAction("slowdown") diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_scope_type.py b/src/datadog_api_client/v2/model/rum_retention_quota_scope_type.py new file mode 100644 index 0000000000..dd461b86c2 --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_scope_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class RumRetentionQuotaScopeType(ModelSimple): + """ + The type of scope the retention quota configuration applies to. + + :param value: If omitted defaults to "application". Must be one of ["application"]. + :type value: str + """ + + allowed_values = { + "application", + } + APPLICATION: ClassVar["RumRetentionQuotaScopeType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +RumRetentionQuotaScopeType.APPLICATION = RumRetentionQuotaScopeType("application") diff --git a/src/datadog_api_client/v2/model/rum_retention_quota_window_type.py b/src/datadog_api_client/v2/model/rum_retention_quota_window_type.py new file mode 100644 index 0000000000..1918b1226d --- /dev/null +++ b/src/datadog_api_client/v2/model/rum_retention_quota_window_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class RumRetentionQuotaWindowType(ModelSimple): + """ + The window type over which the session limit is enforced. + + :param value: If omitted defaults to "daily". Must be one of ["daily"]. + :type value: str + """ + + allowed_values = { + "daily", + } + DAILY: ClassVar["RumRetentionQuotaWindowType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +RumRetentionQuotaWindowType.DAILY = RumRetentionQuotaWindowType("daily") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index d5bf0573c2..23b41fb290 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -7758,6 +7758,21 @@ from datadog_api_client.v2.model.rum_retention_filters_order_request import RumRetentionFiltersOrderRequest from datadog_api_client.v2.model.rum_retention_filters_order_response import RumRetentionFiltersOrderResponse from datadog_api_client.v2.model.rum_retention_filters_response import RumRetentionFiltersResponse +from datadog_api_client.v2.model.rum_retention_quota_adaptive_config import RumRetentionQuotaAdaptiveConfig +from datadog_api_client.v2.model.rum_retention_quota_config_attributes import RumRetentionQuotaConfigAttributes +from datadog_api_client.v2.model.rum_retention_quota_config_data import RumRetentionQuotaConfigData +from datadog_api_client.v2.model.rum_retention_quota_config_response import RumRetentionQuotaConfigResponse +from datadog_api_client.v2.model.rum_retention_quota_config_type import RumRetentionQuotaConfigType +from datadog_api_client.v2.model.rum_retention_quota_config_update_attributes import ( + RumRetentionQuotaConfigUpdateAttributes, +) +from datadog_api_client.v2.model.rum_retention_quota_config_update_data import RumRetentionQuotaConfigUpdateData +from datadog_api_client.v2.model.rum_retention_quota_config_update_request import RumRetentionQuotaConfigUpdateRequest +from datadog_api_client.v2.model.rum_retention_quota_custom_config import RumRetentionQuotaCustomConfig +from datadog_api_client.v2.model.rum_retention_quota_mode import RumRetentionQuotaMode +from datadog_api_client.v2.model.rum_retention_quota_reached_action import RumRetentionQuotaReachedAction +from datadog_api_client.v2.model.rum_retention_quota_scope_type import RumRetentionQuotaScopeType +from datadog_api_client.v2.model.rum_retention_quota_window_type import RumRetentionQuotaWindowType from datadog_api_client.v2.model.rum_sdk_config_attributes import RumSdkConfigAttributes from datadog_api_client.v2.model.rum_sdk_config_data import RumSdkConfigData from datadog_api_client.v2.model.rum_sdk_config_dynamic_option import RumSdkConfigDynamicOption @@ -16137,6 +16152,19 @@ "RumRetentionFiltersOrderRequest", "RumRetentionFiltersOrderResponse", "RumRetentionFiltersResponse", + "RumRetentionQuotaAdaptiveConfig", + "RumRetentionQuotaConfigAttributes", + "RumRetentionQuotaConfigData", + "RumRetentionQuotaConfigResponse", + "RumRetentionQuotaConfigType", + "RumRetentionQuotaConfigUpdateAttributes", + "RumRetentionQuotaConfigUpdateData", + "RumRetentionQuotaConfigUpdateRequest", + "RumRetentionQuotaCustomConfig", + "RumRetentionQuotaMode", + "RumRetentionQuotaReachedAction", + "RumRetentionQuotaScopeType", + "RumRetentionQuotaWindowType", "RumSdkConfigAttributes", "RumSdkConfigData", "RumSdkConfigDynamicOption", diff --git a/tests/v2/features/rum_retention_quota.feature b/tests/v2/features/rum_retention_quota.feature new file mode 100644 index 0000000000..527a1597d4 --- /dev/null +++ b/tests/v2/features/rum_retention_quota.feature @@ -0,0 +1,100 @@ +@endpoint(rum-retention-quota) @endpoint(rum-retention-quota-v2) +Feature: RUM Retention Quota + Manage RUM retention quota 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 "RUMRetentionQuota" API + + @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM retention quota config returns "Bad Request" response + Given new "UpsertRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "invalid-scope-id" + 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_quota_config"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM retention quota config returns "Not Found" response + Given new "UpsertRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "{{ unique }}" + 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": "{{ unique }}", "type": "rum_quota_config"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/rum-backend + Scenario: Create or update a RUM retention quota config returns "OK" response + Given new "UpsertRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "ced16651-97b6-4e67-8590-8caec3af0695" + 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": "ced16651-97b6-4e67-8590-8caec3af0695", "type": "rum_quota_config"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/rum-backend + Scenario: Delete a RUM retention quota configuration returns "Bad Request" response + Given new "DeleteRumQuotaConfig" 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 + + @skip @team:DataDog/rum-backend + Scenario: Delete a RUM retention quota configuration returns "No Content" response + Given new "DeleteRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "ced16651-97b6-4e67-8590-8caec3af0695" + When the request is sent + Then the response status is 204 No Content + + @skip @team:DataDog/rum-backend + Scenario: Delete a RUM retention quota configuration returns "Not Found" response + Given new "DeleteRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "{{ unique }}" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/rum-backend + Scenario: Delete a RUM retention quota configuration returns "Not Found" response for an invalid scope_id + Given new "DeleteRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "invalid-scope-id" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/rum-backend + Scenario: Get a RUM retention quota configuration returns "Bad Request" response + Given new "GetRumQuotaConfig" 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 + + @skip @team:DataDog/rum-backend + Scenario: Get a RUM retention quota configuration returns "Not Found" response + Given new "GetRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "1d4b9c34-7ac4-423a-91cf-9902d926e9b3" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/rum-backend + Scenario: Get a RUM retention quota configuration returns "Not Found" response for an invalid scope_id + Given new "GetRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "invalid-scope-id" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/rum-backend + Scenario: Get a RUM retention quota configuration returns "OK" response + Given new "GetRumQuotaConfig" request + And request contains "scope_type" parameter with value "application" + And request contains "scope_id" parameter with value "ced16651-97b6-4e67-8590-8caec3af0695" + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 870f4e34a5..9d8e566f9e 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -7086,6 +7086,24 @@ "type": "idempotent" } }, + "DeleteRumQuotaConfig": { + "tag": "RUM Retention Quota", + "undo": { + "type": "idempotent" + } + }, + "GetRumQuotaConfig": { + "tag": "RUM Retention Quota", + "undo": { + "type": "safe" + } + }, + "UpsertRumQuotaConfig": { + "tag": "RUM Retention Quota", + "undo": { + "type": "idempotent" + } + }, "ListRUMEvents": { "tag": "RUM", "undo": {