From 27338a6d00813b0af9d7d3c037ffc4265c0cad7d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 9 Jun 2026 15:58:59 +0000 Subject: [PATCH] Regenerate client from commit b1982e5 of spec repo --- .generator/schemas/v2/openapi.yaml | 76 +++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 ++ docs/datadog_api_client.v2.model.rst | 21 +++++ .../ListSlackUserBindings.py | 16 ++++ .../v2/api/slack_integration_api.py | 65 ++++++++++++++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../v2/model/slack_user_binding_data.py | 51 +++++++++++++ .../v2/model/slack_user_binding_type.py | 35 +++++++++ .../v2/model/slack_user_bindings_response.py | 40 ++++++++++ src/datadog_api_client/v2/models/__init__.py | 6 ++ tests/v2/features/slack_integration.feature | 23 ++++++ tests/v2/features/undo.json | 6 ++ 12 files changed, 348 insertions(+) create mode 100644 examples/v2/slack-integration/ListSlackUserBindings.py create mode 100644 src/datadog_api_client/v2/api/slack_integration_api.py create mode 100644 src/datadog_api_client/v2/model/slack_user_binding_data.py create mode 100644 src/datadog_api_client/v2/model/slack_user_binding_type.py create mode 100644 src/datadog_api_client/v2/model/slack_user_bindings_response.py create mode 100644 tests/v2/features/slack_integration.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2d470c8f2f..1e960b60bb 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1772,6 +1772,14 @@ components: required: false schema: type: boolean + SlackUserUuidQueryParameter: + description: The UUID of the Datadog user to list Slack bindings for. + in: query + name: user_uuid + required: true + schema: + format: uuid + type: string SloID: description: The ID of the SLO. in: path @@ -86535,6 +86543,37 @@ components: required: - slackTrigger type: object + SlackUserBindingData: + description: Slack team ID data from a response. + properties: + id: + description: The Slack team ID. + example: "T01234567" + type: string + type: + $ref: "#/components/schemas/SlackUserBindingType" + type: object + SlackUserBindingType: + default: team_id + description: Slack user binding resource type. + enum: + - team_id + example: team_id + type: string + x-enum-varnames: + - TEAM_ID + SlackUserBindingsResponse: + description: Response with a list of Slack user bindings. + properties: + data: + description: An array of Slack user bindings. + example: [{"id": "T01234567", "type": "team_id"}, {"id": "T09876543", "type": "team_id"}] + items: + $ref: "#/components/schemas/SlackUserBindingData" + type: array + required: + - data + type: object SloDataSource: default: slo description: A data source for SLO queries. @@ -132237,6 +132276,36 @@ paths: summary: List ServiceNow users tags: - ServiceNow Integration + /api/v2/integration/slack/user-bindings: + get: + description: List all Slack user bindings for a given Datadog user from the Datadog Slack integration. + operationId: ListSlackUserBindings + parameters: + - $ref: "#/components/parameters/SlackUserUuidQueryParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - id: T01234567 + type: team_id + - id: T09876543 + type: team_id + schema: + $ref: "#/components/schemas/SlackUserBindingsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List Slack user bindings + tags: + - Slack Integration /api/v2/integration/statuspage/account: delete: description: Delete the Statuspage account configured for your organization. @@ -181539,6 +181608,13 @@ tags: name: Service Level Objectives - description: Manage your ServiceNow Integration. ServiceNow is a cloud-based platform that helps organizations manage digital workflows for enterprise operations. name: ServiceNow Integration + - description: |- + Configure your [Datadog Slack integration](https://docs.datadoghq.com/integrations/slack/) + directly through the Datadog API. + externalDocs: + description: For more information about the Datadog Slack integration, see the integration page. + url: https://docs.datadoghq.com/integrations/slack/ + name: Slack Integration - description: |- API to create, update, retrieve, and delete Software Catalog entities. externalDocs: diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index fdced5d696..82ccad7e6d 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -746,6 +746,13 @@ datadog\_api\_client.v2.api.service\_now\_integration\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.slack\_integration\_api module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.slack_integration_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.software\_catalog\_api module --------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index f1ceac9025..24e25c30ee 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -37314,6 +37314,27 @@ datadog\_api\_client.v2.model.slack\_trigger\_wrapper module :members: :show-inheritance: +datadog\_api\_client.v2.model.slack\_user\_binding\_data module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.slack_user_binding_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.slack\_user\_binding\_type module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.slack_user_binding_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.slack\_user\_bindings\_response module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.slack_user_bindings_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.slo\_data\_source module ------------------------------------------------------ diff --git a/examples/v2/slack-integration/ListSlackUserBindings.py b/examples/v2/slack-integration/ListSlackUserBindings.py new file mode 100644 index 0000000000..a8ef372478 --- /dev/null +++ b/examples/v2/slack-integration/ListSlackUserBindings.py @@ -0,0 +1,16 @@ +""" +List Slack user bindings returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.slack_integration_api import SlackIntegrationApi +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = SlackIntegrationApi(api_client) + response = api_instance.list_slack_user_bindings( + user_uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/slack_integration_api.py b/src/datadog_api_client/v2/api/slack_integration_api.py new file mode 100644 index 0000000000..8f0fe573b2 --- /dev/null +++ b/src/datadog_api_client/v2/api/slack_integration_api.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 Any, Dict + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UUID, +) +from datadog_api_client.v2.model.slack_user_bindings_response import SlackUserBindingsResponse + + +class SlackIntegrationApi: + """ + Configure your `Datadog Slack integration `_ + directly through the Datadog API. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._list_slack_user_bindings_endpoint = _Endpoint( + settings={ + "response_type": (SlackUserBindingsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integration/slack/user-bindings", + "operation_id": "list_slack_user_bindings", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "user_uuid": { + "required": True, + "openapi_types": (UUID,), + "attribute": "user_uuid", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + def list_slack_user_bindings( + self, + user_uuid: UUID, + ) -> SlackUserBindingsResponse: + """List Slack user bindings. + + List all Slack user bindings for a given Datadog user from the Datadog Slack integration. + + :param user_uuid: The UUID of the Datadog user to list Slack bindings for. + :type user_uuid: UUID + :rtype: SlackUserBindingsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["user_uuid"] = user_uuid + + return self._list_slack_user_bindings_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 299d30f49a..f26b70c02e 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -104,6 +104,7 @@ from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi from datadog_api_client.v2.api.service_level_objectives_api import ServiceLevelObjectivesApi from datadog_api_client.v2.api.service_now_integration_api import ServiceNowIntegrationApi +from datadog_api_client.v2.api.slack_integration_api import SlackIntegrationApi from datadog_api_client.v2.api.software_catalog_api import SoftwareCatalogApi from datadog_api_client.v2.api.spa_api import SpaApi from datadog_api_client.v2.api.spans_api import SpansApi @@ -231,6 +232,7 @@ "ServiceDefinitionApi", "ServiceLevelObjectivesApi", "ServiceNowIntegrationApi", + "SlackIntegrationApi", "SoftwareCatalogApi", "SpaApi", "SpansApi", diff --git a/src/datadog_api_client/v2/model/slack_user_binding_data.py b/src/datadog_api_client/v2/model/slack_user_binding_data.py new file mode 100644 index 0000000000..6344e617af --- /dev/null +++ b/src/datadog_api_client/v2/model/slack_user_binding_data.py @@ -0,0 +1,51 @@ +# 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.slack_user_binding_type import SlackUserBindingType + + +class SlackUserBindingData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.slack_user_binding_type import SlackUserBindingType + + return { + "id": (str,), + "type": (SlackUserBindingType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__( + self_, id: Union[str, UnsetType] = unset, type: Union[SlackUserBindingType, UnsetType] = unset, **kwargs + ): + """ + Slack team ID data from a response. + + :param id: The Slack team ID. + :type id: str, optional + + :param type: Slack user binding resource type. + :type type: SlackUserBindingType, optional + """ + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/slack_user_binding_type.py b/src/datadog_api_client/v2/model/slack_user_binding_type.py new file mode 100644 index 0000000000..5633d38a93 --- /dev/null +++ b/src/datadog_api_client/v2/model/slack_user_binding_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 SlackUserBindingType(ModelSimple): + """ + Slack user binding resource type. + + :param value: If omitted defaults to "team_id". Must be one of ["team_id"]. + :type value: str + """ + + allowed_values = { + "team_id", + } + TEAM_ID: ClassVar["SlackUserBindingType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +SlackUserBindingType.TEAM_ID = SlackUserBindingType("team_id") diff --git a/src/datadog_api_client/v2/model/slack_user_bindings_response.py b/src/datadog_api_client/v2/model/slack_user_bindings_response.py new file mode 100644 index 0000000000..87005c19d4 --- /dev/null +++ b/src/datadog_api_client/v2/model/slack_user_bindings_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.slack_user_binding_data import SlackUserBindingData + + +class SlackUserBindingsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.slack_user_binding_data import SlackUserBindingData + + return { + "data": ([SlackUserBindingData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[SlackUserBindingData], **kwargs): + """ + Response with a list of Slack user bindings. + + :param data: An array of Slack user bindings. + :type data: [SlackUserBindingData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 817d63c3f9..0366c9d82b 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -7591,6 +7591,9 @@ from datadog_api_client.v2.model.slack_integration_metadata import SlackIntegrationMetadata from datadog_api_client.v2.model.slack_integration_metadata_channel_item import SlackIntegrationMetadataChannelItem from datadog_api_client.v2.model.slack_trigger_wrapper import SlackTriggerWrapper +from datadog_api_client.v2.model.slack_user_binding_data import SlackUserBindingData +from datadog_api_client.v2.model.slack_user_binding_type import SlackUserBindingType +from datadog_api_client.v2.model.slack_user_bindings_response import SlackUserBindingsResponse from datadog_api_client.v2.model.slo_data_source import SloDataSource from datadog_api_client.v2.model.slo_query import SloQuery from datadog_api_client.v2.model.slo_report_create_request import SloReportCreateRequest @@ -14293,6 +14296,9 @@ "SlackIntegrationMetadata", "SlackIntegrationMetadataChannelItem", "SlackTriggerWrapper", + "SlackUserBindingData", + "SlackUserBindingType", + "SlackUserBindingsResponse", "SloDataSource", "SloQuery", "SloReportCreateRequest", diff --git a/tests/v2/features/slack_integration.feature b/tests/v2/features/slack_integration.feature new file mode 100644 index 0000000000..0ef645a642 --- /dev/null +++ b/tests/v2/features/slack_integration.feature @@ -0,0 +1,23 @@ +@endpoint(slack-integration) @endpoint(slack-integration-v2) +Feature: Slack Integration + Configure your [Datadog Slack + integration](https://docs.datadoghq.com/integrations/slack/) directly + through the Datadog API. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "SlackIntegration" API + And new "ListSlackUserBindings" request + + @generated @skip @team:DataDog/chat-integrations + Scenario: List Slack user bindings returns "Bad Request" response + Given request contains "user_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: List Slack user bindings returns "OK" response + Given request contains "user_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 9101d0155c..7588d4d2d3 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -3634,6 +3634,12 @@ "type": "safe" } }, + "ListSlackUserBindings": { + "tag": "Slack Integration", + "undo": { + "type": "safe" + } + }, "DeleteStatuspageAccount": { "tag": "Statuspage Integration", "undo": {