diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb71549..ecda15b4ef 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -82027,7 +82027,7 @@ paths: - teams_read summary: Delete team connections tags: - - Team Connections + - Teams x-permission: operator: OR permissions: @@ -82106,7 +82106,7 @@ paths: - teams_read summary: List team connections tags: - - Team Connections + - Teams x-pagination: limitParam: page[size] pageParam: page[number] @@ -82150,7 +82150,7 @@ paths: - teams_read summary: Create team connections tags: - - Team Connections + - Teams x-permission: operator: OR permissions: @@ -85414,9 +85414,6 @@ tags: use Datadog\u2019s API to\nmanage both test types programmatically.\n\nFor more information about Synthetics, see the [Synthetics overview](https://docs.datadoghq.com/synthetics/)." name: Synthetics -- description: View and manage relationships between Datadog teams and teams from - external sources, such as GitHub. - name: Team Connections - description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information. name: Teams diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 3768dae831..b6ff4123e8 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -550,13 +550,6 @@ datadog\_api\_client.v2.api.synthetics\_api module :members: :show-inheritance: -datadog\_api\_client.v2.api.team\_connections\_api module ---------------------------------------------------------- - -.. automodule:: datadog_api_client.v2.api.team_connections_api - :members: - :show-inheritance: - datadog\_api\_client.v2.api.teams\_api module --------------------------------------------- diff --git a/examples/v2/team-connections/CreateTeamConnections.py b/examples/v2/teams/CreateTeamConnections.py similarity index 94% rename from examples/v2/team-connections/CreateTeamConnections.py rename to examples/v2/teams/CreateTeamConnections.py index d5df138fae..2b195bc1bb 100644 --- a/examples/v2/team-connections/CreateTeamConnections.py +++ b/examples/v2/teams/CreateTeamConnections.py @@ -4,7 +4,7 @@ from os import environ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.team_connections_api import TeamConnectionsApi +from datadog_api_client.v2.api.teams_api import TeamsApi from datadog_api_client.v2.model.connected_team_ref import ConnectedTeamRef from datadog_api_client.v2.model.connected_team_ref_data import ConnectedTeamRefData from datadog_api_client.v2.model.connected_team_ref_data_type import ConnectedTeamRefDataType @@ -49,7 +49,7 @@ configuration = Configuration() configuration.unstable_operations["create_team_connections"] = True with ApiClient(configuration) as api_client: - api_instance = TeamConnectionsApi(api_client) + api_instance = TeamsApi(api_client) response = api_instance.create_team_connections(body=body) print(response) diff --git a/examples/v2/team-connections/DeleteTeamConnections.py b/examples/v2/teams/DeleteTeamConnections.py similarity index 86% rename from examples/v2/team-connections/DeleteTeamConnections.py rename to examples/v2/teams/DeleteTeamConnections.py index 8e80166703..e262497bb8 100644 --- a/examples/v2/team-connections/DeleteTeamConnections.py +++ b/examples/v2/teams/DeleteTeamConnections.py @@ -3,7 +3,7 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.team_connections_api import TeamConnectionsApi +from datadog_api_client.v2.api.teams_api import TeamsApi from datadog_api_client.v2.model.team_connection_delete_request import TeamConnectionDeleteRequest from datadog_api_client.v2.model.team_connection_delete_request_data_item import TeamConnectionDeleteRequestDataItem from datadog_api_client.v2.model.team_connection_type import TeamConnectionType @@ -20,5 +20,5 @@ configuration = Configuration() configuration.unstable_operations["delete_team_connections"] = True with ApiClient(configuration) as api_client: - api_instance = TeamConnectionsApi(api_client) + api_instance = TeamsApi(api_client) api_instance.delete_team_connections(body=body) diff --git a/examples/v2/team-connections/ListTeamConnections.py b/examples/v2/teams/ListTeamConnections.py similarity index 71% rename from examples/v2/team-connections/ListTeamConnections.py rename to examples/v2/teams/ListTeamConnections.py index f44297c8df..cb6d92ba9c 100644 --- a/examples/v2/team-connections/ListTeamConnections.py +++ b/examples/v2/teams/ListTeamConnections.py @@ -3,12 +3,12 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.team_connections_api import TeamConnectionsApi +from datadog_api_client.v2.api.teams_api import TeamsApi configuration = Configuration() configuration.unstable_operations["list_team_connections"] = True with ApiClient(configuration) as api_client: - api_instance = TeamConnectionsApi(api_client) + api_instance = TeamsApi(api_client) response = api_instance.list_team_connections() print(response) diff --git a/examples/v2/team-connections/ListTeamConnections_1473516764.py b/examples/v2/teams/ListTeamConnections_1473516764.py similarity index 76% rename from examples/v2/team-connections/ListTeamConnections_1473516764.py rename to examples/v2/teams/ListTeamConnections_1473516764.py index 484b3068c8..3c10c2965d 100644 --- a/examples/v2/team-connections/ListTeamConnections_1473516764.py +++ b/examples/v2/teams/ListTeamConnections_1473516764.py @@ -3,12 +3,12 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.team_connections_api import TeamConnectionsApi +from datadog_api_client.v2.api.teams_api import TeamsApi configuration = Configuration() configuration.unstable_operations["list_team_connections"] = True with ApiClient(configuration) as api_client: - api_instance = TeamConnectionsApi(api_client) + api_instance = TeamsApi(api_client) response = api_instance.list_team_connections( page_size=10, filter_sources=[ diff --git a/examples/v2/team-connections/ListTeamConnections_2418873869.py b/examples/v2/teams/ListTeamConnections_2418873869.py similarity index 74% rename from examples/v2/team-connections/ListTeamConnections_2418873869.py rename to examples/v2/teams/ListTeamConnections_2418873869.py index c73fda4c74..4cab5cbb9c 100644 --- a/examples/v2/team-connections/ListTeamConnections_2418873869.py +++ b/examples/v2/teams/ListTeamConnections_2418873869.py @@ -3,12 +3,12 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.team_connections_api import TeamConnectionsApi +from datadog_api_client.v2.api.teams_api import TeamsApi configuration = Configuration() configuration.unstable_operations["list_team_connections"] = True with ApiClient(configuration) as api_client: - api_instance = TeamConnectionsApi(api_client) + api_instance = TeamsApi(api_client) items = api_instance.list_team_connections_with_pagination() for item in items: print(item) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 665081694b..50af2ecd65 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -380,13 +380,13 @@ def __init__( "v2.create_sca_resolve_vulnerable_symbols": False, "v2.create_sca_result": False, "v2.add_member_team": False, + "v2.create_team_connections": False, + "v2.delete_team_connections": False, "v2.get_team_sync": False, "v2.list_member_teams": False, + "v2.list_team_connections": False, "v2.remove_member_team": False, "v2.sync_teams": False, - "v2.create_team_connections": False, - "v2.delete_team_connections": False, - "v2.list_team_connections": False, "v2.create_incident_team": False, "v2.delete_incident_team": False, "v2.get_incident_team": False, diff --git a/src/datadog_api_client/v2/api/team_connections_api.py b/src/datadog_api_client/v2/api/team_connections_api.py deleted file mode 100644 index 465350cb4f..0000000000 --- a/src/datadog_api_client/v2/api/team_connections_api.py +++ /dev/null @@ -1,264 +0,0 @@ -# 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 - -import collections -from typing import Any, Dict, List, Union - -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 ( - set_attribute_from_path, - get_attribute_from_path, - UnsetType, - unset, -) -from datadog_api_client.v2.model.team_connection_delete_request import TeamConnectionDeleteRequest -from datadog_api_client.v2.model.team_connections_response import TeamConnectionsResponse -from datadog_api_client.v2.model.team_connection import TeamConnection -from datadog_api_client.v2.model.team_connection_create_request import TeamConnectionCreateRequest - - -class TeamConnectionsApi: - """ - View and manage relationships between Datadog teams and teams from external sources, such as GitHub. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient(Configuration()) - self.api_client = api_client - - self._create_team_connections_endpoint = _Endpoint( - settings={ - "response_type": (TeamConnectionsResponse,), - "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], - "endpoint_path": "/api/v2/team/connections", - "operation_id": "create_team_connections", - "http_method": "POST", - "version": "v2", - }, - params_map={ - "body": { - "required": True, - "openapi_types": (TeamConnectionCreateRequest,), - "location": "body", - }, - }, - headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, - api_client=api_client, - ) - - self._delete_team_connections_endpoint = _Endpoint( - settings={ - "response_type": None, - "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], - "endpoint_path": "/api/v2/team/connections", - "operation_id": "delete_team_connections", - "http_method": "DELETE", - "version": "v2", - }, - params_map={ - "body": { - "required": True, - "openapi_types": (TeamConnectionDeleteRequest,), - "location": "body", - }, - }, - headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, - api_client=api_client, - ) - - self._list_team_connections_endpoint = _Endpoint( - settings={ - "response_type": (TeamConnectionsResponse,), - "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], - "endpoint_path": "/api/v2/team/connections", - "operation_id": "list_team_connections", - "http_method": "GET", - "version": "v2", - }, - params_map={ - "page_size": { - "openapi_types": (int,), - "attribute": "page[size]", - "location": "query", - }, - "page_number": { - "openapi_types": (int,), - "attribute": "page[number]", - "location": "query", - }, - "filter_sources": { - "openapi_types": ([str],), - "attribute": "filter[sources]", - "location": "query", - "collection_format": "csv", - }, - "filter_team_ids": { - "openapi_types": ([str],), - "attribute": "filter[team_ids]", - "location": "query", - "collection_format": "csv", - }, - "filter_connected_team_ids": { - "openapi_types": ([str],), - "attribute": "filter[connected_team_ids]", - "location": "query", - "collection_format": "csv", - }, - "filter_connection_ids": { - "openapi_types": ([str],), - "attribute": "filter[connection_ids]", - "location": "query", - "collection_format": "csv", - }, - }, - headers_map={ - "accept": ["application/json"], - }, - api_client=api_client, - ) - - def create_team_connections( - self, - body: TeamConnectionCreateRequest, - ) -> TeamConnectionsResponse: - """Create team connections. - - Create multiple team connections. - - :type body: TeamConnectionCreateRequest - :rtype: TeamConnectionsResponse - """ - kwargs: Dict[str, Any] = {} - kwargs["body"] = body - - return self._create_team_connections_endpoint.call_with_http_info(**kwargs) - - def delete_team_connections( - self, - body: TeamConnectionDeleteRequest, - ) -> None: - """Delete team connections. - - Delete multiple team connections. - - :type body: TeamConnectionDeleteRequest - :rtype: None - """ - kwargs: Dict[str, Any] = {} - kwargs["body"] = body - - return self._delete_team_connections_endpoint.call_with_http_info(**kwargs) - - def list_team_connections( - self, - *, - page_size: Union[int, UnsetType] = unset, - page_number: Union[int, UnsetType] = unset, - filter_sources: Union[List[str], UnsetType] = unset, - filter_team_ids: Union[List[str], UnsetType] = unset, - filter_connected_team_ids: Union[List[str], UnsetType] = unset, - filter_connection_ids: Union[List[str], UnsetType] = unset, - ) -> TeamConnectionsResponse: - """List team connections. - - Returns all team connections. - - :param page_size: Size for a given page. The maximum allowed value is 100. - :type page_size: int, optional - :param page_number: Specific page number to return. - :type page_number: int, optional - :param filter_sources: Filter team connections by external source systems. - :type filter_sources: [str], optional - :param filter_team_ids: Filter team connections by Datadog team IDs. - :type filter_team_ids: [str], optional - :param filter_connected_team_ids: Filter team connections by connected team IDs from external systems. - :type filter_connected_team_ids: [str], optional - :param filter_connection_ids: Filter team connections by connection IDs. - :type filter_connection_ids: [str], optional - :rtype: TeamConnectionsResponse - """ - kwargs: Dict[str, Any] = {} - if page_size is not unset: - kwargs["page_size"] = page_size - - if page_number is not unset: - kwargs["page_number"] = page_number - - if filter_sources is not unset: - kwargs["filter_sources"] = filter_sources - - if filter_team_ids is not unset: - kwargs["filter_team_ids"] = filter_team_ids - - if filter_connected_team_ids is not unset: - kwargs["filter_connected_team_ids"] = filter_connected_team_ids - - if filter_connection_ids is not unset: - kwargs["filter_connection_ids"] = filter_connection_ids - - return self._list_team_connections_endpoint.call_with_http_info(**kwargs) - - def list_team_connections_with_pagination( - self, - *, - page_size: Union[int, UnsetType] = unset, - page_number: Union[int, UnsetType] = unset, - filter_sources: Union[List[str], UnsetType] = unset, - filter_team_ids: Union[List[str], UnsetType] = unset, - filter_connected_team_ids: Union[List[str], UnsetType] = unset, - filter_connection_ids: Union[List[str], UnsetType] = unset, - ) -> collections.abc.Iterable[TeamConnection]: - """List team connections. - - Provide a paginated version of :meth:`list_team_connections`, returning all items. - - :param page_size: Size for a given page. The maximum allowed value is 100. - :type page_size: int, optional - :param page_number: Specific page number to return. - :type page_number: int, optional - :param filter_sources: Filter team connections by external source systems. - :type filter_sources: [str], optional - :param filter_team_ids: Filter team connections by Datadog team IDs. - :type filter_team_ids: [str], optional - :param filter_connected_team_ids: Filter team connections by connected team IDs from external systems. - :type filter_connected_team_ids: [str], optional - :param filter_connection_ids: Filter team connections by connection IDs. - :type filter_connection_ids: [str], optional - - :return: A generator of paginated results. - :rtype: collections.abc.Iterable[TeamConnection] - """ - kwargs: Dict[str, Any] = {} - if page_size is not unset: - kwargs["page_size"] = page_size - - if page_number is not unset: - kwargs["page_number"] = page_number - - if filter_sources is not unset: - kwargs["filter_sources"] = filter_sources - - if filter_team_ids is not unset: - kwargs["filter_team_ids"] = filter_team_ids - - if filter_connected_team_ids is not unset: - kwargs["filter_connected_team_ids"] = filter_connected_team_ids - - if filter_connection_ids is not unset: - kwargs["filter_connection_ids"] = filter_connection_ids - - local_page_size = get_attribute_from_path(kwargs, "page_size", 10) - endpoint = self._list_team_connections_endpoint - set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map) - pagination = { - "limit_value": local_page_size, - "results_path": "data", - "page_param": "page_number", - "endpoint": endpoint, - "kwargs": kwargs, - } - return endpoint.call_with_http_info_paginated(pagination) diff --git a/src/datadog_api_client/v2/api/teams_api.py b/src/datadog_api_client/v2/api/teams_api.py index 7993971eb5..84a5519554 100644 --- a/src/datadog_api_client/v2/api/teams_api.py +++ b/src/datadog_api_client/v2/api/teams_api.py @@ -21,6 +21,10 @@ from datadog_api_client.v2.model.team import Team from datadog_api_client.v2.model.team_response import TeamResponse from datadog_api_client.v2.model.team_create_request import TeamCreateRequest +from datadog_api_client.v2.model.team_connection_delete_request import TeamConnectionDeleteRequest +from datadog_api_client.v2.model.team_connections_response import TeamConnectionsResponse +from datadog_api_client.v2.model.team_connection import TeamConnection +from datadog_api_client.v2.model.team_connection_create_request import TeamConnectionCreateRequest from datadog_api_client.v2.model.team_sync_response import TeamSyncResponse from datadog_api_client.v2.model.team_sync_attributes_source import TeamSyncAttributesSource from datadog_api_client.v2.model.team_sync_request import TeamSyncRequest @@ -96,6 +100,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_team_connections_endpoint = _Endpoint( + settings={ + "response_type": (TeamConnectionsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/team/connections", + "operation_id": "create_team_connections", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (TeamConnectionCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_team_link_endpoint = _Endpoint( settings={ "response_type": (TeamLinkResponse,), @@ -171,6 +195,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_team_connections_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/team/connections", + "operation_id": "delete_team_connections", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (TeamConnectionDeleteRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_team_link_endpoint = _Endpoint( settings={ "response_type": None, @@ -455,6 +499,57 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_team_connections_endpoint = _Endpoint( + settings={ + "response_type": (TeamConnectionsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/team/connections", + "operation_id": "list_team_connections", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_size": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + "filter_sources": { + "openapi_types": ([str],), + "attribute": "filter[sources]", + "location": "query", + "collection_format": "csv", + }, + "filter_team_ids": { + "openapi_types": ([str],), + "attribute": "filter[team_ids]", + "location": "query", + "collection_format": "csv", + }, + "filter_connected_team_ids": { + "openapi_types": ([str],), + "attribute": "filter[connected_team_ids]", + "location": "query", + "collection_format": "csv", + }, + "filter_connection_ids": { + "openapi_types": ([str],), + "attribute": "filter[connection_ids]", + "location": "query", + "collection_format": "csv", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_teams_endpoint = _Endpoint( settings={ "response_type": (TeamsResponse,), @@ -719,6 +814,22 @@ def create_team( return self._create_team_endpoint.call_with_http_info(**kwargs) + def create_team_connections( + self, + body: TeamConnectionCreateRequest, + ) -> TeamConnectionsResponse: + """Create team connections. + + Create multiple team connections. + + :type body: TeamConnectionCreateRequest + :rtype: TeamConnectionsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_team_connections_endpoint.call_with_http_info(**kwargs) + def create_team_link( self, team_id: str, @@ -778,6 +889,22 @@ def delete_team( return self._delete_team_endpoint.call_with_http_info(**kwargs) + def delete_team_connections( + self, + body: TeamConnectionDeleteRequest, + ) -> None: + """Delete team connections. + + Delete multiple team connections. + + :type body: TeamConnectionDeleteRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._delete_team_connections_endpoint.call_with_http_info(**kwargs) + def delete_team_link( self, team_id: str, @@ -1110,6 +1237,116 @@ def list_member_teams_with_pagination( } return endpoint.call_with_http_info_paginated(pagination) + def list_team_connections( + self, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + filter_sources: Union[List[str], UnsetType] = unset, + filter_team_ids: Union[List[str], UnsetType] = unset, + filter_connected_team_ids: Union[List[str], UnsetType] = unset, + filter_connection_ids: Union[List[str], UnsetType] = unset, + ) -> TeamConnectionsResponse: + """List team connections. + + Returns all team connections. + + :param page_size: Size for a given page. The maximum allowed value is 100. + :type page_size: int, optional + :param page_number: Specific page number to return. + :type page_number: int, optional + :param filter_sources: Filter team connections by external source systems. + :type filter_sources: [str], optional + :param filter_team_ids: Filter team connections by Datadog team IDs. + :type filter_team_ids: [str], optional + :param filter_connected_team_ids: Filter team connections by connected team IDs from external systems. + :type filter_connected_team_ids: [str], optional + :param filter_connection_ids: Filter team connections by connection IDs. + :type filter_connection_ids: [str], optional + :rtype: TeamConnectionsResponse + """ + kwargs: Dict[str, Any] = {} + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + if filter_sources is not unset: + kwargs["filter_sources"] = filter_sources + + if filter_team_ids is not unset: + kwargs["filter_team_ids"] = filter_team_ids + + if filter_connected_team_ids is not unset: + kwargs["filter_connected_team_ids"] = filter_connected_team_ids + + if filter_connection_ids is not unset: + kwargs["filter_connection_ids"] = filter_connection_ids + + return self._list_team_connections_endpoint.call_with_http_info(**kwargs) + + def list_team_connections_with_pagination( + self, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + filter_sources: Union[List[str], UnsetType] = unset, + filter_team_ids: Union[List[str], UnsetType] = unset, + filter_connected_team_ids: Union[List[str], UnsetType] = unset, + filter_connection_ids: Union[List[str], UnsetType] = unset, + ) -> collections.abc.Iterable[TeamConnection]: + """List team connections. + + Provide a paginated version of :meth:`list_team_connections`, returning all items. + + :param page_size: Size for a given page. The maximum allowed value is 100. + :type page_size: int, optional + :param page_number: Specific page number to return. + :type page_number: int, optional + :param filter_sources: Filter team connections by external source systems. + :type filter_sources: [str], optional + :param filter_team_ids: Filter team connections by Datadog team IDs. + :type filter_team_ids: [str], optional + :param filter_connected_team_ids: Filter team connections by connected team IDs from external systems. + :type filter_connected_team_ids: [str], optional + :param filter_connection_ids: Filter team connections by connection IDs. + :type filter_connection_ids: [str], optional + + :return: A generator of paginated results. + :rtype: collections.abc.Iterable[TeamConnection] + """ + kwargs: Dict[str, Any] = {} + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + if filter_sources is not unset: + kwargs["filter_sources"] = filter_sources + + if filter_team_ids is not unset: + kwargs["filter_team_ids"] = filter_team_ids + + if filter_connected_team_ids is not unset: + kwargs["filter_connected_team_ids"] = filter_connected_team_ids + + if filter_connection_ids is not unset: + kwargs["filter_connection_ids"] = filter_connection_ids + + local_page_size = get_attribute_from_path(kwargs, "page_size", 10) + endpoint = self._list_team_connections_endpoint + set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map) + pagination = { + "limit_value": local_page_size, + "results_path": "data", + "page_param": "page_number", + "endpoint": endpoint, + "kwargs": kwargs, + } + return endpoint.call_with_http_info_paginated(pagination) + def list_teams( self, *, diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 924b45b146..6587b91dac 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -76,7 +76,6 @@ from datadog_api_client.v2.api.spans_metrics_api import SpansMetricsApi from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi from datadog_api_client.v2.api.synthetics_api import SyntheticsApi -from datadog_api_client.v2.api.team_connections_api import TeamConnectionsApi from datadog_api_client.v2.api.teams_api import TeamsApi from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi @@ -163,7 +162,6 @@ "SpansMetricsApi", "StaticAnalysisApi", "SyntheticsApi", - "TeamConnectionsApi", "TeamsApi", "TestOptimizationApi", "UsageMeteringApi", diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 198c7af1b5..b255029e02 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -1173,7 +1173,7 @@ "source": "data.data[0]", "step": "there is a valid \"team_connection\" in the system", "key": "team_connection", - "tag": "Team Connections", + "tag": "Teams", "operationId": "CreateTeamConnections" }, { diff --git a/tests/v2/features/team_connections.feature b/tests/v2/features/team_connections.feature deleted file mode 100644 index 7bbce889e1..0000000000 --- a/tests/v2/features/team_connections.feature +++ /dev/null @@ -1,93 +0,0 @@ -@endpoint(team-connections) @endpoint(team-connections-v2) -Feature: Team Connections - View and manage relationships between Datadog teams and teams from - external sources, such as GitHub. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "TeamConnections" API - - @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Bad Request" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And body with value {"data": [{"attributes": {"source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"type": "team"}}}, "type": "team_connection"}]} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Conflict" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And body with value {"data": [{"attributes": {"managed_by": "github_sync", "source": "github"}, "relationships": {"connected_team": {"data": {"id": "@GitHubOrg/team-handle", "type": "github_team"}}, "team": {"data": {"id": "87654321-4321-8765-dcba-210987654321", "type": "team"}}}, "type": "team_connection"}]} - When the request is sent - Then the response status is 409 Conflict - - @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Created" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And there is a valid "dd_team" in the system - And body with value {"data": [{"type": "team_connection", "attributes": {"source": "github", "managed_by": "datadog"}, "relationships": {"team": {"data": {"id": "{{ dd_team.data.id }}", "type": "team"}}, "connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}}}]} - When the request is sent - Then the response status is 201 Created - And the response "data.data[0].attributes.source" is equal to "github" - And the response "data.data[0].attributes.managed_by" is equal to "datadog" - And the response "data.data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}" - And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name" - And the response "data.data[0].type" is equal to "team_connection" - - @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "Bad Request" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"type": "team_connection"}]} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "No Content" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} - When the request is sent - Then the response status is 204 No Content - - @generated @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "Not Found" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-omg - Scenario: List team connections returns "Bad Request" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request is sent - Then the response status is 400 Bad Request - - @skip @team:DataDog/aaa-omg - Scenario: List team connections returns "OK" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-omg @with-pagination - Scenario: List team connections returns "OK" response with pagination - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request with pagination is sent - Then the response status is 200 OK - - @skip @team:DataDog/aaa-omg - Scenario: List team connections with filters returns "OK" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - And request contains "filter[sources]" parameter with value ["github"] - And request contains "page[size]" parameter with value 10 - When the request is sent - Then the response status is 200 OK diff --git a/tests/v2/features/teams.feature b/tests/v2/features/teams.feature index bf11bd0316..c95c676006 100644 --- a/tests/v2/features/teams.feature +++ b/tests/v2/features/teams.feature @@ -96,6 +96,60 @@ Feature: Teams And the response "data.attributes.visible_modules" is equal to ["m1","m2"] And the response "data.attributes.hidden_modules" is equal to ["m3"] + @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Bad Request" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And body with value {"data": [{"attributes": {"source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"type": "team"}}}, "type": "team_connection"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Conflict" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And body with value {"data": [{"attributes": {"managed_by": "github_sync", "source": "github"}, "relationships": {"connected_team": {"data": {"id": "@GitHubOrg/team-handle", "type": "github_team"}}, "team": {"data": {"id": "87654321-4321-8765-dcba-210987654321", "type": "team"}}}, "type": "team_connection"}]} + When the request is sent + Then the response status is 409 Conflict + + @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Created" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And there is a valid "dd_team" in the system + And body with value {"data": [{"type": "team_connection", "attributes": {"source": "github", "managed_by": "datadog"}, "relationships": {"team": {"data": {"id": "{{ dd_team.data.id }}", "type": "team"}}, "connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}}}]} + When the request is sent + Then the response status is 201 Created + And the response "data.data[0].attributes.source" is equal to "github" + And the response "data.data[0].attributes.managed_by" is equal to "datadog" + And the response "data.data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name" + And the response "data.data[0].type" is equal to "team_connection" + + @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "Bad Request" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"type": "team_connection"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "No Content" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "Not Found" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/aaa-omg Scenario: Get a team link returns "API error response." response Given new "GetTeamLink" request @@ -275,6 +329,36 @@ Feature: Teams When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-omg + Scenario: List team connections returns "Bad Request" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: List team connections returns "OK" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg @with-pagination + Scenario: List team connections returns "OK" response with pagination + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request with pagination is sent + Then the response status is 200 OK + + @skip @team:DataDog/aaa-omg + Scenario: List team connections with filters returns "OK" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + And request contains "filter[sources]" parameter with value ["github"] + And request contains "page[size]" parameter with value 10 + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-omg Scenario: Remove a member team returns "API error response." response Given operation "RemoveMemberTeam" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3799e64e63..a0246cd86d 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -4346,19 +4346,19 @@ } }, "DeleteTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "type": "idempotent" } }, "ListTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "type": "safe" } }, "CreateTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "operationId": "DeleteTeamConnections", "type": "unsafe"