diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f11972d91d..1f0c4adc28 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1265,6 +1265,62 @@ components: $ref: '#/components/schemas/JSONAPIErrorResponse' description: The server cannot process the request because it contains invalid data. + WebIntegrationAccountSchemaBadRequestResponse: + content: + application/json: + examples: + invalid_integration_name: + summary: Invalid integration name format + value: + errors: + - detail: Invalid integration name format + status: '400' + title: Bad Request + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + WebIntegrationAccountSchemaForbiddenResponse: + content: + application/json: + examples: + integration_not_allowed: + summary: Integration not allowed + value: + errors: + - detail: The API is currently disabled for `twilio` integration + status: '403' + title: Integration Not Allowed + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + WebIntegrationAccountSchemaNotFoundResponse: + content: + application/json: + examples: + schema_not_found: + summary: Schema not found for integration + value: + errors: + - detail: 'Schema not found for integration: twilio' + status: '404' + title: Not Found + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + WebIntegrationAccountSchemaTooManyRequestsResponse: + content: + application/json: + examples: + rate_limit_exceeded: + summary: Rate limit exceeded + value: + errors: + - detail: Rate limit exceeded. Please retry after 60 seconds. + status: '429' + title: Too Many Requests + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests schemas: APIErrorResponse: description: API error response. @@ -60359,6 +60415,240 @@ components: - X_CONTENT_TYPE_HEADER_MISSING - X_PATH_INJECTION - XSS + WebIntegrationAccountAttributes: + description: Attributes for a web integration account. + properties: + name: + description: The name of the account. + example: My Production Account + type: string + settings: + additionalProperties: {} + description: 'Integration-specific settings for the account. The structure + and required fields vary by integration type. + + Use the schema endpoint to retrieve the specific requirements for each + integration.' + example: + account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + alerts: false + api_key: SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + call_summaries: true + ccm_enabled: true + censor_logs: true + events: true + messages: true + type: object + required: + - name + - settings + type: object + WebIntegrationAccountCreateRequest: + description: Payload for creating a web integration account. + properties: + data: + $ref: '#/components/schemas/WebIntegrationAccountCreateRequestData' + required: + - data + type: object + WebIntegrationAccountCreateRequestAttributes: + description: Attributes for creating a web integration account. + properties: + name: + description: The name of the account. + example: My Production Account + type: string + secrets: + additionalProperties: {} + description: 'Sensitive credentials for the account. The structure and required + fields vary by integration type. + + These values are write-only and never returned in responses. Use the schema + endpoint to determine + + which secret fields are required for your specific integration.' + example: + api_key_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + type: object + settings: + additionalProperties: {} + description: 'Integration-specific settings for the account. The structure + and required fields vary by integration type. + + Use the schema endpoint (GET /api/v2/web-integrations/{integration_name}/accounts/schema) + to retrieve + + the specific requirements for your integration before creating an account.' + example: + account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + alerts: true + api_key: SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + call_summaries: true + ccm_enabled: true + censor_logs: true + events: true + messages: true + type: object + required: + - name + - settings + - secrets + type: object + WebIntegrationAccountCreateRequestData: + description: Data object for creating a web integration account. + properties: + attributes: + $ref: '#/components/schemas/WebIntegrationAccountCreateRequestAttributes' + type: + $ref: '#/components/schemas/WebIntegrationAccountType' + required: + - type + - attributes + type: object + WebIntegrationAccountResponse: + description: Response containing a single web integration account. + properties: + data: + $ref: '#/components/schemas/WebIntegrationAccountResponseData' + integration_name: + description: The name of the integration. + example: twilio + type: string + type: object + WebIntegrationAccountResponseData: + description: Data object for a web integration account response. + properties: + attributes: + $ref: '#/components/schemas/WebIntegrationAccountAttributes' + id: + description: The unique identifier for the account. + example: abc123def456 + type: string + type: + $ref: '#/components/schemas/WebIntegrationAccountType' + required: + - id + - type + - attributes + type: object + WebIntegrationAccountSchemaResponse: + description: 'Response containing the JSON schema for an integration''s account + configuration. + + This schema defines the required and optional fields for both settings and + secrets, + + including field types, validation rules, and descriptions. + + + The response is a standard JSON Schema (draft-07) document describing the + account + + configuration structure. Since this is a dynamic JSON Schema, the exact properties + + will vary by integration.' + example: + $schema: http://json-schema.org/draft-07/schema# + properties: + secrets: + $ref: '#/components/schemas/WebIntegrationAccountSchemaResponseExampleSecrets' + settings: + $ref: '#/components/schemas/WebIntegrationAccountSchemaResponseExampleSettings' + required: + - settings + - secrets + type: object + type: object + WebIntegrationAccountSchemaResponseExampleSecrets: + additionalProperties: false + properties: + api_secret: + description: API secret for authentication. + minLength: 1 + type: string + type: object + WebIntegrationAccountSchemaResponseExampleSettings: + additionalProperties: false + properties: + api_key: + description: API Key for authentication. + minLength: 1 + type: string + type: object + WebIntegrationAccountType: + default: Account + description: The JSON:API type for web integration accounts. + enum: + - Account + example: Account + type: string + x-enum-varnames: + - ACCOUNT + WebIntegrationAccountUpdateRequest: + description: Payload for updating a web integration account. + properties: + data: + $ref: '#/components/schemas/WebIntegrationAccountUpdateRequestData' + required: + - data + type: object + WebIntegrationAccountUpdateRequestAttributes: + description: 'Attributes for updating a web integration account. All fields + are optional - + + only provide the fields you want to update. Partial updates are supported, + + allowing you to modify specific settings or secrets without providing all + fields.' + properties: + name: + description: The name of the account. + example: My Production Account (Updated) + type: string + secrets: + additionalProperties: {} + description: 'Sensitive credentials to update. Only the secrets provided + will be updated. + + These values are write-only and never returned in responses.' + example: + api_key_token: new_secret_token_value + type: object + settings: + additionalProperties: {} + description: 'Integration-specific settings to update. Only the fields provided + will be updated. + + The structure varies by integration type. Refer to the integration''s + schema for available fields.' + example: + ccm_enabled: true + events: true + messages: false + type: object + type: object + WebIntegrationAccountUpdateRequestData: + description: Data object for updating a web integration account. + properties: + attributes: + $ref: '#/components/schemas/WebIntegrationAccountUpdateRequestAttributes' + type: + $ref: '#/components/schemas/WebIntegrationAccountType' + required: + - type + type: object + WebIntegrationAccountsResponse: + description: Response containing a list of web integration accounts. + properties: + data: + items: + $ref: '#/components/schemas/WebIntegrationAccountResponseData' + type: array + integration_name: + description: The name of the integration. + example: twilio + type: string + type: object Weekday: description: A day of the week. enum: @@ -91826,6 +92116,283 @@ paths: operator: OR permissions: - teams_read + /api/v2/web-integrations/{integration_name}/accounts: + get: + description: 'Retrieve all configured accounts for a specific integration within + your organization. + + Each account represents a separate connection configuration to the external + service.' + operationId: ListWebIntegrationAccounts + parameters: + - description: The name of the integration. + example: twilio + in: path + name: integration_name + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WebIntegrationAccountsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List integration accounts + tags: + - Web Integrations + x-permission: + operator: OR + permissions: + - integrations_read + post: + description: 'Create a new account for a specific integration. The account configuration + must conform + + to the schema defined for the integration, which can be retrieved using the + schema endpoint. + + + Note: Returns 403 Forbidden if the integration is not enabled for API access + or if the user + + lacks the required permissions to manage integrations.' + operationId: CreateWebIntegrationAccount + parameters: + - description: The name of the integration. + example: twilio + in: path + name: integration_name + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WebIntegrationAccountCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/WebIntegrationAccountResponse' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '422': + $ref: '#/components/responses/UnprocessableEntityResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create integration account + tags: + - Web Integrations + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - manage_integrations + /api/v2/web-integrations/{integration_name}/accounts/schema: + get: + description: 'Get the JSON schema that defines the structure and validation + rules for account configuration + + of a specific integration. This schema describes the required and optional + fields for both + + settings and secrets when creating or updating an account.' + operationId: GetWebIntegrationAccountSchema + parameters: + - description: The name of the integration. + example: twilio + in: path + name: integration_name + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WebIntegrationAccountSchemaResponse' + description: OK + '400': + $ref: '#/components/responses/WebIntegrationAccountSchemaBadRequestResponse' + '403': + $ref: '#/components/responses/WebIntegrationAccountSchemaForbiddenResponse' + '404': + $ref: '#/components/responses/WebIntegrationAccountSchemaNotFoundResponse' + '429': + $ref: '#/components/responses/WebIntegrationAccountSchemaTooManyRequestsResponse' + summary: Get account schema for an integration + tags: + - Web Integrations + x-permission: + operator: OR + permissions: + - integrations_read + /api/v2/web-integrations/{integration_name}/accounts/{account_id}: + delete: + description: 'Delete a specific account by its ID for a given integration. This + will remove the + + account configuration and stop any data collection associated with it. + + + Note: Returns 403 Forbidden if the integration is not enabled for API access + or if the user + + lacks the required permissions to manage this specific account.' + operationId: DeleteWebIntegrationAccount + parameters: + - description: The name of the integration. + example: twilio + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the account. + example: abc123def456 + in: path + name: account_id + required: true + schema: + type: string + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete integration account + tags: + - Web Integrations + x-permission: + operator: OR + permissions: + - manage_integrations + get: + description: 'Retrieve a specific account by its ID for a given integration. + The response includes + + the account name and settings, but excludes sensitive secret values.' + operationId: GetWebIntegrationAccount + parameters: + - description: The name of the integration. + example: twilio + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the account. + example: abc123def456 + in: path + name: account_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WebIntegrationAccountResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get integration account + tags: + - Web Integrations + x-permission: + operator: OR + permissions: + - integrations_read + patch: + description: 'Update an existing account for a specific integration. You can + update the name, settings, + + and/or secrets. Only the fields provided in the request will be updated. + + + Note: Returns 403 Forbidden if the integration is not enabled for API access + or if the user + + lacks the required permissions to manage this specific account.' + operationId: UpdateWebIntegrationAccount + parameters: + - description: The name of the integration. + example: twilio + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the account. + example: abc123def456 + in: path + name: account_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WebIntegrationAccountUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WebIntegrationAccountResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '422': + $ref: '#/components/responses/UnprocessableEntityResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update integration account + tags: + - Web Integrations + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - manage_integrations /api/v2/workflows: post: description: Create a new workflow, returning the workflow ID. This API requires @@ -92785,6 +93352,14 @@ tags: externalDocs: url: https://docs.datadoghq.com/account_management/users name: Users +- description: "Configure and manage third-party web integrations with Datadog. This + API provides a unified\ninterface for managing integration accounts across various + external services.\n\nEach integration has its own unique schema that defines + the required settings and secrets.\nBefore creating or updating an account, use + the schema endpoint to retrieve the specific\nrequirements, field types, validation + rules, and available configuration options for your\nintegration.\n\nSupported + Integrations:\n - twilio\n - snowflake-web\n - databricks" + name: Web Integrations - description: Datadog Workflow Automation allows you to automate your end-to-end processes by connecting Datadog with the rest of your tech stack. Build workflows to auto-remediate your alerts, streamline your incident and security processes, diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index ef7c7e17c8..f24ab766e9 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -599,6 +599,13 @@ datadog\_api\_client.v2.api.users\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.web\_integrations\_api module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.web_integrations_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.workflow\_automation\_api module ------------------------------------------------------------ diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 690a0397e6..684721ce2c 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -26604,6 +26604,83 @@ datadog\_api\_client.v2.model.vulnerability\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.web\_integration\_account\_attributes module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_create\_request module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_create\_request\_attributes module +------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_create_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_create\_request\_data module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_create_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_response module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.web_integration_account_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_response\_data module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.web_integration_account_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_type module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_update\_request module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_update\_request\_attributes module +------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_update_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_update\_request\_data module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_update_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_accounts\_response module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_accounts_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.weekday module -------------------------------------------- diff --git a/examples/v2/web-integrations/CreateWebIntegrationAccount.py b/examples/v2/web-integrations/CreateWebIntegrationAccount.py new file mode 100644 index 0000000000..3c8d5253bd --- /dev/null +++ b/examples/v2/web-integrations/CreateWebIntegrationAccount.py @@ -0,0 +1,43 @@ +""" +Create integration account returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi +from datadog_api_client.v2.model.web_integration_account_create_request import WebIntegrationAccountCreateRequest +from datadog_api_client.v2.model.web_integration_account_create_request_attributes import ( + WebIntegrationAccountCreateRequestAttributes, +) +from datadog_api_client.v2.model.web_integration_account_create_request_data import ( + WebIntegrationAccountCreateRequestData, +) +from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + +body = WebIntegrationAccountCreateRequest( + data=WebIntegrationAccountCreateRequestData( + type=WebIntegrationAccountType.ACCOUNT, + attributes=WebIntegrationAccountCreateRequestAttributes( + name="Example-Web-Integration", + settings=dict( + [ + ("api_key", "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), + ("account_sid", "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), + ("events", "True"), + ("messages", "True"), + ("alerts", "True"), + ("call_summaries", "True"), + ("ccm_enabled", "True"), + ("censor_logs", "True"), + ] + ), + secrets=dict([("api_key_token", "test_secret_token")]), + ), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.create_web_integration_account(integration_name="twilio", body=body) + + print(response) diff --git a/examples/v2/web-integrations/DeleteWebIntegrationAccount.py b/examples/v2/web-integrations/DeleteWebIntegrationAccount.py new file mode 100644 index 0000000000..41289a81be --- /dev/null +++ b/examples/v2/web-integrations/DeleteWebIntegrationAccount.py @@ -0,0 +1,18 @@ +""" +Delete integration account returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi + +# there is a valid "web_integration_account" in the system +WEB_INTEGRATION_ACCOUNT_DATA_ID = environ["WEB_INTEGRATION_ACCOUNT_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + api_instance.delete_web_integration_account( + integration_name="twilio", + account_id=WEB_INTEGRATION_ACCOUNT_DATA_ID, + ) diff --git a/examples/v2/web-integrations/GetWebIntegrationAccount.py b/examples/v2/web-integrations/GetWebIntegrationAccount.py new file mode 100644 index 0000000000..faa3e0de34 --- /dev/null +++ b/examples/v2/web-integrations/GetWebIntegrationAccount.py @@ -0,0 +1,20 @@ +""" +Get integration account returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi + +# there is a valid "web_integration_account" in the system +WEB_INTEGRATION_ACCOUNT_DATA_ID = environ["WEB_INTEGRATION_ACCOUNT_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.get_web_integration_account( + integration_name="twilio", + account_id=WEB_INTEGRATION_ACCOUNT_DATA_ID, + ) + + print(response) diff --git a/examples/v2/web-integrations/GetWebIntegrationAccountSchema.py b/examples/v2/web-integrations/GetWebIntegrationAccountSchema.py new file mode 100644 index 0000000000..ab28ab4578 --- /dev/null +++ b/examples/v2/web-integrations/GetWebIntegrationAccountSchema.py @@ -0,0 +1,15 @@ +""" +Get account schema for an integration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.get_web_integration_account_schema( + integration_name="twilio", + ) + + print(response) diff --git a/examples/v2/web-integrations/ListWebIntegrationAccounts.py b/examples/v2/web-integrations/ListWebIntegrationAccounts.py new file mode 100644 index 0000000000..8731b6d578 --- /dev/null +++ b/examples/v2/web-integrations/ListWebIntegrationAccounts.py @@ -0,0 +1,15 @@ +""" +List integration accounts returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.list_web_integration_accounts( + integration_name="twilio", + ) + + print(response) diff --git a/examples/v2/web-integrations/UpdateWebIntegrationAccount.py b/examples/v2/web-integrations/UpdateWebIntegrationAccount.py new file mode 100644 index 0000000000..08fa86069c --- /dev/null +++ b/examples/v2/web-integrations/UpdateWebIntegrationAccount.py @@ -0,0 +1,37 @@ +""" +Update integration account returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi +from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType +from datadog_api_client.v2.model.web_integration_account_update_request import WebIntegrationAccountUpdateRequest +from datadog_api_client.v2.model.web_integration_account_update_request_attributes import ( + WebIntegrationAccountUpdateRequestAttributes, +) +from datadog_api_client.v2.model.web_integration_account_update_request_data import ( + WebIntegrationAccountUpdateRequestData, +) + +# there is a valid "web_integration_account" in the system +WEB_INTEGRATION_ACCOUNT_DATA_ID = environ["WEB_INTEGRATION_ACCOUNT_DATA_ID"] + +body = WebIntegrationAccountUpdateRequest( + data=WebIntegrationAccountUpdateRequestData( + type=WebIntegrationAccountType.ACCOUNT, + attributes=WebIntegrationAccountUpdateRequestAttributes( + name="Example-Web-Integration-updated", + settings=dict([("events", "False"), ("messages", "False"), ("ccm_enabled", "False")]), + ), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.update_web_integration_account( + integration_name="twilio", account_id=WEB_INTEGRATION_ACCOUNT_DATA_ID, body=body + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/web_integrations_api.py b/src/datadog_api_client/v2/api/web_integrations_api.py new file mode 100644 index 0000000000..772b6c81c3 --- /dev/null +++ b/src/datadog_api_client/v2/api/web_integrations_api.py @@ -0,0 +1,340 @@ +# 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.web_integration_accounts_response import WebIntegrationAccountsResponse +from datadog_api_client.v2.model.web_integration_account_response import WebIntegrationAccountResponse +from datadog_api_client.v2.model.web_integration_account_create_request import WebIntegrationAccountCreateRequest +from datadog_api_client.v2.model.web_integration_account_schema_response import WebIntegrationAccountSchemaResponse +from datadog_api_client.v2.model.web_integration_account_update_request import WebIntegrationAccountUpdateRequest + + +class WebIntegrationsApi: + """ + Configure and manage third-party web integrations with Datadog. This API provides a unified + interface for managing integration accounts across various external services. + + Each integration has its own unique schema that defines the required settings and secrets. + Before creating or updating an account, use the schema endpoint to retrieve the specific + requirements, field types, validation rules, and available configuration options for your + integration. + + Supported Integrations: + + * twilio + * snowflake-web + * databricks + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_web_integration_account_endpoint = _Endpoint( + settings={ + "response_type": (WebIntegrationAccountResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/web-integrations/{integration_name}/accounts", + "operation_id": "create_web_integration_account", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "integration_name": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_name", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (WebIntegrationAccountCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_web_integration_account_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/web-integrations/{integration_name}/accounts/{account_id}", + "operation_id": "delete_web_integration_account", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "integration_name": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_name", + "location": "path", + }, + "account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "account_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_web_integration_account_endpoint = _Endpoint( + settings={ + "response_type": (WebIntegrationAccountResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/web-integrations/{integration_name}/accounts/{account_id}", + "operation_id": "get_web_integration_account", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "integration_name": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_name", + "location": "path", + }, + "account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "account_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_web_integration_account_schema_endpoint = _Endpoint( + settings={ + "response_type": (WebIntegrationAccountSchemaResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/web-integrations/{integration_name}/accounts/schema", + "operation_id": "get_web_integration_account_schema", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "integration_name": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_web_integration_accounts_endpoint = _Endpoint( + settings={ + "response_type": (WebIntegrationAccountsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/web-integrations/{integration_name}/accounts", + "operation_id": "list_web_integration_accounts", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "integration_name": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_web_integration_account_endpoint = _Endpoint( + settings={ + "response_type": (WebIntegrationAccountResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/web-integrations/{integration_name}/accounts/{account_id}", + "operation_id": "update_web_integration_account", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "integration_name": { + "required": True, + "openapi_types": (str,), + "attribute": "integration_name", + "location": "path", + }, + "account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "account_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (WebIntegrationAccountUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_web_integration_account( + self, + integration_name: str, + body: WebIntegrationAccountCreateRequest, + ) -> WebIntegrationAccountResponse: + """Create integration account. + + Create a new account for a specific integration. The account configuration must conform + to the schema defined for the integration, which can be retrieved using the schema endpoint. + + Note: Returns 403 Forbidden if the integration is not enabled for API access or if the user + lacks the required permissions to manage integrations. + + :param integration_name: The name of the integration. + :type integration_name: str + :type body: WebIntegrationAccountCreateRequest + :rtype: WebIntegrationAccountResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_name"] = integration_name + + kwargs["body"] = body + + return self._create_web_integration_account_endpoint.call_with_http_info(**kwargs) + + def delete_web_integration_account( + self, + integration_name: str, + account_id: str, + ) -> None: + """Delete integration account. + + Delete a specific account by its ID for a given integration. This will remove the + account configuration and stop any data collection associated with it. + + Note: Returns 403 Forbidden if the integration is not enabled for API access or if the user + lacks the required permissions to manage this specific account. + + :param integration_name: The name of the integration. + :type integration_name: str + :param account_id: The unique identifier of the account. + :type account_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_name"] = integration_name + + kwargs["account_id"] = account_id + + return self._delete_web_integration_account_endpoint.call_with_http_info(**kwargs) + + def get_web_integration_account( + self, + integration_name: str, + account_id: str, + ) -> WebIntegrationAccountResponse: + """Get integration account. + + Retrieve a specific account by its ID for a given integration. The response includes + the account name and settings, but excludes sensitive secret values. + + :param integration_name: The name of the integration. + :type integration_name: str + :param account_id: The unique identifier of the account. + :type account_id: str + :rtype: WebIntegrationAccountResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_name"] = integration_name + + kwargs["account_id"] = account_id + + return self._get_web_integration_account_endpoint.call_with_http_info(**kwargs) + + def get_web_integration_account_schema( + self, + integration_name: str, + ) -> WebIntegrationAccountSchemaResponse: + """Get account schema for an integration. + + Get the JSON schema that defines the structure and validation rules for account configuration + of a specific integration. This schema describes the required and optional fields for both + settings and secrets when creating or updating an account. + + :param integration_name: The name of the integration. + :type integration_name: str + :rtype: WebIntegrationAccountSchemaResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_name"] = integration_name + + return self._get_web_integration_account_schema_endpoint.call_with_http_info(**kwargs) + + def list_web_integration_accounts( + self, + integration_name: str, + ) -> WebIntegrationAccountsResponse: + """List integration accounts. + + Retrieve all configured accounts for a specific integration within your organization. + Each account represents a separate connection configuration to the external service. + + :param integration_name: The name of the integration. + :type integration_name: str + :rtype: WebIntegrationAccountsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_name"] = integration_name + + return self._list_web_integration_accounts_endpoint.call_with_http_info(**kwargs) + + def update_web_integration_account( + self, + integration_name: str, + account_id: str, + body: WebIntegrationAccountUpdateRequest, + ) -> WebIntegrationAccountResponse: + """Update integration account. + + Update an existing account for a specific integration. You can update the name, settings, + and/or secrets. Only the fields provided in the request will be updated. + + Note: Returns 403 Forbidden if the integration is not enabled for API access or if the user + lacks the required permissions to manage this specific account. + + :param integration_name: The name of the integration. + :type integration_name: str + :param account_id: The unique identifier of the account. + :type account_id: str + :type body: WebIntegrationAccountUpdateRequest + :rtype: WebIntegrationAccountResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["integration_name"] = integration_name + + kwargs["account_id"] = account_id + + kwargs["body"] = body + + return self._update_web_integration_account_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 35ab810c4a..5559fa8a1b 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -83,6 +83,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.web_integrations_api import WebIntegrationsApi from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi @@ -172,5 +173,6 @@ "TestOptimizationApi", "UsageMeteringApi", "UsersApi", + "WebIntegrationsApi", "WorkflowAutomationApi", ] diff --git a/src/datadog_api_client/v2/model/web_integration_account_attributes.py b/src/datadog_api_client/v2/model/web_integration_account_attributes.py new file mode 100644 index 0000000000..955620c4c1 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_attributes.py @@ -0,0 +1,60 @@ +# 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.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + UUID, +) + + +class WebIntegrationAccountAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + "settings": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + } + + attribute_map = { + "name": "name", + "settings": "settings", + } + + def __init__(self_, name: str, settings: Dict[str, Any], **kwargs): + """ + Attributes for a web integration account. + + :param name: The name of the account. + :type name: str + + :param settings: Integration-specific settings for the account. The structure and required fields vary by integration type. + Use the schema endpoint to retrieve the specific requirements for each integration. + :type settings: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)} + """ + super().__init__(kwargs) + + self_.name = name + self_.settings = settings diff --git a/src/datadog_api_client/v2/model/web_integration_account_create_request.py b/src/datadog_api_client/v2/model/web_integration_account_create_request.py new file mode 100644 index 0000000000..4a16e8f5d8 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_create_request.py @@ -0,0 +1,44 @@ +# 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.web_integration_account_create_request_data import ( + WebIntegrationAccountCreateRequestData, + ) + + +class WebIntegrationAccountCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_create_request_data import ( + WebIntegrationAccountCreateRequestData, + ) + + return { + "data": (WebIntegrationAccountCreateRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WebIntegrationAccountCreateRequestData, **kwargs): + """ + Payload for creating a web integration account. + + :param data: Data object for creating a web integration account. + :type data: WebIntegrationAccountCreateRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/web_integration_account_create_request_attributes.py b/src/datadog_api_client/v2/model/web_integration_account_create_request_attributes.py new file mode 100644 index 0000000000..3265423031 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_create_request_attributes.py @@ -0,0 +1,84 @@ +# 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.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + UUID, +) + + +class WebIntegrationAccountCreateRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + "secrets": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "settings": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + } + + attribute_map = { + "name": "name", + "secrets": "secrets", + "settings": "settings", + } + + def __init__(self_, name: str, secrets: Dict[str, Any], settings: Dict[str, Any], **kwargs): + """ + Attributes for creating a web integration account. + + :param name: The name of the account. + :type name: str + + :param secrets: Sensitive credentials for the account. The structure and required fields vary by integration type. + These values are write-only and never returned in responses. Use the schema endpoint to determine + which secret fields are required for your specific integration. + :type secrets: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)} + + :param settings: Integration-specific settings for the account. The structure and required fields vary by integration type. + Use the schema endpoint (GET /api/v2/web-integrations/{integration_name}/accounts/schema) to retrieve + the specific requirements for your integration before creating an account. + :type settings: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)} + """ + super().__init__(kwargs) + + self_.name = name + self_.secrets = secrets + self_.settings = settings diff --git a/src/datadog_api_client/v2/model/web_integration_account_create_request_data.py b/src/datadog_api_client/v2/model/web_integration_account_create_request_data.py new file mode 100644 index 0000000000..2f7be47326 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_create_request_data.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.web_integration_account_create_request_attributes import ( + WebIntegrationAccountCreateRequestAttributes, + ) + from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + + +class WebIntegrationAccountCreateRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_create_request_attributes import ( + WebIntegrationAccountCreateRequestAttributes, + ) + from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + + return { + "attributes": (WebIntegrationAccountCreateRequestAttributes,), + "type": (WebIntegrationAccountType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, attributes: WebIntegrationAccountCreateRequestAttributes, type: WebIntegrationAccountType, **kwargs + ): + """ + Data object for creating a web integration account. + + :param attributes: Attributes for creating a web integration account. + :type attributes: WebIntegrationAccountCreateRequestAttributes + + :param type: The JSON:API type for web integration accounts. + :type type: WebIntegrationAccountType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/web_integration_account_response.py b/src/datadog_api_client/v2/model/web_integration_account_response.py new file mode 100644 index 0000000000..44a895c7c1 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.web_integration_account_response_data import WebIntegrationAccountResponseData + + +class WebIntegrationAccountResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_response_data import WebIntegrationAccountResponseData + + return { + "data": (WebIntegrationAccountResponseData,), + "integration_name": (str,), + } + + attribute_map = { + "data": "data", + "integration_name": "integration_name", + } + + def __init__( + self_, + data: Union[WebIntegrationAccountResponseData, UnsetType] = unset, + integration_name: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Response containing a single web integration account. + + :param data: Data object for a web integration account response. + :type data: WebIntegrationAccountResponseData, optional + + :param integration_name: The name of the integration. + :type integration_name: str, optional + """ + if data is not unset: + kwargs["data"] = data + if integration_name is not unset: + kwargs["integration_name"] = integration_name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/web_integration_account_response_data.py b/src/datadog_api_client/v2/model/web_integration_account_response_data.py new file mode 100644 index 0000000000..3ec5ac7f7c --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_response_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.web_integration_account_attributes import WebIntegrationAccountAttributes + from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + + +class WebIntegrationAccountResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_attributes import WebIntegrationAccountAttributes + from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + + return { + "attributes": (WebIntegrationAccountAttributes,), + "id": (str,), + "type": (WebIntegrationAccountType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: WebIntegrationAccountAttributes, id: str, type: WebIntegrationAccountType, **kwargs + ): + """ + Data object for a web integration account response. + + :param attributes: Attributes for a web integration account. + :type attributes: WebIntegrationAccountAttributes + + :param id: The unique identifier for the account. + :type id: str + + :param type: The JSON:API type for web integration accounts. + :type type: WebIntegrationAccountType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/web_integration_account_type.py b/src/datadog_api_client/v2/model/web_integration_account_type.py new file mode 100644 index 0000000000..2399af08ea --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_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 WebIntegrationAccountType(ModelSimple): + """ + The JSON:API type for web integration accounts. + + :param value: If omitted defaults to "Account". Must be one of ["Account"]. + :type value: str + """ + + allowed_values = { + "Account", + } + ACCOUNT: ClassVar["WebIntegrationAccountType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WebIntegrationAccountType.ACCOUNT = WebIntegrationAccountType("Account") diff --git a/src/datadog_api_client/v2/model/web_integration_account_update_request.py b/src/datadog_api_client/v2/model/web_integration_account_update_request.py new file mode 100644 index 0000000000..2225b959e9 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_update_request.py @@ -0,0 +1,44 @@ +# 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.web_integration_account_update_request_data import ( + WebIntegrationAccountUpdateRequestData, + ) + + +class WebIntegrationAccountUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_update_request_data import ( + WebIntegrationAccountUpdateRequestData, + ) + + return { + "data": (WebIntegrationAccountUpdateRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WebIntegrationAccountUpdateRequestData, **kwargs): + """ + Payload for updating a web integration account. + + :param data: Data object for updating a web integration account. + :type data: WebIntegrationAccountUpdateRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/web_integration_account_update_request_attributes.py b/src/datadog_api_client/v2/model/web_integration_account_update_request_attributes.py new file mode 100644 index 0000000000..e0cda3c29c --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_update_request_attributes.py @@ -0,0 +1,94 @@ +# 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, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class WebIntegrationAccountUpdateRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + "secrets": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "settings": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + } + + attribute_map = { + "name": "name", + "secrets": "secrets", + "settings": "settings", + } + + def __init__( + self_, + name: Union[str, UnsetType] = unset, + secrets: Union[Dict[str, Any], UnsetType] = unset, + settings: Union[Dict[str, Any], UnsetType] = unset, + **kwargs, + ): + """ + Attributes for updating a web integration account. All fields are optional - + only provide the fields you want to update. Partial updates are supported, + allowing you to modify specific settings or secrets without providing all fields. + + :param name: The name of the account. + :type name: str, optional + + :param secrets: Sensitive credentials to update. Only the secrets provided will be updated. + These values are write-only and never returned in responses. + :type secrets: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param settings: Integration-specific settings to update. Only the fields provided will be updated. + The structure varies by integration type. Refer to the integration's schema for available fields. + :type settings: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + """ + if name is not unset: + kwargs["name"] = name + if secrets is not unset: + kwargs["secrets"] = secrets + if settings is not unset: + kwargs["settings"] = settings + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/web_integration_account_update_request_data.py b/src/datadog_api_client/v2/model/web_integration_account_update_request_data.py new file mode 100644 index 0000000000..73024633de --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_update_request_data.py @@ -0,0 +1,62 @@ +# 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.web_integration_account_update_request_attributes import ( + WebIntegrationAccountUpdateRequestAttributes, + ) + from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + + +class WebIntegrationAccountUpdateRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_update_request_attributes import ( + WebIntegrationAccountUpdateRequestAttributes, + ) + from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + + return { + "attributes": (WebIntegrationAccountUpdateRequestAttributes,), + "type": (WebIntegrationAccountType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + type: WebIntegrationAccountType, + attributes: Union[WebIntegrationAccountUpdateRequestAttributes, UnsetType] = unset, + **kwargs, + ): + """ + Data object for updating a web integration account. + + :param attributes: Attributes for updating a web integration account. All fields are optional - + only provide the fields you want to update. Partial updates are supported, + allowing you to modify specific settings or secrets without providing all fields. + :type attributes: WebIntegrationAccountUpdateRequestAttributes, optional + + :param type: The JSON:API type for web integration accounts. + :type type: WebIntegrationAccountType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/web_integration_accounts_response.py b/src/datadog_api_client/v2/model/web_integration_accounts_response.py new file mode 100644 index 0000000000..2c90cc4617 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_accounts_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 List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.web_integration_account_response_data import WebIntegrationAccountResponseData + + +class WebIntegrationAccountsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_response_data import WebIntegrationAccountResponseData + + return { + "data": ([WebIntegrationAccountResponseData],), + "integration_name": (str,), + } + + attribute_map = { + "data": "data", + "integration_name": "integration_name", + } + + def __init__( + self_, + data: Union[List[WebIntegrationAccountResponseData], UnsetType] = unset, + integration_name: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Response containing a list of web integration accounts. + + :param data: + :type data: [WebIntegrationAccountResponseData], optional + + :param integration_name: The name of the integration. + :type integration_name: str, optional + """ + if data is not unset: + kwargs["data"] = data + if integration_name is not unset: + kwargs["integration_name"] = integration_name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index a699871b0d..b74e5b48e5 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -5323,6 +5323,25 @@ from datadog_api_client.v2.model.vulnerability_status import VulnerabilityStatus from datadog_api_client.v2.model.vulnerability_tool import VulnerabilityTool from datadog_api_client.v2.model.vulnerability_type import VulnerabilityType +from datadog_api_client.v2.model.web_integration_account_attributes import WebIntegrationAccountAttributes +from datadog_api_client.v2.model.web_integration_account_create_request import WebIntegrationAccountCreateRequest +from datadog_api_client.v2.model.web_integration_account_create_request_attributes import ( + WebIntegrationAccountCreateRequestAttributes, +) +from datadog_api_client.v2.model.web_integration_account_create_request_data import ( + WebIntegrationAccountCreateRequestData, +) +from datadog_api_client.v2.model.web_integration_account_response import WebIntegrationAccountResponse +from datadog_api_client.v2.model.web_integration_account_response_data import WebIntegrationAccountResponseData +from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType +from datadog_api_client.v2.model.web_integration_account_update_request import WebIntegrationAccountUpdateRequest +from datadog_api_client.v2.model.web_integration_account_update_request_attributes import ( + WebIntegrationAccountUpdateRequestAttributes, +) +from datadog_api_client.v2.model.web_integration_account_update_request_data import ( + WebIntegrationAccountUpdateRequestData, +) +from datadog_api_client.v2.model.web_integration_accounts_response import WebIntegrationAccountsResponse from datadog_api_client.v2.model.weekday import Weekday from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan from datadog_api_client.v2.model.workflow_data import WorkflowData @@ -9168,6 +9187,17 @@ "VulnerabilityStatus", "VulnerabilityTool", "VulnerabilityType", + "WebIntegrationAccountAttributes", + "WebIntegrationAccountCreateRequest", + "WebIntegrationAccountCreateRequestAttributes", + "WebIntegrationAccountCreateRequestData", + "WebIntegrationAccountResponse", + "WebIntegrationAccountResponseData", + "WebIntegrationAccountType", + "WebIntegrationAccountUpdateRequest", + "WebIntegrationAccountUpdateRequestAttributes", + "WebIntegrationAccountUpdateRequestData", + "WebIntegrationAccountsResponse", "Weekday", "WidgetLiveSpan", "WorkflowData", diff --git a/tests/v2/cassettes/test_scenarios/test_create_integration_account_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_integration_account_returns_created_response.frozen new file mode 100644 index 0000000000..ee56d681a1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_integration_account_returns_created_response.frozen @@ -0,0 +1 @@ +2026-01-16T00:21:52.989Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_integration_account_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_integration_account_returns_created_response.yaml new file mode 100644 index 0000000000..5ab521941e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_integration_account_returns_created_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"name":"Test-Create_integration_account_returns_Created_response-1768522912","secrets":{"api_key_token":"test_secret_token"},"settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}},"type":"Account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts + response: + body: + string: '{"data":{"id":"591eebe4-998f-49f0-b5db-a6b76e3ff392","type":"Account","attributes":{"name":"Test-Create_integration_account_returns_Created_response-1768522912","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_integration_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_integration_account_returns_ok_response.frozen new file mode 100644 index 0000000000..5445135415 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_integration_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-01-16T00:21:53.514Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_integration_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_integration_account_returns_ok_response.yaml new file mode 100644 index 0000000000..e9d5539b6a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_integration_account_returns_ok_response.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: '{"data":{"attributes":{"name":"Test-Delete_integration_account_returns_OK_response-1768522913","secrets":{"api_key_token":"test_secret_token_value"},"settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}},"type":"Account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts + response: + body: + string: '{"data":{"id":"2ef78fa1-8ebd-4dc8-8db7-1516563d9a35","type":"Account","attributes":{"name":"Test-Delete_integration_account_returns_OK_response-1768522913","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts/2ef78fa1-8ebd-4dc8-8db7-1516563d9a35 + response: + body: + string: '' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_account_schema_for_an_integration_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_account_schema_for_an_integration_returns_ok_response.frozen new file mode 100644 index 0000000000..5b4b6c4075 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_account_schema_for_an_integration_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-01-16T00:23:39.895Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_account_schema_for_an_integration_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_account_schema_for_an_integration_returns_ok_response.yaml new file mode 100644 index 0000000000..fe16b23971 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_account_schema_for_an_integration_returns_ok_response.yaml @@ -0,0 +1,33 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts/schema + response: + body: + string: '{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"secrets":{"additionalProperties":false,"properties":{"api_key_token":{"additionalProperties":false,"description":"Twilio + API Key Secret (token) corresponding to the API Key SID. Keep this secure + as it provides authentication access.","minLength":1,"type":"string"}},"required":["api_key_token"],"type":"object"},"settings":{"additionalProperties":false,"properties":{"account_sid":{"additionalProperties":false,"description":"Twilio + Account SID that uniquely identifies your Twilio account. Found in Twilio + Console \u003e Account Info.","minLength":1,"type":"string"},"alerts":{"additionalProperties":false,"description":"Enable + collection of Twilio Alerts logs to monitor account alerts and notifications","type":"boolean"},"api_key":{"additionalProperties":false,"description":"Twilio + API Key SID for authentication. Create from Twilio Console \u003e Account + \u003e API Keys \u0026 Tokens.","minLength":1,"type":"string"},"call_summaries":{"additionalProperties":false,"description":"Enable + collection of Twilio Voice call summaries to track voice call performance + and metadata","type":"boolean"},"ccm_enabled":{"additionalProperties":false,"description":"Enable + Cloud Cost Management to monitor Twilio usage costs and identify optimization + opportunities","type":"boolean"},"censor_logs":{"additionalProperties":false,"description":"Enable + censoring of sensitive data in logs. When true, phone numbers in the ''to'' + field and SMS message bodies are censored for privacy.","type":"boolean"},"events":{"additionalProperties":false,"description":"Enable + collection of Twilio Events logs to monitor account-level events and activities","type":"boolean"},"messages":{"additionalProperties":false,"description":"Enable + collection of Twilio Messages logs to track SMS and messaging activity","type":"boolean"}},"required":["api_key","account_sid","events","messages","alerts","call_summaries","ccm_enabled","censor_logs"],"type":"object"}},"required":["settings","secrets"],"type":"object"}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_integration_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_integration_account_returns_ok_response.frozen new file mode 100644 index 0000000000..67caccae48 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_integration_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-01-16T00:21:54.756Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_integration_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_integration_account_returns_ok_response.yaml new file mode 100644 index 0000000000..a6c812a846 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_integration_account_returns_ok_response.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: '{"data":{"attributes":{"name":"Test-Get_integration_account_returns_OK_response-1768522914","secrets":{"api_key_token":"test_secret_token_value"},"settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}},"type":"Account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts + response: + body: + string: '{"data":{"id":"945d4bbe-d24e-4530-a4db-3dc27329e5e8","type":"Account","attributes":{"name":"Test-Get_integration_account_returns_OK_response-1768522914","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts/945d4bbe-d24e-4530-a4db-3dc27329e5e8 + response: + body: + string: '{"data":{"id":"945d4bbe-d24e-4530-a4db-3dc27329e5e8","type":"Account","attributes":{"name":"Test-Get_integration_account_returns_OK_response-1768522914","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_integration_accounts_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_integration_accounts_returns_ok_response.frozen new file mode 100644 index 0000000000..3e3e9e3142 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_integration_accounts_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-01-16T00:21:55.952Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_integration_accounts_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_integration_accounts_returns_ok_response.yaml new file mode 100644 index 0000000000..f06dfe5707 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_integration_accounts_returns_ok_response.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: '{"data":{"attributes":{"name":"Test-List_integration_accounts_returns_OK_response-1768522915","secrets":{"api_key_token":"test_secret_token_value"},"settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}},"type":"Account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts + response: + body: + string: '{"data":{"id":"a491e2ce-8537-4015-8552-d76b23f9c2a2","type":"Account","attributes":{"name":"Test-List_integration_accounts_returns_OK_response-1768522915","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts + response: + body: + string: '{"data":[{"id":"cea19da0-127c-46bd-af1f-dab6524dc139","type":"Account","attributes":{"name":"Test-Create_integration_account_returns_Created_response-1768495642","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}},{"id":"07527a04-9eab-4528-8d55-072bb4cbfdfd","type":"Account","attributes":{"name":"Test-Get_integration_account_returns_OK_response-1768495644","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}},{"id":"efa743ed-c968-49df-97ce-f078b8f6a871","type":"Account","attributes":{"name":"Test-List_integration_accounts_returns_OK_response-1768495645","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}},{"id":"4fe972b3-5a53-414f-9304-0a683f403f46","type":"Account","attributes":{"name":"Test-Update_integration_account_returns_OK_response-1768495646-updated","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":false,"censor_logs":true,"events":false,"messages":false}}},{"id":"591eebe4-998f-49f0-b5db-a6b76e3ff392","type":"Account","attributes":{"name":"Test-Create_integration_account_returns_Created_response-1768522912","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}},{"id":"945d4bbe-d24e-4530-a4db-3dc27329e5e8","type":"Account","attributes":{"name":"Test-Get_integration_account_returns_OK_response-1768522914","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}},{"id":"a491e2ce-8537-4015-8552-d76b23f9c2a2","type":"Account","attributes":{"name":"Test-List_integration_accounts_returns_OK_response-1768522915","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_integration_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_integration_account_returns_ok_response.frozen new file mode 100644 index 0000000000..954730cedd --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_integration_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-01-16T00:21:56.916Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_integration_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_integration_account_returns_ok_response.yaml new file mode 100644 index 0000000000..e3c2407a86 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_integration_account_returns_ok_response.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: '{"data":{"attributes":{"name":"Test-Update_integration_account_returns_OK_response-1768522916","secrets":{"api_key_token":"test_secret_token_value"},"settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}},"type":"Account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts + response: + body: + string: '{"data":{"id":"4458ffbb-09e3-4b11-8b59-7ac39a766164","type":"Account","attributes":{"name":"Test-Update_integration_account_returns_OK_response-1768522916","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":true,"censor_logs":true,"events":true,"messages":true}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"name":"Test-Update_integration_account_returns_OK_response-1768522916-updated","settings":{"ccm_enabled":false,"events":false,"messages":false}},"type":"Account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/web-integrations/twilio/accounts/4458ffbb-09e3-4b11-8b59-7ac39a766164 + response: + body: + string: '{"data":{"id":"4458ffbb-09e3-4b11-8b59-7ac39a766164","type":"Account","attributes":{"name":"Test-Update_integration_account_returns_OK_response-1768522916-updated","settings":{"account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","alerts":true,"api_key":"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","call_summaries":true,"ccm_enabled":false,"censor_logs":true,"events":false,"messages":false}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index c717223ca7..033ad012af 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -1321,6 +1321,22 @@ "tag": "Users", "operationId": "CreateUser" }, + { + "parameters": [ + { + "name": "integration_name", + "value": "\"twilio\"" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"Account\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"settings\": {\n \"api_key\": \"SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n \"account_sid\": \"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n \"events\": true,\n \"messages\": true,\n \"alerts\": true,\n \"call_summaries\": true,\n \"ccm_enabled\": true,\n \"censor_logs\": true\n },\n \"secrets\": {\n \"api_key_token\": \"test_secret_token_value\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"web_integration_account\" in the system", + "key": "web_integration_account", + "tag": "Web Integrations", + "operationId": "CreateWebIntegrationAccount" + }, { "parameters": [ { diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 421fd89337..ed03c31890 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -5037,6 +5037,53 @@ "type": "safe" } }, + "ListWebIntegrationAccounts": { + "tag": "Web Integrations", + "undo": { + "type": "safe" + } + }, + "CreateWebIntegrationAccount": { + "tag": "Web Integrations", + "undo": { + "operationId": "DeleteWebIntegrationAccount", + "parameters": [ + { + "name": "integration_name", + "source": "integration_name" + }, + { + "name": "account_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "GetWebIntegrationAccountSchema": { + "tag": "Web Integrations", + "undo": { + "type": "safe" + } + }, + "DeleteWebIntegrationAccount": { + "tag": "Web Integrations", + "undo": { + "type": "idempotent" + } + }, + "GetWebIntegrationAccount": { + "tag": "Web Integrations", + "undo": { + "type": "safe" + } + }, + "UpdateWebIntegrationAccount": { + "tag": "Web Integrations", + "undo": { + "type": "idempotent" + } + }, "CreateWorkflow": { "tag": "Workflow Automation", "undo": { diff --git a/tests/v2/features/web_integrations.feature b/tests/v2/features/web_integrations.feature new file mode 100644 index 0000000000..8ce9e00b71 --- /dev/null +++ b/tests/v2/features/web_integrations.feature @@ -0,0 +1,211 @@ +@endpoint(web-integrations) @endpoint(web-integrations-v2) +Feature: Web Integrations + Configure and manage third-party web integrations with Datadog. This API + provides a unified interface for managing integration accounts across + various external services. Each integration has its own unique schema + that defines the required settings and secrets. Before creating or + updating an account, use the schema endpoint to retrieve the specific + requirements, field types, validation rules, and available configuration + options for your integration. Supported Integrations: - twilio - + snowflake-web - databricks + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "WebIntegrations" API + + @generated @skip @team:DataDog/web-integrations + Scenario: Create integration account returns "Bad Request" response + Given new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account", "secrets": {"api_key_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, "settings": {"account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "alerts": true, "api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "call_summaries": true, "ccm_enabled": true, "censor_logs": true, "events": true, "messages": true}}, "type": "Account"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/web-integrations + Scenario: Create integration account returns "Bad Request" response with invalid integration name + Given new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter with value "invalid-integration-name" + And body with value {"data": {"type": "Account", "attributes": {"name": "Test Account", "settings": {"api_key": "SKtest", "account_sid": "ACtest", "events": true, "messages": true, "alerts": true, "call_summaries": true, "ccm_enabled": true, "censor_logs": true}, "secrets": {"api_key_token": "test_token"}}}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/web-integrations + Scenario: Create integration account returns "Created" response + Given new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter with value "twilio" + And body with value {"data": {"type": "Account", "attributes": {"name": "{{ unique }}", "settings": {"api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "events": true, "messages": true, "alerts": true, "call_summaries": true, "ccm_enabled": true, "censor_logs": true}, "secrets": {"api_key_token": "test_secret_token"}}}} + When the request is sent + Then the response status is 201 Created + And the response "data.type" is equal to "Account" + And the response "data.attributes.name" is equal to "{{ unique }}" + And the response "data.attributes.settings.api_key" is equal to "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + And the response "data.attributes.settings.account_sid" is equal to "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + + @generated @skip @team:DataDog/web-integrations + Scenario: Create integration account returns "Not Found" response + Given new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account", "secrets": {"api_key_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, "settings": {"account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "alerts": true, "api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "call_summaries": true, "ccm_enabled": true, "censor_logs": true, "events": true, "messages": true}}, "type": "Account"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/web-integrations + Scenario: Create integration account returns "The server cannot process the request because it contains invalid data." response + Given new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account", "secrets": {"api_key_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, "settings": {"account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "alerts": true, "api_key": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "call_summaries": true, "ccm_enabled": true, "censor_logs": true, "events": true, "messages": true}}, "type": "Account"}} + When the request is sent + Then the response status is 422 The server cannot process the request because it contains invalid data. + + @skip @team:DataDog/web-integrations + Scenario: Create integration account returns "Unprocessable Entity" response with missing required field + Given new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter with value "twilio" + And body with value {"data": {"type": "Account", "attributes": {"name": "Test Account", "settings": {"api_key": "SKtest"}, "secrets": {"api_key_token": "test_token"}}}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/web-integrations + Scenario: Delete integration account returns "Bad Request" response + Given new "DeleteWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/web-integrations + Scenario: Delete integration account returns "Not Found" response + Given new "DeleteWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/web-integrations + Scenario: Delete integration account returns "OK" response + Given there is a valid "web_integration_account" in the system + And new "DeleteWebIntegrationAccount" request + And request contains "integration_name" parameter with value "twilio" + And request contains "account_id" parameter from "web_integration_account.data.id" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/web-integrations + Scenario: Get account schema for an integration returns "Bad Request" response + Given new "GetWebIntegrationAccountSchema" request + And request contains "integration_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/web-integrations + Scenario: Get account schema for an integration returns "Not Found" response + Given new "GetWebIntegrationAccountSchema" request + And request contains "integration_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/web-integrations + Scenario: Get account schema for an integration returns "OK" response + Given new "GetWebIntegrationAccountSchema" request + And request contains "integration_name" parameter with value "twilio" + When the request is sent + Then the response status is 200 OK + And the response "type" is equal to "object" + And the response "properties.settings.properties.api_key" has field "type" + And the response "properties.secrets.properties.api_key_token" has field "type" + + @generated @skip @team:DataDog/web-integrations + Scenario: Get integration account returns "Bad Request" response + Given new "GetWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/web-integrations + Scenario: Get integration account returns "Not Found" response + Given new "GetWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/web-integrations + Scenario: Get integration account returns "OK" response + Given there is a valid "web_integration_account" in the system + And new "GetWebIntegrationAccount" request + And request contains "integration_name" parameter with value "twilio" + And request contains "account_id" parameter from "web_integration_account.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "Account" + And the response "data.attributes.name" is equal to "{{ unique }}" + And the response "data.attributes.settings" has field "api_key" + And the response "data.attributes.settings" has field "account_sid" + + @generated @skip @team:DataDog/web-integrations + Scenario: List integration accounts returns "Bad Request" response + Given new "ListWebIntegrationAccounts" request + And request contains "integration_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/web-integrations + Scenario: List integration accounts returns "Not Found" response + Given new "ListWebIntegrationAccounts" request + And request contains "integration_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/web-integrations + Scenario: List integration accounts returns "OK" response + Given there is a valid "web_integration_account" in the system + And new "ListWebIntegrationAccounts" request + And request contains "integration_name" parameter with value "twilio" + When the request is sent + Then the response status is 200 OK + And the response "data[0].type" is equal to "Account" + And the response "data[0].attributes" has field "name" + And the response "data[0].attributes" has field "settings" + + @generated @skip @team:DataDog/web-integrations + Scenario: Update integration account returns "Bad Request" response + Given new "UpdateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account (Updated)", "secrets": {"api_key_token": "new_secret_token_value"}, "settings": {"ccm_enabled": true, "events": true, "messages": false}}, "type": "Account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/web-integrations + Scenario: Update integration account returns "Not Found" response + Given new "UpdateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account (Updated)", "secrets": {"api_key_token": "new_secret_token_value"}, "settings": {"ccm_enabled": true, "events": true, "messages": false}}, "type": "Account"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/web-integrations + Scenario: Update integration account returns "OK" response + Given there is a valid "web_integration_account" in the system + And new "UpdateWebIntegrationAccount" request + And request contains "integration_name" parameter with value "twilio" + And request contains "account_id" parameter from "web_integration_account.data.id" + And body with value {"data": {"type": "Account", "attributes": {"name": "{{ unique }}-updated", "settings": {"events": false, "messages": false, "ccm_enabled": false}}}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "Account" + And the response "data.attributes.name" is equal to "{{ unique }}-updated" + And the response "data.attributes.settings.events" is false + And the response "data.attributes.settings.messages" is false + + @generated @skip @team:DataDog/web-integrations + Scenario: Update integration account returns "The server cannot process the request because it contains invalid data." response + Given new "UpdateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "My Production Account (Updated)", "secrets": {"api_key_token": "new_secret_token_value"}, "settings": {"ccm_enabled": true, "events": true, "messages": false}}, "type": "Account"}} + When the request is sent + Then the response status is 422 The server cannot process the request because it contains invalid data.