diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 51127c3aea..51829339a9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1909,6 +1909,14 @@ components: required: true schema: type: string + VercelConfigurationID: + description: The Vercel configuration ID. + example: icfg_abc123 + in: path + name: configuration_id + required: true + schema: + type: string ViewIDPathParameter: description: The UUID of the case view. example: a1b2c3d4-e5f6-7890-abcd-ef1234567890 @@ -106727,6 +106735,168 @@ components: required: - value type: object + VercelApiKey: + description: Datadog API key reference used by the Vercel integration to send telemetry. + properties: + id: + description: ID of the Datadog API key used by the Vercel integration. + example: 00000000-0000-0000-0000-000000000001 + type: string + value: + description: Value of the Datadog API key. Returned as an empty string in read responses. + example: "" + type: string + required: + - id + - value + type: object + VercelConfigAttributes: + description: Attributes of the Datadog Vercel integration configuration. + properties: + apiKey: + $ref: "#/components/schemas/VercelApiKey" + logsConfig: + $ref: "#/components/schemas/VercelLogsConfig" + traceConfig: + $ref: "#/components/schemas/VercelTraceConfig" + required: + - apiKey + - logsConfig + - traceConfig + type: object + VercelConfigDataResponse: + description: Vercel configuration data returned by the API. + properties: + attributes: + $ref: "#/components/schemas/VercelConfigAttributes" + id: + description: Vercel configuration ID. + example: icfg_abc123 + type: string + type: + $ref: "#/components/schemas/VercelConfigDataResponseType" + required: + - id + - type + - attributes + type: object + VercelConfigDataResponseType: + default: vercelConfiguration + description: Type identifier for a Vercel configuration resource. + enum: + - vercelConfiguration + example: vercelConfiguration + type: string + x-enum-varnames: + - VERCEL_CONFIGURATION + VercelConfigResponse: + description: Response containing the Datadog Vercel integration configuration. + properties: + data: + $ref: "#/components/schemas/VercelConfigDataResponse" + required: + - data + type: object + VercelEnvironment: + description: Vercel deployment environment. + enum: + - production + - preview + example: production + type: string + x-enum-varnames: + - PRODUCTION + - PREVIEW + VercelLogSource: + description: Source of logs that Vercel forwards to Datadog. + enum: + - static + - lambda + - edge + - build + - external + - firewall + example: lambda + type: string + x-enum-varnames: + - STATIC + - LAMBDA + - EDGE + - BUILD + - EXTERNAL + - FIREWALL + VercelLogsConfig: + description: Logs forwarding configuration for the Vercel integration. + properties: + enabled: + description: Whether logs forwarding is enabled. + example: true + type: boolean + environments: + description: List of Vercel deployment environments to forward telemetry from. + example: + - production + items: + $ref: "#/components/schemas/VercelEnvironment" + type: array + logSources: + description: List of Vercel log sources to forward to Datadog. + example: + - lambda + items: + $ref: "#/components/schemas/VercelLogSource" + type: array + samplingPercentage: + description: Percentage of logs to forward to Datadog, between 0 and 100. + example: 100 + format: int32 + maximum: 100 + minimum: 0 + type: integer + required: + - enabled + - samplingPercentage + - logSources + - environments + type: object + VercelTokenCreateRequest: + description: Request to exchange a Vercel marketplace authorization code for a Datadog-managed access token. + properties: + authGrantCode: + description: OAuth authorization code received from the Vercel marketplace flow. + example: code + type: string + vercelConfigurationId: + description: Vercel configuration identifier returned by the marketplace flow. + example: icfg_abc123 + type: string + required: + - authGrantCode + - vercelConfigurationId + type: object + VercelTraceConfig: + description: Tracing configuration for the Vercel integration. + properties: + enabled: + description: Whether tracing is enabled. + example: true + type: boolean + isDeprecatedOtel: + description: Whether the configuration uses the deprecated OpenTelemetry tracing setup. + example: false + type: boolean + samplingPercentage: + description: Percentage of traces to forward to Datadog, between 0 and 100. + example: 100 + format: int32 + maximum: 100 + minimum: 0 + type: integer + required: + - enabled + - samplingPercentage + - isDeprecatedOtel + type: object Version: description: Version of the notification rule. It is updated when the rule is modified. example: 1 @@ -191561,6 +191731,154 @@ paths: "x-permission": operator: OPEN permissions: [] + /api/v2/vercel/config/{configuration_id}: + get: + description: Retrieve the Datadog Vercel integration configuration for a given Vercel configuration. The response contains the API key reference, logs forwarding settings, and tracing settings stored in Datadog for this configuration. + operationId: GetVercelConfig + parameters: + - $ref: "#/components/parameters/VercelConfigurationID" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + apiKey: + id: 00000000-0000-0000-0000-000000000001 + value: "" + logsConfig: + enabled: true + environments: + - production + logSources: + - lambda + - edge + samplingPercentage: 100 + traceConfig: + enabled: true + isDeprecatedOtel: false + samplingPercentage: 100 + id: icfg_abc123 + type: vercelConfiguration + schema: + $ref: "#/components/schemas/VercelConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "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 Vercel configuration + tags: + - Vercel + put: + description: Update the Datadog Vercel integration configuration for a given Vercel configuration. The provided payload replaces the existing API key reference, logs forwarding settings, and tracing settings stored in Datadog for this configuration. + operationId: UpdateVercelConfig + parameters: + - $ref: "#/components/parameters/VercelConfigurationID" + requestBody: + content: + application/json: + examples: + default: + value: + apiKey: + id: 00000000-0000-0000-0000-000000000001 + value: "" + logsConfig: + enabled: true + environments: + - production + logSources: + - lambda + - edge + samplingPercentage: 100 + traceConfig: + enabled: true + isDeprecatedOtel: false + samplingPercentage: 100 + schema: + $ref: "#/components/schemas/VercelConfigAttributes" + required: true + responses: + "200": + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "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: Update Vercel configuration + tags: + - Vercel + /api/v2/vercel/token: + post: + description: Exchange a Vercel marketplace authorization code for an access token and store it in Datadog so that the integration can call Vercel APIs on behalf of the customer. This endpoint is invoked once when a customer installs the Datadog integration from the Vercel marketplace. + operationId: CreateVercelToken + requestBody: + content: + application/json: + examples: + default: + value: + authGrantCode: "code" + vercelConfigurationId: "icfg_abc123" + schema: + $ref: "#/components/schemas/VercelTokenCreateRequest" + required: true + responses: + "200": + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create Vercel access token + tags: + - Vercel /api/v2/web-integrations/{integration_name}/accounts: get: description: List accounts for a given web integration. @@ -193556,6 +193874,8 @@ tags: externalDocs: url: https://docs.datadoghq.com/account_management/users name: Users + - description: Configure the Datadog Vercel integration. Endpoints in this section let you exchange a Vercel marketplace authorization code for a Datadog-managed access token and read or update the logs, traces, and API key configuration associated with a Vercel project. + name: Vercel - description: |- Manage web integration accounts programmatically through the Datadog API. See the [Web Integrations page](https://app.datadoghq.com/integrations) for more information. diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 972863d62b..449afa0c21 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -907,6 +907,13 @@ datadog\_api\_client.v2.api.users\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.vercel\_api module +---------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.vercel_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.web\_integrations\_api module --------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 791e481a7b..72dabb2c6d 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -45889,6 +45889,76 @@ datadog\_api\_client.v2.model.variant\_weight\_request module :members: :show-inheritance: +datadog\_api\_client.v2.model.vercel\_api\_key module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_api_key + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_config\_attributes module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_config_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_config\_data\_response module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_config_data_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_config\_data\_response\_type module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_config_data_response_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_config\_response module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_config_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_environment module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_environment + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_log\_source module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_log_source + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_logs\_config module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_logs_config + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_token\_create\_request module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_token_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.vercel\_trace\_config module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.vercel_trace_config + :members: + :show-inheritance: + datadog\_api\_client.v2.model.version\_history\_update module ------------------------------------------------------------- diff --git a/examples/v2/vercel/CreateVercelToken.py b/examples/v2/vercel/CreateVercelToken.py new file mode 100644 index 0000000000..003004d0b2 --- /dev/null +++ b/examples/v2/vercel/CreateVercelToken.py @@ -0,0 +1,17 @@ +""" +Create Vercel access token returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.vercel_api import VercelApi +from datadog_api_client.v2.model.vercel_token_create_request import VercelTokenCreateRequest + +body = VercelTokenCreateRequest( + auth_grant_code="code", + vercel_configuration_id="icfg_abc123", +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = VercelApi(api_client) + api_instance.create_vercel_token(body=body) diff --git a/examples/v2/vercel/GetVercelConfig.py b/examples/v2/vercel/GetVercelConfig.py new file mode 100644 index 0000000000..fc3ed4c608 --- /dev/null +++ b/examples/v2/vercel/GetVercelConfig.py @@ -0,0 +1,15 @@ +""" +Get Vercel configuration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.vercel_api import VercelApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = VercelApi(api_client) + response = api_instance.get_vercel_config( + configuration_id="configuration_id", + ) + + print(response) diff --git a/examples/v2/vercel/UpdateVercelConfig.py b/examples/v2/vercel/UpdateVercelConfig.py new file mode 100644 index 0000000000..b87b49c595 --- /dev/null +++ b/examples/v2/vercel/UpdateVercelConfig.py @@ -0,0 +1,39 @@ +""" +Update Vercel configuration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.vercel_api import VercelApi +from datadog_api_client.v2.model.vercel_api_key import VercelApiKey +from datadog_api_client.v2.model.vercel_config_attributes import VercelConfigAttributes +from datadog_api_client.v2.model.vercel_environment import VercelEnvironment +from datadog_api_client.v2.model.vercel_log_source import VercelLogSource +from datadog_api_client.v2.model.vercel_logs_config import VercelLogsConfig +from datadog_api_client.v2.model.vercel_trace_config import VercelTraceConfig + +body = VercelConfigAttributes( + api_key=VercelApiKey( + id="00000000-0000-0000-0000-000000000001", + value="", + ), + logs_config=VercelLogsConfig( + enabled=True, + environments=[ + VercelEnvironment.PRODUCTION, + ], + log_sources=[ + VercelLogSource.LAMBDA, + ], + sampling_percentage=100, + ), + trace_config=VercelTraceConfig( + enabled=True, + is_deprecated_otel=False, + sampling_percentage=100, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = VercelApi(api_client) + api_instance.update_vercel_config(configuration_id="configuration_id", body=body) diff --git a/src/datadog_api_client/v2/api/vercel_api.py b/src/datadog_api_client/v2/api/vercel_api.py new file mode 100644 index 0000000000..5b5c3bd797 --- /dev/null +++ b/src/datadog_api_client/v2/api/vercel_api.py @@ -0,0 +1,146 @@ +# 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.vercel_config_response import VercelConfigResponse +from datadog_api_client.v2.model.vercel_config_attributes import VercelConfigAttributes +from datadog_api_client.v2.model.vercel_token_create_request import VercelTokenCreateRequest + + +class VercelApi: + """ + Configure the Datadog Vercel integration. Endpoints in this section let you exchange a Vercel marketplace authorization code for a Datadog-managed access token and read or update the logs, traces, and API key configuration associated with a Vercel project. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_vercel_token_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/vercel/token", + "operation_id": "create_vercel_token", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (VercelTokenCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._get_vercel_config_endpoint = _Endpoint( + settings={ + "response_type": (VercelConfigResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/vercel/config/{configuration_id}", + "operation_id": "get_vercel_config", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "configuration_id": { + "required": True, + "openapi_types": (str,), + "attribute": "configuration_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_vercel_config_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/vercel/config/{configuration_id}", + "operation_id": "update_vercel_config", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "configuration_id": { + "required": True, + "openapi_types": (str,), + "attribute": "configuration_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (VercelConfigAttributes,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_vercel_token( + self, + body: VercelTokenCreateRequest, + ) -> None: + """Create Vercel access token. + + Exchange a Vercel marketplace authorization code for an access token and store it in Datadog so that the integration can call Vercel APIs on behalf of the customer. This endpoint is invoked once when a customer installs the Datadog integration from the Vercel marketplace. + + :type body: VercelTokenCreateRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_vercel_token_endpoint.call_with_http_info(**kwargs) + + def get_vercel_config( + self, + configuration_id: str, + ) -> VercelConfigResponse: + """Get Vercel configuration. + + Retrieve the Datadog Vercel integration configuration for a given Vercel configuration. The response contains the API key reference, logs forwarding settings, and tracing settings stored in Datadog for this configuration. + + :param configuration_id: The Vercel configuration ID. + :type configuration_id: str + :rtype: VercelConfigResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["configuration_id"] = configuration_id + + return self._get_vercel_config_endpoint.call_with_http_info(**kwargs) + + def update_vercel_config( + self, + configuration_id: str, + body: VercelConfigAttributes, + ) -> None: + """Update Vercel configuration. + + Update the Datadog Vercel integration configuration for a given Vercel configuration. The provided payload replaces the existing API key reference, logs forwarding settings, and tracing settings stored in Datadog for this configuration. + + :param configuration_id: The Vercel configuration ID. + :type configuration_id: str + :type body: VercelConfigAttributes + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["configuration_id"] = configuration_id + + kwargs["body"] = body + + return self._update_vercel_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 f37e2eebe2..fea9f98866 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -127,6 +127,7 @@ from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi from datadog_api_client.v2.api.users_api import UsersApi +from datadog_api_client.v2.api.vercel_api import VercelApi from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi from datadog_api_client.v2.api.webhooks_integration_api import WebhooksIntegrationApi from datadog_api_client.v2.api.widgets_api import WidgetsApi @@ -263,6 +264,7 @@ "TestOptimizationApi", "UsageMeteringApi", "UsersApi", + "VercelApi", "WebIntegrationsApi", "WebhooksIntegrationApi", "WidgetsApi", diff --git a/src/datadog_api_client/v2/model/vercel_api_key.py b/src/datadog_api_client/v2/model/vercel_api_key.py new file mode 100644 index 0000000000..148cccc714 --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_api_key.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 ( + ModelNormal, + cached_property, +) + + +class VercelApiKey(ModelNormal): + @cached_property + def openapi_types(_): + return { + "id": (str,), + "value": (str,), + } + + attribute_map = { + "id": "id", + "value": "value", + } + + def __init__(self_, id: str, value: str, **kwargs): + """ + Datadog API key reference used by the Vercel integration to send telemetry. + + :param id: ID of the Datadog API key used by the Vercel integration. + :type id: str + + :param value: Value of the Datadog API key. Returned as an empty string in read responses. + :type value: str + """ + super().__init__(kwargs) + + self_.id = id + self_.value = value diff --git a/src/datadog_api_client/v2/model/vercel_config_attributes.py b/src/datadog_api_client/v2/model/vercel_config_attributes.py new file mode 100644 index 0000000000..e555a1e1df --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_config_attributes.py @@ -0,0 +1,58 @@ +# 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.vercel_api_key import VercelApiKey + from datadog_api_client.v2.model.vercel_logs_config import VercelLogsConfig + from datadog_api_client.v2.model.vercel_trace_config import VercelTraceConfig + + +class VercelConfigAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.vercel_api_key import VercelApiKey + from datadog_api_client.v2.model.vercel_logs_config import VercelLogsConfig + from datadog_api_client.v2.model.vercel_trace_config import VercelTraceConfig + + return { + "api_key": (VercelApiKey,), + "logs_config": (VercelLogsConfig,), + "trace_config": (VercelTraceConfig,), + } + + attribute_map = { + "api_key": "apiKey", + "logs_config": "logsConfig", + "trace_config": "traceConfig", + } + + def __init__( + self_, api_key: VercelApiKey, logs_config: VercelLogsConfig, trace_config: VercelTraceConfig, **kwargs + ): + """ + Attributes of the Datadog Vercel integration configuration. + + :param api_key: Datadog API key reference used by the Vercel integration to send telemetry. + :type api_key: VercelApiKey + + :param logs_config: Logs forwarding configuration for the Vercel integration. + :type logs_config: VercelLogsConfig + + :param trace_config: Tracing configuration for the Vercel integration. + :type trace_config: VercelTraceConfig + """ + super().__init__(kwargs) + + self_.api_key = api_key + self_.logs_config = logs_config + self_.trace_config = trace_config diff --git a/src/datadog_api_client/v2/model/vercel_config_data_response.py b/src/datadog_api_client/v2/model/vercel_config_data_response.py new file mode 100644 index 0000000000..3c184d4b96 --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_config_data_response.py @@ -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 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.vercel_config_attributes import VercelConfigAttributes + from datadog_api_client.v2.model.vercel_config_data_response_type import VercelConfigDataResponseType + + +class VercelConfigDataResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.vercel_config_attributes import VercelConfigAttributes + from datadog_api_client.v2.model.vercel_config_data_response_type import VercelConfigDataResponseType + + return { + "attributes": (VercelConfigAttributes,), + "id": (str,), + "type": (VercelConfigDataResponseType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: VercelConfigAttributes, id: str, type: VercelConfigDataResponseType, **kwargs): + """ + Vercel configuration data returned by the API. + + :param attributes: Attributes of the Datadog Vercel integration configuration. + :type attributes: VercelConfigAttributes + + :param id: Vercel configuration ID. + :type id: str + + :param type: Type identifier for a Vercel configuration resource. + :type type: VercelConfigDataResponseType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/vercel_config_data_response_type.py b/src/datadog_api_client/v2/model/vercel_config_data_response_type.py new file mode 100644 index 0000000000..2c20112833 --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_config_data_response_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 VercelConfigDataResponseType(ModelSimple): + """ + Type identifier for a Vercel configuration resource. + + :param value: If omitted defaults to "vercelConfiguration". Must be one of ["vercelConfiguration"]. + :type value: str + """ + + allowed_values = { + "vercelConfiguration", + } + VERCEL_CONFIGURATION: ClassVar["VercelConfigDataResponseType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +VercelConfigDataResponseType.VERCEL_CONFIGURATION = VercelConfigDataResponseType("vercelConfiguration") diff --git a/src/datadog_api_client/v2/model/vercel_config_response.py b/src/datadog_api_client/v2/model/vercel_config_response.py new file mode 100644 index 0000000000..31ae096c47 --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_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.vercel_config_data_response import VercelConfigDataResponse + + +class VercelConfigResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.vercel_config_data_response import VercelConfigDataResponse + + return { + "data": (VercelConfigDataResponse,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: VercelConfigDataResponse, **kwargs): + """ + Response containing the Datadog Vercel integration configuration. + + :param data: Vercel configuration data returned by the API. + :type data: VercelConfigDataResponse + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/vercel_environment.py b/src/datadog_api_client/v2/model/vercel_environment.py new file mode 100644 index 0000000000..8d6ce8bf0c --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_environment.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 VercelEnvironment(ModelSimple): + """ + Vercel deployment environment. + + :param value: Must be one of ["production", "preview"]. + :type value: str + """ + + allowed_values = { + "production", + "preview", + } + PRODUCTION: ClassVar["VercelEnvironment"] + PREVIEW: ClassVar["VercelEnvironment"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +VercelEnvironment.PRODUCTION = VercelEnvironment("production") +VercelEnvironment.PREVIEW = VercelEnvironment("preview") diff --git a/src/datadog_api_client/v2/model/vercel_log_source.py b/src/datadog_api_client/v2/model/vercel_log_source.py new file mode 100644 index 0000000000..2e8943dd3a --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_log_source.py @@ -0,0 +1,50 @@ +# 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 VercelLogSource(ModelSimple): + """ + Source of logs that Vercel forwards to Datadog. + + :param value: Must be one of ["static", "lambda", "edge", "build", "external", "firewall"]. + :type value: str + """ + + allowed_values = { + "static", + "lambda", + "edge", + "build", + "external", + "firewall", + } + STATIC: ClassVar["VercelLogSource"] + LAMBDA: ClassVar["VercelLogSource"] + EDGE: ClassVar["VercelLogSource"] + BUILD: ClassVar["VercelLogSource"] + EXTERNAL: ClassVar["VercelLogSource"] + FIREWALL: ClassVar["VercelLogSource"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +VercelLogSource.STATIC = VercelLogSource("static") +VercelLogSource.LAMBDA = VercelLogSource("lambda") +VercelLogSource.EDGE = VercelLogSource("edge") +VercelLogSource.BUILD = VercelLogSource("build") +VercelLogSource.EXTERNAL = VercelLogSource("external") +VercelLogSource.FIREWALL = VercelLogSource("firewall") diff --git a/src/datadog_api_client/v2/model/vercel_logs_config.py b/src/datadog_api_client/v2/model/vercel_logs_config.py new file mode 100644 index 0000000000..4cfc010e90 --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_logs_config.py @@ -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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.vercel_environment import VercelEnvironment + from datadog_api_client.v2.model.vercel_log_source import VercelLogSource + + +class VercelLogsConfig(ModelNormal): + validations = { + "sampling_percentage": { + "inclusive_maximum": 100, + "inclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.vercel_environment import VercelEnvironment + from datadog_api_client.v2.model.vercel_log_source import VercelLogSource + + return { + "enabled": (bool,), + "environments": ([VercelEnvironment],), + "log_sources": ([VercelLogSource],), + "sampling_percentage": (int,), + } + + attribute_map = { + "enabled": "enabled", + "environments": "environments", + "log_sources": "logSources", + "sampling_percentage": "samplingPercentage", + } + + def __init__( + self_, + enabled: bool, + environments: List[VercelEnvironment], + log_sources: List[VercelLogSource], + sampling_percentage: int, + **kwargs, + ): + """ + Logs forwarding configuration for the Vercel integration. + + :param enabled: Whether logs forwarding is enabled. + :type enabled: bool + + :param environments: List of Vercel deployment environments to forward telemetry from. + :type environments: [VercelEnvironment] + + :param log_sources: List of Vercel log sources to forward to Datadog. + :type log_sources: [VercelLogSource] + + :param sampling_percentage: Percentage of logs to forward to Datadog, between 0 and 100. + :type sampling_percentage: int + """ + super().__init__(kwargs) + + self_.enabled = enabled + self_.environments = environments + self_.log_sources = log_sources + self_.sampling_percentage = sampling_percentage diff --git a/src/datadog_api_client/v2/model/vercel_token_create_request.py b/src/datadog_api_client/v2/model/vercel_token_create_request.py new file mode 100644 index 0000000000..612ee47e1b --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_token_create_request.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 ( + ModelNormal, + cached_property, +) + + +class VercelTokenCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "auth_grant_code": (str,), + "vercel_configuration_id": (str,), + } + + attribute_map = { + "auth_grant_code": "authGrantCode", + "vercel_configuration_id": "vercelConfigurationId", + } + + def __init__(self_, auth_grant_code: str, vercel_configuration_id: str, **kwargs): + """ + Request to exchange a Vercel marketplace authorization code for a Datadog-managed access token. + + :param auth_grant_code: OAuth authorization code received from the Vercel marketplace flow. + :type auth_grant_code: str + + :param vercel_configuration_id: Vercel configuration identifier returned by the marketplace flow. + :type vercel_configuration_id: str + """ + super().__init__(kwargs) + + self_.auth_grant_code = auth_grant_code + self_.vercel_configuration_id = vercel_configuration_id diff --git a/src/datadog_api_client/v2/model/vercel_trace_config.py b/src/datadog_api_client/v2/model/vercel_trace_config.py new file mode 100644 index 0000000000..26f06b8a82 --- /dev/null +++ b/src/datadog_api_client/v2/model/vercel_trace_config.py @@ -0,0 +1,52 @@ +# 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 VercelTraceConfig(ModelNormal): + validations = { + "sampling_percentage": { + "inclusive_maximum": 100, + "inclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + return { + "enabled": (bool,), + "is_deprecated_otel": (bool,), + "sampling_percentage": (int,), + } + + attribute_map = { + "enabled": "enabled", + "is_deprecated_otel": "isDeprecatedOtel", + "sampling_percentage": "samplingPercentage", + } + + def __init__(self_, enabled: bool, is_deprecated_otel: bool, sampling_percentage: int, **kwargs): + """ + Tracing configuration for the Vercel integration. + + :param enabled: Whether tracing is enabled. + :type enabled: bool + + :param is_deprecated_otel: Whether the configuration uses the deprecated OpenTelemetry tracing setup. + :type is_deprecated_otel: bool + + :param sampling_percentage: Percentage of traces to forward to Datadog, between 0 and 100. + :type sampling_percentage: int + """ + super().__init__(kwargs) + + self_.enabled = enabled + self_.is_deprecated_otel = is_deprecated_otel + self_.sampling_percentage = sampling_percentage diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 7f93761202..52c222c626 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -9199,6 +9199,16 @@ from datadog_api_client.v2.model.variant import Variant from datadog_api_client.v2.model.variant_weight import VariantWeight from datadog_api_client.v2.model.variant_weight_request import VariantWeightRequest +from datadog_api_client.v2.model.vercel_api_key import VercelApiKey +from datadog_api_client.v2.model.vercel_config_attributes import VercelConfigAttributes +from datadog_api_client.v2.model.vercel_config_data_response import VercelConfigDataResponse +from datadog_api_client.v2.model.vercel_config_data_response_type import VercelConfigDataResponseType +from datadog_api_client.v2.model.vercel_config_response import VercelConfigResponse +from datadog_api_client.v2.model.vercel_environment import VercelEnvironment +from datadog_api_client.v2.model.vercel_log_source import VercelLogSource +from datadog_api_client.v2.model.vercel_logs_config import VercelLogsConfig +from datadog_api_client.v2.model.vercel_token_create_request import VercelTokenCreateRequest +from datadog_api_client.v2.model.vercel_trace_config import VercelTraceConfig from datadog_api_client.v2.model.version_history_update import VersionHistoryUpdate from datadog_api_client.v2.model.version_history_update_type import VersionHistoryUpdateType from datadog_api_client.v2.model.viewership_history_session_array import ViewershipHistorySessionArray @@ -15920,6 +15930,16 @@ "Variant", "VariantWeight", "VariantWeightRequest", + "VercelApiKey", + "VercelConfigAttributes", + "VercelConfigDataResponse", + "VercelConfigDataResponseType", + "VercelConfigResponse", + "VercelEnvironment", + "VercelLogSource", + "VercelLogsConfig", + "VercelTokenCreateRequest", + "VercelTraceConfig", "VersionHistoryUpdate", "VersionHistoryUpdateType", "ViewershipHistorySessionArray", diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 89626bc569..d1cdac2882 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -9305,6 +9305,24 @@ "type": "safe" } }, + "GetVercelConfig": { + "tag": "Vercel", + "undo": { + "type": "safe" + } + }, + "UpdateVercelConfig": { + "tag": "Vercel", + "undo": { + "type": "idempotent" + } + }, + "CreateVercelToken": { + "tag": "Vercel", + "undo": { + "type": "unsafe" + } + }, "ListWebIntegrationAccounts": { "tag": "Web Integrations", "undo": { diff --git a/tests/v2/features/vercel.feature b/tests/v2/features/vercel.feature new file mode 100644 index 0000000000..9a3b33d482 --- /dev/null +++ b/tests/v2/features/vercel.feature @@ -0,0 +1,70 @@ +@endpoint(vercel) @endpoint(vercel-v2) +Feature: Vercel + Configure the Datadog Vercel integration. Endpoints in this section let + you exchange a Vercel marketplace authorization code for a Datadog-managed + access token and read or update the logs, traces, and API key + configuration associated with a Vercel project. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Vercel" API + + @generated @skip @team:DataDog/serverless-onboarding-and-enablement + Scenario: Create Vercel access token returns "Bad Request" response + Given new "CreateVercelToken" request + And body with value {"authGrantCode": "code", "vercelConfigurationId": "icfg_abc123"} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/serverless-onboarding-and-enablement + Scenario: Create Vercel access token returns "OK" response + Given new "CreateVercelToken" request + And body with value {"authGrantCode": "code", "vercelConfigurationId": "icfg_abc123"} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/serverless-onboarding-and-enablement + Scenario: Get Vercel configuration returns "Bad Request" response + Given new "GetVercelConfig" request + And request contains "configuration_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/serverless-onboarding-and-enablement + Scenario: Get Vercel configuration returns "Not Found" response + Given new "GetVercelConfig" request + And request contains "configuration_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/serverless-onboarding-and-enablement + Scenario: Get Vercel configuration returns "OK" response + Given new "GetVercelConfig" request + And request contains "configuration_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/serverless-onboarding-and-enablement + Scenario: Update Vercel configuration returns "Bad Request" response + Given new "UpdateVercelConfig" request + And request contains "configuration_id" parameter from "REPLACE.ME" + And body with value {"apiKey": {"id": "00000000-0000-0000-0000-000000000001", "value": ""}, "logsConfig": {"enabled": true, "environments": ["production"], "logSources": ["lambda"], "samplingPercentage": 100}, "traceConfig": {"enabled": true, "isDeprecatedOtel": false, "samplingPercentage": 100}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/serverless-onboarding-and-enablement + Scenario: Update Vercel configuration returns "Not Found" response + Given new "UpdateVercelConfig" request + And request contains "configuration_id" parameter from "REPLACE.ME" + And body with value {"apiKey": {"id": "00000000-0000-0000-0000-000000000001", "value": ""}, "logsConfig": {"enabled": true, "environments": ["production"], "logSources": ["lambda"], "samplingPercentage": 100}, "traceConfig": {"enabled": true, "isDeprecatedOtel": false, "samplingPercentage": 100}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/serverless-onboarding-and-enablement + Scenario: Update Vercel configuration returns "OK" response + Given new "UpdateVercelConfig" request + And request contains "configuration_id" parameter from "REPLACE.ME" + And body with value {"apiKey": {"id": "00000000-0000-0000-0000-000000000001", "value": ""}, "logsConfig": {"enabled": true, "environments": ["production"], "logSources": ["lambda"], "samplingPercentage": 100}, "traceConfig": {"enabled": true, "isDeprecatedOtel": false, "samplingPercentage": 100}} + When the request is sent + Then the response status is 200 OK