Skip to content

Commit 9eefb6e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add partial hierarchy selection to team sync endpoints (#3245)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e1f6304 commit 9eefb6e

17 files changed

+419
-59
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65885,6 +65885,8 @@ components:
6588565885
properties:
6588665886
frequency:
6588765887
$ref: "#/components/schemas/TeamSyncAttributesFrequency"
65888+
selection_state:
65889+
$ref: "#/components/schemas/TeamSyncAttributesSelectionState"
6588865890
source:
6588965891
$ref: "#/components/schemas/TeamSyncAttributesSource"
6589065892
sync_membership:
@@ -65907,6 +65909,14 @@ components:
6590765909
- ONCE
6590865910
- CONTINUOUSLY
6590965911
- PAUSED
65912+
TeamSyncAttributesSelectionState:
65913+
description: |-
65914+
Specifies which teams or organizations to sync. When
65915+
provided, synchronization is limited to the specified
65916+
items and their subtrees.
65917+
items:
65918+
$ref: "#/components/schemas/TeamSyncSelectionStateItem"
65919+
type: array
6591065920
TeamSyncAttributesSource:
6591165921
description: The external source platform for team synchronization. Only "github" is supported.
6591265922
enum:
@@ -65916,6 +65926,7 @@ components:
6591665926
x-enum-varnames:
6591765927
- GITHUB
6591865928
TeamSyncAttributesSyncMembership:
65929+
default: false
6591965930
description: Whether to sync members from the external team to the Datadog team. Defaults to `false` when not provided.
6592065931
example: true
6592165932
type: boolean
@@ -65975,6 +65986,72 @@ components:
6597565986
$ref: "#/components/schemas/TeamSyncData"
6597665987
type: array
6597765988
type: object
65989+
TeamSyncSelectionStateExternalId:
65990+
description: The external identifier for a team or organization in the source platform.
65991+
properties:
65992+
type:
65993+
$ref: "#/components/schemas/TeamSyncSelectionStateExternalIdType"
65994+
value:
65995+
$ref: "#/components/schemas/TeamSyncSelectionStateExternalIdValue"
65996+
required:
65997+
- type
65998+
- value
65999+
type: object
66000+
TeamSyncSelectionStateExternalIdType:
66001+
description: |-
66002+
The type of external identifier for the selection state item.
66003+
For GitHub synchronization, the allowed values are `team` and
66004+
`organization`.
66005+
enum:
66006+
- team
66007+
- organization
66008+
example: team
66009+
type: string
66010+
x-enum-varnames:
66011+
- TEAM
66012+
- ORGANIZATION
66013+
TeamSyncSelectionStateExternalIdValue:
66014+
description: |-
66015+
The external identifier value from the source
66016+
platform. For GitHub, this is the string
66017+
representation of a GitHub organization ID or team
66018+
ID.
66019+
example: "1"
66020+
type: string
66021+
TeamSyncSelectionStateItem:
66022+
description: Identifies a team or organization hierarchy to include in synchronization.
66023+
properties:
66024+
external_id:
66025+
$ref: "#/components/schemas/TeamSyncSelectionStateExternalId"
66026+
operation:
66027+
$ref: "#/components/schemas/TeamSyncSelectionStateOperation"
66028+
scope:
66029+
$ref: "#/components/schemas/TeamSyncSelectionStateScope"
66030+
required:
66031+
- external_id
66032+
type: object
66033+
TeamSyncSelectionStateOperation:
66034+
description: |-
66035+
The operation to perform on the selected hierarchy.
66036+
When set to `include`, synchronization covers the
66037+
referenced teams or organizations.
66038+
enum:
66039+
- include
66040+
example: include
66041+
type: string
66042+
x-enum-varnames:
66043+
- INCLUDE
66044+
TeamSyncSelectionStateScope:
66045+
description: |-
66046+
The scope of the selection. When set to `subtree`,
66047+
synchronization includes the referenced team or
66048+
organization and everything nested under it.
66049+
enum:
66050+
- subtree
66051+
example: subtree
66052+
type: string
66053+
x-enum-varnames:
66054+
- SUBTREE
6597866055
TeamTarget:
6597966056
description: "Represents a team target for an escalation policy step, including the team's ID and resource type."
6598066057
properties:
@@ -105434,12 +105511,6 @@ paths:
105434105511
description: OK
105435105512
"403":
105436105513
$ref: "#/components/responses/ForbiddenResponse"
105437-
"404":
105438-
content:
105439-
application/json:
105440-
schema:
105441-
$ref: "#/components/schemas/APIErrorResponse"
105442-
description: Team sync configurations not found
105443105514
"429":
105444105515
$ref: "#/components/responses/TooManyRequestsResponse"
105445105516
security:
@@ -105456,13 +105527,17 @@ paths:
105456105527
- teams_read
105457105528
post:
105458105529
description: |-
105459-
This endpoint attempts to link your existing Datadog teams with GitHub teams by matching their names.
105530+
This endpoint configures synchronization between your existing Datadog teams and GitHub teams by matching their names.
105460105531
It evaluates all current Datadog teams and compares them against teams in the GitHub organization
105461105532
connected to your Datadog account, based on Datadog Team handle and GitHub Team slug
105462105533
(lowercased and kebab-cased).
105463105534

105464105535
This operation is read-only on the GitHub side, no teams will be modified or created.
105465105536

105537+
Optionally, provide `selection_state` to limit synchronization
105538+
to specific teams or organizations and their subtrees, instead
105539+
of syncing all teams.
105540+
105466105541
[A GitHub organization must be connected to your Datadog account](https://docs.datadoghq.com/integrations/github/),
105467105542
and the GitHub App integrated with Datadog must have the `Members Read` permission. Matching is performed by comparing the Datadog team handle to the GitHub team slug
105468105543
using a normalized exact match; case is ignored and spaces are removed. No modifications are made
@@ -105477,6 +105552,8 @@ paths:
105477105552
responses:
105478105553
"200":
105479105554
description: OK
105555+
"204":
105556+
description: No Content
105480105557
"403":
105481105558
$ref: "#/components/responses/ForbiddenResponse"
105482105559
"429":

docs/datadog_api_client.v2.model.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30468,6 +30468,41 @@ datadog\_api\_client.v2.model.team\_sync\_response module
3046830468
:members:
3046930469
:show-inheritance:
3047030470

30471+
datadog\_api\_client.v2.model.team\_sync\_selection\_state\_external\_id module
30472+
-------------------------------------------------------------------------------
30473+
30474+
.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_external_id
30475+
:members:
30476+
:show-inheritance:
30477+
30478+
datadog\_api\_client.v2.model.team\_sync\_selection\_state\_external\_id\_type module
30479+
-------------------------------------------------------------------------------------
30480+
30481+
.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_external_id_type
30482+
:members:
30483+
:show-inheritance:
30484+
30485+
datadog\_api\_client.v2.model.team\_sync\_selection\_state\_item module
30486+
-----------------------------------------------------------------------
30487+
30488+
.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_item
30489+
:members:
30490+
:show-inheritance:
30491+
30492+
datadog\_api\_client.v2.model.team\_sync\_selection\_state\_operation module
30493+
----------------------------------------------------------------------------
30494+
30495+
.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_operation
30496+
:members:
30497+
:show-inheritance:
30498+
30499+
datadog\_api\_client.v2.model.team\_sync\_selection\_state\_scope module
30500+
------------------------------------------------------------------------
30501+
30502+
.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_scope
30503+
:members:
30504+
:show-inheritance:
30505+
3047130506
datadog\_api\_client.v2.model.team\_target module
3047230507
-------------------------------------------------
3047330508

examples/v2/teams/SyncTeams_3215592344.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/datadog_api_client/v2/api/teams_api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,13 +1972,17 @@ def sync_teams(
19721972
) -> None:
19731973
"""Link Teams with GitHub Teams.
19741974
1975-
This endpoint attempts to link your existing Datadog teams with GitHub teams by matching their names.
1975+
This endpoint configures synchronization between your existing Datadog teams and GitHub teams by matching their names.
19761976
It evaluates all current Datadog teams and compares them against teams in the GitHub organization
19771977
connected to your Datadog account, based on Datadog Team handle and GitHub Team slug
19781978
(lowercased and kebab-cased).
19791979
19801980
This operation is read-only on the GitHub side, no teams will be modified or created.
19811981
1982+
Optionally, provide ``selection_state`` to limit synchronization
1983+
to specific teams or organizations and their subtrees, instead
1984+
of syncing all teams.
1985+
19821986
`A GitHub organization must be connected to your Datadog account <https://docs.datadoghq.com/integrations/github/>`_ ,
19831987
and the GitHub App integrated with Datadog must have the ``Members Read`` permission. Matching is performed by comparing the Datadog team handle to the GitHub team slug
19841988
using a normalized exact match; case is ignored and spaces are removed. No modifications are made

src/datadog_api_client/v2/model/team_sync_attributes.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import Union, TYPE_CHECKING
6+
from typing import List, Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
@@ -15,6 +15,7 @@
1515

1616
if TYPE_CHECKING:
1717
from datadog_api_client.v2.model.team_sync_attributes_frequency import TeamSyncAttributesFrequency
18+
from datadog_api_client.v2.model.team_sync_selection_state_item import TeamSyncSelectionStateItem
1819
from datadog_api_client.v2.model.team_sync_attributes_source import TeamSyncAttributesSource
1920
from datadog_api_client.v2.model.team_sync_attributes_type import TeamSyncAttributesType
2021

@@ -23,18 +24,21 @@ class TeamSyncAttributes(ModelNormal):
2324
@cached_property
2425
def openapi_types(_):
2526
from datadog_api_client.v2.model.team_sync_attributes_frequency import TeamSyncAttributesFrequency
27+
from datadog_api_client.v2.model.team_sync_selection_state_item import TeamSyncSelectionStateItem
2628
from datadog_api_client.v2.model.team_sync_attributes_source import TeamSyncAttributesSource
2729
from datadog_api_client.v2.model.team_sync_attributes_type import TeamSyncAttributesType
2830

2931
return {
3032
"frequency": (TeamSyncAttributesFrequency,),
33+
"selection_state": ([TeamSyncSelectionStateItem],),
3134
"source": (TeamSyncAttributesSource,),
3235
"sync_membership": (bool,),
3336
"type": (TeamSyncAttributesType,),
3437
}
3538

3639
attribute_map = {
3740
"frequency": "frequency",
41+
"selection_state": "selection_state",
3842
"source": "source",
3943
"sync_membership": "sync_membership",
4044
"type": "type",
@@ -45,6 +49,7 @@ def __init__(
4549
source: TeamSyncAttributesSource,
4650
type: TeamSyncAttributesType,
4751
frequency: Union[TeamSyncAttributesFrequency, UnsetType] = unset,
52+
selection_state: Union[List[TeamSyncSelectionStateItem], UnsetType] = unset,
4853
sync_membership: Union[bool, UnsetType] = unset,
4954
**kwargs,
5055
):
@@ -54,6 +59,11 @@ def __init__(
5459
:param frequency: How often the sync process should be run. Defaults to ``once`` when not provided.
5560
:type frequency: TeamSyncAttributesFrequency, optional
5661
62+
:param selection_state: Specifies which teams or organizations to sync. When
63+
provided, synchronization is limited to the specified
64+
items and their subtrees.
65+
:type selection_state: [TeamSyncSelectionStateItem], optional
66+
5767
:param source: The external source platform for team synchronization. Only "github" is supported.
5868
:type source: TeamSyncAttributesSource
5969
@@ -65,6 +75,8 @@ def __init__(
6575
"""
6676
if frequency is not unset:
6777
kwargs["frequency"] = frequency
78+
if selection_state is not unset:
79+
kwargs["selection_state"] = selection_state
6880
if sync_membership is not unset:
6981
kwargs["sync_membership"] = sync_membership
7082
super().__init__(kwargs)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
)
12+
13+
14+
if TYPE_CHECKING:
15+
from datadog_api_client.v2.model.team_sync_selection_state_external_id_type import (
16+
TeamSyncSelectionStateExternalIdType,
17+
)
18+
19+
20+
class TeamSyncSelectionStateExternalId(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v2.model.team_sync_selection_state_external_id_type import (
24+
TeamSyncSelectionStateExternalIdType,
25+
)
26+
27+
return {
28+
"type": (TeamSyncSelectionStateExternalIdType,),
29+
"value": (str,),
30+
}
31+
32+
attribute_map = {
33+
"type": "type",
34+
"value": "value",
35+
}
36+
37+
def __init__(self_, type: TeamSyncSelectionStateExternalIdType, value: str, **kwargs):
38+
"""
39+
The external identifier for a team or organization in the source platform.
40+
41+
:param type: The type of external identifier for the selection state item.
42+
For GitHub synchronization, the allowed values are ``team`` and
43+
``organization``.
44+
:type type: TeamSyncSelectionStateExternalIdType
45+
46+
:param value: The external identifier value from the source
47+
platform. For GitHub, this is the string
48+
representation of a GitHub organization ID or team
49+
ID.
50+
:type value: str
51+
"""
52+
super().__init__(kwargs)
53+
54+
self_.type = type
55+
self_.value = value
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class TeamSyncSelectionStateExternalIdType(ModelSimple):
16+
"""
17+
The type of external identifier for the selection state item.
18+
For GitHub synchronization, the allowed values are `team` and
19+
`organization`.
20+
21+
:param value: Must be one of ["team", "organization"].
22+
:type value: str
23+
"""
24+
25+
allowed_values = {
26+
"team",
27+
"organization",
28+
}
29+
TEAM: ClassVar["TeamSyncSelectionStateExternalIdType"]
30+
ORGANIZATION: ClassVar["TeamSyncSelectionStateExternalIdType"]
31+
32+
@cached_property
33+
def openapi_types(_):
34+
return {
35+
"value": (str,),
36+
}
37+
38+
39+
TeamSyncSelectionStateExternalIdType.TEAM = TeamSyncSelectionStateExternalIdType("team")
40+
TeamSyncSelectionStateExternalIdType.ORGANIZATION = TeamSyncSelectionStateExternalIdType("organization")

0 commit comments

Comments
 (0)