Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------------------------------------------

Expand Down
21 changes: 21 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------------------------------------------

Expand Down
16 changes: 16 additions & 0 deletions examples/v2/slack-integration/ListSlackUserBindings.py
Original file line number Diff line number Diff line change
@@ -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)
65 changes: 65 additions & 0 deletions src/datadog_api_client/v2/api/slack_integration_api.py
Original file line number Diff line number Diff line change
@@ -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 <https://docs.datadoghq.com/integrations/slack/>`_
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)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -231,6 +232,7 @@
"ServiceDefinitionApi",
"ServiceLevelObjectivesApi",
"ServiceNowIntegrationApi",
"SlackIntegrationApi",
"SoftwareCatalogApi",
"SpaApi",
"SpansApi",
Expand Down
51 changes: 51 additions & 0 deletions src/datadog_api_client/v2/model/slack_user_binding_data.py
Original file line number Diff line number Diff line change
@@ -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)
35 changes: 35 additions & 0 deletions src/datadog_api_client/v2/model/slack_user_binding_type.py
Original file line number Diff line number Diff line change
@@ -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")
40 changes: 40 additions & 0 deletions src/datadog_api_client/v2/model/slack_user_bindings_response.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -14293,6 +14296,9 @@
"SlackIntegrationMetadata",
"SlackIntegrationMetadataChannelItem",
"SlackTriggerWrapper",
"SlackUserBindingData",
"SlackUserBindingType",
"SlackUserBindingsResponse",
"SloDataSource",
"SloQuery",
"SloReportCreateRequest",
Expand Down
Loading
Loading