diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 698ab6060c..c3425470ea 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -83079,6 +83079,139 @@ components: type: string x-enum-varnames: - RUM_REPLAY_WATCHER + WebIntegrationAccountCreateRequest: + description: Payload schema when adding a web integration account. + properties: + data: + $ref: "#/components/schemas/WebIntegrationAccountCreateRequestData" + required: + - data + type: object + WebIntegrationAccountCreateRequestAttributes: + description: Attributes object for creating a web integration account. + properties: + name: + description: A human-readable name for the account. Must be unique among accounts of the same integration. + example: my-databricks-account + type: string + secrets: + $ref: "#/components/schemas/WebIntegrationAccountSecrets" + settings: + $ref: "#/components/schemas/WebIntegrationAccountSettings" + 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: + - attributes + - type + type: object + WebIntegrationAccountResponse: + description: The expected response schema when getting a single web integration account. + properties: + data: + $ref: "#/components/schemas/WebIntegrationAccountResponseData" + type: object + WebIntegrationAccountResponseAttributes: + description: Attributes object of a web integration account. Secrets are never returned. + properties: + name: + description: A human-readable name for the account. + example: my-databricks-account + type: string + settings: + $ref: "#/components/schemas/WebIntegrationAccountSettings" + required: + - name + type: object + WebIntegrationAccountResponseData: + description: Data object of a web integration account. + properties: + attributes: + $ref: "#/components/schemas/WebIntegrationAccountResponseAttributes" + id: + description: The unique identifier of the web integration account. + example: "abc123def456" + type: string + type: + $ref: "#/components/schemas/WebIntegrationAccountType" + required: + - attributes + - id + - type + type: object + WebIntegrationAccountSecrets: + additionalProperties: {} + description: |- + Integration-specific secrets. The shape of this object varies by integration. Secrets + are write-only and never returned by the API. + example: + client_secret: my-client-secret + type: object + WebIntegrationAccountSettings: + additionalProperties: {} + description: |- + Integration-specific settings. The shape of this object varies by integration. + example: + workspace_url: https://example.azuredatabricks.net + type: object + WebIntegrationAccountType: + default: Account + description: Account resource type. + enum: + - Account + example: Account + type: string + x-enum-varnames: + - ACCOUNT + WebIntegrationAccountUpdateRequest: + description: Payload schema when updating a web integration account. + properties: + data: + $ref: "#/components/schemas/WebIntegrationAccountUpdateRequestData" + required: + - data + type: object + WebIntegrationAccountUpdateRequestAttributes: + description: Attributes object for updating a web integration account. + properties: + name: + description: A human-readable name for the account. + example: my-databricks-account + type: string + secrets: + $ref: "#/components/schemas/WebIntegrationAccountSecrets" + settings: + $ref: "#/components/schemas/WebIntegrationAccountSettings" + type: object + WebIntegrationAccountUpdateRequestData: + description: Data object for updating a web integration account. + properties: + attributes: + $ref: "#/components/schemas/WebIntegrationAccountUpdateRequestAttributes" + type: + $ref: "#/components/schemas/WebIntegrationAccountType" + required: + - attributes + - type + type: object + WebIntegrationAccountsResponse: + description: The expected response schema when listing web integration accounts. + properties: + data: + description: The JSON:API data array. + items: + $ref: "#/components/schemas/WebIntegrationAccountResponseData" + type: array + type: object Weekday: description: A day of the week. enum: @@ -144872,6 +145005,272 @@ paths: operator: OR permissions: - teams_read + /api/v2/web-integrations/{integration_name}/accounts: + get: + description: List accounts for a given web integration. + operationId: ListWebIntegrationAccounts + parameters: + - description: The name of the integration (for example, `databricks`). + in: path + name: integration_name + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + name: my-databricks-account + settings: + workspace_url: https://example.azuredatabricks.net + id: abc123def456 + type: Account + 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 web integration accounts + tags: + - Web Integrations + "x-permission": + operator: OR + permissions: + - integrations_read + x-unstable: |- + **Note**: This endpoint is for internal Datadog use only and is not part of the public API. It may change without notice. + post: + description: Create a new account for a given web integration. + operationId: CreateWebIntegrationAccount + parameters: + - description: The name of the integration (for example, `databricks`). + in: path + name: integration_name + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-databricks-account + secrets: + client_secret: my-client-secret + settings: + workspace_url: https://example.azuredatabricks.net + type: Account + schema: + $ref: "#/components/schemas/WebIntegrationAccountCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-databricks-account + settings: + workspace_url: https://example.azuredatabricks.net + id: abc123def456 + type: Account + 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 a web integration account + tags: + - Web Integrations + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - manage_integrations + x-unstable: |- + **Note**: This endpoint is for internal Datadog use only and is not part of the public API. It may change without notice. + /api/v2/web-integrations/{integration_name}/accounts/{account_id}: + delete: + description: Delete an account for a given web integration. + operationId: DeleteWebIntegrationAccount + parameters: + - description: The name of the integration (for example, `databricks`). + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the web integration account. + in: path + name: account_id + required: true + schema: + type: string + responses: + "204": + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a web integration account + tags: + - Web Integrations + "x-permission": + operator: OR + permissions: + - manage_integrations + x-unstable: |- + **Note**: This endpoint is for internal Datadog use only and is not part of the public API. It may change without notice. + get: + description: Get a single account for a given web integration. + operationId: GetWebIntegrationAccount + parameters: + - description: The name of the integration (for example, `databricks`). + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the web integration account. + in: path + name: account_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-databricks-account + settings: + workspace_url: https://example.azuredatabricks.net + id: abc123def456 + type: Account + 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 a web integration account + tags: + - Web Integrations + "x-permission": + operator: OR + permissions: + - integrations_read + x-unstable: |- + **Note**: This endpoint is for internal Datadog use only and is not part of the public API. It may change without notice. + patch: + description: Update an existing account for a given web integration. + operationId: UpdateWebIntegrationAccount + parameters: + - description: The name of the integration (for example, `databricks`). + in: path + name: integration_name + required: true + schema: + type: string + - description: The unique identifier of the web integration account. + in: path + name: account_id + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-databricks-account + secrets: + client_secret: my-new-client-secret + settings: + workspace_url: https://updated.azuredatabricks.net + type: Account + schema: + $ref: "#/components/schemas/WebIntegrationAccountUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-databricks-account + settings: + workspace_url: https://updated.azuredatabricks.net + id: abc123def456 + type: Account + 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 a web integration account + tags: + - Web Integrations + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - manage_integrations + x-unstable: |- + **Note**: This endpoint is for internal Datadog use only and is not part of the public API. It may change without notice. /api/v2/widgets/{experience_type}: get: description: |- @@ -146387,6 +146786,10 @@ tags: externalDocs: url: https://docs.datadoghq.com/account_management/users name: Users + - description: |- + Manage web integration accounts programmatically through the Datadog API. + See the [Web Integrations page](https://app.datadoghq.com/integrations) for more information. + name: Web Integrations - description: |- Create, read, update, and delete saved widgets. Widgets are reusable visualization components stored independently from any dashboard or notebook, diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 81b5337963..6209ab8085 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -760,6 +760,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.widgets\_api module ----------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 4acfd1f380..e5cff0b5b1 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -36719,6 +36719,97 @@ datadog\_api\_client.v2.model.watcher\_data\_type module :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\_attributes module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.web_integration_account_response_attributes + :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\_secrets module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.web_integration_account_secrets + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.web\_integration\_account\_settings module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.web_integration_account_settings + :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..ffe8037a78 --- /dev/null +++ b/examples/v2/web-integrations/CreateWebIntegrationAccount.py @@ -0,0 +1,35 @@ +""" +Create a web 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_secrets import WebIntegrationAccountSecrets +from datadog_api_client.v2.model.web_integration_account_settings import WebIntegrationAccountSettings +from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + +body = WebIntegrationAccountCreateRequest( + data=WebIntegrationAccountCreateRequestData( + attributes=WebIntegrationAccountCreateRequestAttributes( + name="my-databricks-account", + secrets=WebIntegrationAccountSecrets([("client_secret", "my-client-secret")]), + settings=WebIntegrationAccountSettings([("workspace_url", "https://example.azuredatabricks.net")]), + ), + type=WebIntegrationAccountType.ACCOUNT, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_web_integration_account"] = True +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.create_web_integration_account(integration_name="integration_name", 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..7a718dd8db --- /dev/null +++ b/examples/v2/web-integrations/DeleteWebIntegrationAccount.py @@ -0,0 +1,15 @@ +""" +Delete a web integration account returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi + +configuration = Configuration() +configuration.unstable_operations["delete_web_integration_account"] = True +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + api_instance.delete_web_integration_account( + integration_name="integration_name", + account_id="account_id", + ) diff --git a/examples/v2/web-integrations/GetWebIntegrationAccount.py b/examples/v2/web-integrations/GetWebIntegrationAccount.py new file mode 100644 index 0000000000..9a2e0a2f02 --- /dev/null +++ b/examples/v2/web-integrations/GetWebIntegrationAccount.py @@ -0,0 +1,17 @@ +""" +Get a web integration account returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi + +configuration = Configuration() +configuration.unstable_operations["get_web_integration_account"] = True +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.get_web_integration_account( + integration_name="integration_name", + account_id="account_id", + ) + + print(response) diff --git a/examples/v2/web-integrations/ListWebIntegrationAccounts.py b/examples/v2/web-integrations/ListWebIntegrationAccounts.py new file mode 100644 index 0000000000..046b1dc494 --- /dev/null +++ b/examples/v2/web-integrations/ListWebIntegrationAccounts.py @@ -0,0 +1,16 @@ +""" +List web 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() +configuration.unstable_operations["list_web_integration_accounts"] = True +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.list_web_integration_accounts( + integration_name="integration_name", + ) + + print(response) diff --git a/examples/v2/web-integrations/UpdateWebIntegrationAccount.py b/examples/v2/web-integrations/UpdateWebIntegrationAccount.py new file mode 100644 index 0000000000..9e78557469 --- /dev/null +++ b/examples/v2/web-integrations/UpdateWebIntegrationAccount.py @@ -0,0 +1,37 @@ +""" +Update a web integration account returns "OK" 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_secrets import WebIntegrationAccountSecrets +from datadog_api_client.v2.model.web_integration_account_settings import WebIntegrationAccountSettings +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, +) + +body = WebIntegrationAccountUpdateRequest( + data=WebIntegrationAccountUpdateRequestData( + attributes=WebIntegrationAccountUpdateRequestAttributes( + name="my-databricks-account", + secrets=WebIntegrationAccountSecrets([("client_secret", "my-client-secret")]), + settings=WebIntegrationAccountSettings([("workspace_url", "https://example.azuredatabricks.net")]), + ), + type=WebIntegrationAccountType.ACCOUNT, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_web_integration_account"] = True +with ApiClient(configuration) as api_client: + api_instance = WebIntegrationsApi(api_client) + response = api_instance.update_web_integration_account( + integration_name="integration_name", account_id="account_id", body=body + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 36e9294b5b..35b192f683 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -526,6 +526,11 @@ def __init__( "v2.get_incident_team": False, "v2.list_incident_teams": False, "v2.update_incident_team": False, + "v2.create_web_integration_account": False, + "v2.delete_web_integration_account": False, + "v2.get_web_integration_account": False, + "v2.list_web_integration_accounts": False, + "v2.update_web_integration_account": False, } ) 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..c494fb8f18 --- /dev/null +++ b/src/datadog_api_client/v2/api/web_integrations_api.py @@ -0,0 +1,272 @@ +# 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_update_request import WebIntegrationAccountUpdateRequest + + +class WebIntegrationsApi: + """ + Manage web integration accounts programmatically through the Datadog API. + See the `Web Integrations page `_ for more information. + """ + + 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._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 a web integration account. + + Create a new account for a given web integration. + + :param integration_name: The name of the integration (for example, ``databricks`` ). + :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 a web integration account. + + Delete an account for a given web integration. + + :param integration_name: The name of the integration (for example, ``databricks`` ). + :type integration_name: str + :param account_id: The unique identifier of the web integration 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 a web integration account. + + Get a single account for a given web integration. + + :param integration_name: The name of the integration (for example, ``databricks`` ). + :type integration_name: str + :param account_id: The unique identifier of the web integration 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 list_web_integration_accounts( + self, + integration_name: str, + ) -> WebIntegrationAccountsResponse: + """List web integration accounts. + + List accounts for a given web integration. + + :param integration_name: The name of the integration (for example, ``databricks`` ). + :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 a web integration account. + + Update an existing account for a given web integration. + + :param integration_name: The name of the integration (for example, ``databricks`` ). + :type integration_name: str + :param account_id: The unique identifier of the web integration 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 4a24c3b8d3..af1fc069e2 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -106,6 +106,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.widgets_api import WidgetsApi from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi @@ -219,6 +220,7 @@ "TestOptimizationApi", "UsageMeteringApi", "UsersApi", + "WebIntegrationsApi", "WidgetsApi", "WorkflowAutomationApi", ] 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..5c49450926 --- /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 schema when adding 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..736bb980f1 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_create_request_attributes.py @@ -0,0 +1,57 @@ +# 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_secrets import WebIntegrationAccountSecrets + from datadog_api_client.v2.model.web_integration_account_settings import WebIntegrationAccountSettings + + +class WebIntegrationAccountCreateRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_secrets import WebIntegrationAccountSecrets + from datadog_api_client.v2.model.web_integration_account_settings import WebIntegrationAccountSettings + + return { + "name": (str,), + "secrets": (WebIntegrationAccountSecrets,), + "settings": (WebIntegrationAccountSettings,), + } + + attribute_map = { + "name": "name", + "secrets": "secrets", + "settings": "settings", + } + + def __init__( + self_, name: str, secrets: WebIntegrationAccountSecrets, settings: WebIntegrationAccountSettings, **kwargs + ): + """ + Attributes object for creating a web integration account. + + :param name: A human-readable name for the account. Must be unique among accounts of the same integration. + :type name: str + + :param secrets: Integration-specific secrets. The shape of this object varies by integration. Secrets + are write-only and never returned by the API. + :type secrets: WebIntegrationAccountSecrets + + :param settings: Integration-specific settings. The shape of this object varies by integration. + :type settings: WebIntegrationAccountSettings + """ + 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..83848456f6 --- /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 object for creating a web integration account. + :type attributes: WebIntegrationAccountCreateRequestAttributes + + :param type: Account resource type. + :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..9ceffa9c55 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_response.py @@ -0,0 +1,42 @@ +# 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,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[WebIntegrationAccountResponseData, UnsetType] = unset, **kwargs): + """ + The expected response schema when getting a single web integration account. + + :param data: Data object of a web integration account. + :type data: WebIntegrationAccountResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/web_integration_account_response_attributes.py b/src/datadog_api_client/v2/model/web_integration_account_response_attributes.py new file mode 100644 index 0000000000..47e8dd75f0 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_response_attributes.py @@ -0,0 +1,49 @@ +# 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_settings import WebIntegrationAccountSettings + + +class WebIntegrationAccountResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_settings import WebIntegrationAccountSettings + + return { + "name": (str,), + "settings": (WebIntegrationAccountSettings,), + } + + attribute_map = { + "name": "name", + "settings": "settings", + } + + def __init__(self_, name: str, settings: Union[WebIntegrationAccountSettings, UnsetType] = unset, **kwargs): + """ + Attributes object of a web integration account. Secrets are never returned. + + :param name: A human-readable name for the account. + :type name: str + + :param settings: Integration-specific settings. The shape of this object varies by integration. + :type settings: WebIntegrationAccountSettings, optional + """ + if settings is not unset: + kwargs["settings"] = settings + super().__init__(kwargs) + + self_.name = name 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..a885316c21 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_response_data.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.web_integration_account_response_attributes import ( + WebIntegrationAccountResponseAttributes, + ) + 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_response_attributes import ( + WebIntegrationAccountResponseAttributes, + ) + from datadog_api_client.v2.model.web_integration_account_type import WebIntegrationAccountType + + return { + "attributes": (WebIntegrationAccountResponseAttributes,), + "id": (str,), + "type": (WebIntegrationAccountType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: WebIntegrationAccountResponseAttributes, id: str, type: WebIntegrationAccountType, **kwargs + ): + """ + Data object of a web integration account. + + :param attributes: Attributes object of a web integration account. Secrets are never returned. + :type attributes: WebIntegrationAccountResponseAttributes + + :param id: The unique identifier of the web integration account. + :type id: str + + :param type: Account resource type. + :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_secrets.py b/src/datadog_api_client/v2/model/web_integration_account_secrets.py new file mode 100644 index 0000000000..d85d83b705 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_secrets.py @@ -0,0 +1,18 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, +) + + +class WebIntegrationAccountSecrets(ModelNormal): + def __init__(self_, **kwargs): + """ + Integration-specific secrets. The shape of this object varies by integration. Secrets + are write-only and never returned by the API. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/web_integration_account_settings.py b/src/datadog_api_client/v2/model/web_integration_account_settings.py new file mode 100644 index 0000000000..16ee7a6893 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_settings.py @@ -0,0 +1,17 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, +) + + +class WebIntegrationAccountSettings(ModelNormal): + def __init__(self_, **kwargs): + """ + Integration-specific settings. The shape of this object varies by integration. + """ + super().__init__(kwargs) 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..d00c05fdfb --- /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): + """ + Account resource type. + + :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..622b22cbe6 --- /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 schema when 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..79d91ca519 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_update_request_attributes.py @@ -0,0 +1,65 @@ +# 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_secrets import WebIntegrationAccountSecrets + from datadog_api_client.v2.model.web_integration_account_settings import WebIntegrationAccountSettings + + +class WebIntegrationAccountUpdateRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.web_integration_account_secrets import WebIntegrationAccountSecrets + from datadog_api_client.v2.model.web_integration_account_settings import WebIntegrationAccountSettings + + return { + "name": (str,), + "secrets": (WebIntegrationAccountSecrets,), + "settings": (WebIntegrationAccountSettings,), + } + + attribute_map = { + "name": "name", + "secrets": "secrets", + "settings": "settings", + } + + def __init__( + self_, + name: Union[str, UnsetType] = unset, + secrets: Union[WebIntegrationAccountSecrets, UnsetType] = unset, + settings: Union[WebIntegrationAccountSettings, UnsetType] = unset, + **kwargs, + ): + """ + Attributes object for updating a web integration account. + + :param name: A human-readable name for the account. + :type name: str, optional + + :param secrets: Integration-specific secrets. The shape of this object varies by integration. Secrets + are write-only and never returned by the API. + :type secrets: WebIntegrationAccountSecrets, optional + + :param settings: Integration-specific settings. The shape of this object varies by integration. + :type settings: WebIntegrationAccountSettings, 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..382d1528a1 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_account_update_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_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_, attributes: WebIntegrationAccountUpdateRequestAttributes, type: WebIntegrationAccountType, **kwargs + ): + """ + Data object for updating a web integration account. + + :param attributes: Attributes object for updating a web integration account. + :type attributes: WebIntegrationAccountUpdateRequestAttributes + + :param type: Account resource type. + :type type: WebIntegrationAccountType + """ + super().__init__(kwargs) + + self_.attributes = attributes + 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..d0c5369f72 --- /dev/null +++ b/src/datadog_api_client/v2/model/web_integration_accounts_response.py @@ -0,0 +1,42 @@ +# 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],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[WebIntegrationAccountResponseData], UnsetType] = unset, **kwargs): + """ + The expected response schema when listing web integration accounts. + + :param data: The JSON:API data array. + :type data: [WebIntegrationAccountResponseData], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 05eb4d066a..42a531053f 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -7460,6 +7460,29 @@ from datadog_api_client.v2.model.watcher_data import WatcherData from datadog_api_client.v2.model.watcher_data_attributes import WatcherDataAttributes from datadog_api_client.v2.model.watcher_data_type import WatcherDataType +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_attributes import ( + WebIntegrationAccountResponseAttributes, +) +from datadog_api_client.v2.model.web_integration_account_response_data import WebIntegrationAccountResponseData +from datadog_api_client.v2.model.web_integration_account_secrets import WebIntegrationAccountSecrets +from datadog_api_client.v2.model.web_integration_account_settings import WebIntegrationAccountSettings +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_attributes import WidgetAttributes from datadog_api_client.v2.model.widget_data import WidgetData @@ -12763,6 +12786,19 @@ "WatcherData", "WatcherDataAttributes", "WatcherDataType", + "WebIntegrationAccountCreateRequest", + "WebIntegrationAccountCreateRequestAttributes", + "WebIntegrationAccountCreateRequestData", + "WebIntegrationAccountResponse", + "WebIntegrationAccountResponseAttributes", + "WebIntegrationAccountResponseData", + "WebIntegrationAccountSecrets", + "WebIntegrationAccountSettings", + "WebIntegrationAccountType", + "WebIntegrationAccountUpdateRequest", + "WebIntegrationAccountUpdateRequestAttributes", + "WebIntegrationAccountUpdateRequestData", + "WebIntegrationAccountsResponse", "Weekday", "WidgetAttributes", "WidgetData", diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 98e2edab7a..e6d7025d2f 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -1570,6 +1570,22 @@ "tag": "Users", "operationId": "CreateUser" }, + { + "parameters": [ + { + "name": "integration_name", + "value": "\"databricks\"" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"Account\",\n \"attributes\": {\n \"name\": \"{{ unique_lower_alnum }}\",\n \"settings\": {\n \"workspace_url\": \"https://example.azuredatabricks.net\"\n },\n \"secrets\": {\n \"client_secret\": \"fake-client-secret\"\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 96d9f3eb5d..fe0e8dd656 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -7146,6 +7146,47 @@ "type": "safe" } }, + "ListWebIntegrationAccounts": { + "tag": "Web Integrations", + "undo": { + "type": "safe" + } + }, + "CreateWebIntegrationAccount": { + "tag": "Web Integrations", + "undo": { + "operationId": "DeleteWebIntegrationAccount", + "parameters": [ + { + "name": "integration_name", + "template": "\"{{ integration_name }}\"" + }, + { + "name": "account_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteWebIntegrationAccount": { + "tag": "Web Integrations", + "undo": { + "type": "idempotent" + } + }, + "GetWebIntegrationAccount": { + "tag": "Web Integrations", + "undo": { + "type": "safe" + } + }, + "UpdateWebIntegrationAccount": { + "tag": "Web Integrations", + "undo": { + "type": "idempotent" + } + }, "SearchWidgets": { "tag": "Widgets", "undo": { diff --git a/tests/v2/features/web_integrations.feature b/tests/v2/features/web_integrations.feature new file mode 100644 index 0000000000..7fb73bee44 --- /dev/null +++ b/tests/v2/features/web_integrations.feature @@ -0,0 +1,164 @@ +@endpoint(web-integrations) @endpoint(web-integrations-v2) +Feature: Web Integrations + Manage web integration accounts programmatically through the Datadog API. + See the [Web Integrations page](https://app.datadoghq.com/integrations) + for more information. + + 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/saas-integrations + Scenario: Create a web integration account returns "Bad Request" response + Given operation "CreateWebIntegrationAccount" enabled + And new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "my-databricks-account", "secrets": {"client_secret": "my-client-secret"}, "settings": {"workspace_url": "https://example.azuredatabricks.net"}}, "type": "Account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/saas-integrations + Scenario: Create a web integration account returns "CREATED" response + Given operation "CreateWebIntegrationAccount" enabled + And new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "my-databricks-account", "secrets": {"client_secret": "my-client-secret"}, "settings": {"workspace_url": "https://example.azuredatabricks.net"}}, "type": "Account"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/saas-integrations + Scenario: Create a web integration account returns "Not Found" response + Given operation "CreateWebIntegrationAccount" enabled + And new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "my-databricks-account", "secrets": {"client_secret": "my-client-secret"}, "settings": {"workspace_url": "https://example.azuredatabricks.net"}}, "type": "Account"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/saas-integrations + Scenario: Create a web integration account returns "The server cannot process the request because it contains invalid data." response + Given operation "CreateWebIntegrationAccount" enabled + And new "CreateWebIntegrationAccount" request + And request contains "integration_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "my-databricks-account", "secrets": {"client_secret": "my-client-secret"}, "settings": {"workspace_url": "https://example.azuredatabricks.net"}}, "type": "Account"}} + When the request is sent + Then the response status is 422 The server cannot process the request because it contains invalid data. + + @generated @skip @team:DataDog/saas-integrations + Scenario: Delete a web integration account returns "Bad Request" response + Given operation "DeleteWebIntegrationAccount" enabled + And 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/saas-integrations + Scenario: Delete a web integration account returns "Not Found" response + Given operation "DeleteWebIntegrationAccount" enabled + And 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 + + @generated @skip @team:DataDog/saas-integrations + Scenario: Delete a web integration account returns "OK" response + Given operation "DeleteWebIntegrationAccount" enabled + And 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 204 OK + + @generated @skip @team:DataDog/saas-integrations + Scenario: Get a web integration account returns "Bad Request" response + Given operation "GetWebIntegrationAccount" enabled + And 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/saas-integrations + Scenario: Get a web integration account returns "Not Found" response + Given operation "GetWebIntegrationAccount" enabled + And 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 + + @generated @skip @team:DataDog/saas-integrations + Scenario: Get a web integration account returns "OK" response + Given operation "GetWebIntegrationAccount" enabled + And 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 200 OK + + @generated @skip @team:DataDog/saas-integrations + Scenario: List web integration accounts returns "Bad Request" response + Given operation "ListWebIntegrationAccounts" enabled + And 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/saas-integrations + Scenario: List web integration accounts returns "Not Found" response + Given operation "ListWebIntegrationAccounts" enabled + And 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 + + @generated @skip @team:DataDog/saas-integrations + Scenario: List web integration accounts returns "OK" response + Given operation "ListWebIntegrationAccounts" enabled + And new "ListWebIntegrationAccounts" request + And request contains "integration_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/saas-integrations + Scenario: Update a web integration account returns "Bad Request" response + Given operation "UpdateWebIntegrationAccount" enabled + And 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-databricks-account", "secrets": {"client_secret": "my-client-secret"}, "settings": {"workspace_url": "https://example.azuredatabricks.net"}}, "type": "Account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/saas-integrations + Scenario: Update a web integration account returns "Not Found" response + Given operation "UpdateWebIntegrationAccount" enabled + And 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-databricks-account", "secrets": {"client_secret": "my-client-secret"}, "settings": {"workspace_url": "https://example.azuredatabricks.net"}}, "type": "Account"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/saas-integrations + Scenario: Update a web integration account returns "OK" response + Given operation "UpdateWebIntegrationAccount" enabled + And 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-databricks-account", "secrets": {"client_secret": "my-client-secret"}, "settings": {"workspace_url": "https://example.azuredatabricks.net"}}, "type": "Account"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/saas-integrations + Scenario: Update a web integration account returns "The server cannot process the request because it contains invalid data." response + Given operation "UpdateWebIntegrationAccount" enabled + And 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-databricks-account", "secrets": {"client_secret": "my-client-secret"}, "settings": {"workspace_url": "https://example.azuredatabricks.net"}}, "type": "Account"}} + When the request is sent + Then the response status is 422 The server cannot process the request because it contains invalid data.