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
98 changes: 92 additions & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68031,6 +68031,8 @@ components:
properties:
frequency:
$ref: '#/components/schemas/TeamSyncAttributesFrequency'
selection_state:
$ref: '#/components/schemas/TeamSyncAttributesSelectionState'
source:
$ref: '#/components/schemas/TeamSyncAttributesSource'
sync_membership:
Expand All @@ -68054,6 +68056,15 @@ components:
- ONCE
- CONTINUOUSLY
- PAUSED
TeamSyncAttributesSelectionState:
description: 'Specifies which teams or organizations to sync. When

provided, synchronization is limited to the specified

items and their subtrees.'
items:
$ref: '#/components/schemas/TeamSyncSelectionStateItem'
type: array
TeamSyncAttributesSource:
description: The external source platform for team synchronization. Only "github"
is supported.
Expand Down Expand Up @@ -68126,6 +68137,78 @@ components:
$ref: '#/components/schemas/TeamSyncData'
type: array
type: object
TeamSyncSelectionStateExternalId:
description: The external identifier for a team or organization in the source
platform.
properties:
type:
$ref: '#/components/schemas/TeamSyncSelectionStateExternalIdType'
value:
$ref: '#/components/schemas/TeamSyncSelectionStateExternalIdValue'
required:
- type
- value
type: object
TeamSyncSelectionStateExternalIdType:
description: 'The type of external identifier for the selection state item.

For GitHub synchronization, the allowed values are `team` and

`organization`.'
enum:
- team
- organization
example: team
type: string
x-enum-varnames:
- TEAM
- ORGANIZATION
TeamSyncSelectionStateExternalIdValue:
description: 'The external identifier value from the source

platform. For GitHub, this is the string

representation of a GitHub organization ID or team

ID.'
example: '1'
type: string
TeamSyncSelectionStateItem:
description: Identifies a team or organization hierarchy to include in synchronization.
properties:
external_id:
$ref: '#/components/schemas/TeamSyncSelectionStateExternalId'
operation:
$ref: '#/components/schemas/TeamSyncSelectionStateOperation'
scope:
$ref: '#/components/schemas/TeamSyncSelectionStateScope'
required:
- external_id
type: object
TeamSyncSelectionStateOperation:
description: 'The operation to perform on the selected hierarchy.

When set to `include`, synchronization covers the

referenced teams or organizations.'
enum:
- include
example: include
type: string
x-enum-varnames:
- INCLUDE
TeamSyncSelectionStateScope:
description: 'The scope of the selection. When set to `subtree`,

synchronization includes the referenced team or

organization and everything nested under it.'
enum:
- subtree
example: subtree
type: string
x-enum-varnames:
- SUBTREE
TeamTarget:
description: Represents a team target for an escalation policy step, including
the team's ID and resource type.
Expand Down Expand Up @@ -107597,12 +107680,6 @@ paths:
description: OK
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Team sync configurations not found
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
Expand Down Expand Up @@ -107634,6 +107711,13 @@ paths:
or created.


Optionally, provide `selection_state` to limit synchronization

to specific teams or organizations and their subtrees, instead

of syncing all teams.


[A GitHub organization must be connected to your Datadog account](https://docs.datadoghq.com/integrations/github/),

and the GitHub App integrated with Datadog must have the `Members Read` permission.
Expand All @@ -107655,6 +107739,8 @@ paths:
responses:
'200':
description: OK
'204':
description: No Content
'403':
$ref: '#/components/responses/ForbiddenResponse'
'429':
Expand Down
35 changes: 35 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29929,6 +29929,41 @@ datadog\_api\_client.v2.model.team\_sync\_response module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.team\_sync\_selection\_state\_external\_id module
-------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_external_id
:members:
:show-inheritance:

datadog\_api\_client.v2.model.team\_sync\_selection\_state\_external\_id\_type module
-------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_external_id_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.team\_sync\_selection\_state\_item module
-----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_item
:members:
:show-inheritance:

datadog\_api\_client.v2.model.team\_sync\_selection\_state\_operation module
----------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_operation
:members:
:show-inheritance:

datadog\_api\_client.v2.model.team\_sync\_selection\_state\_scope module
------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.team_sync_selection_state_scope
:members:
:show-inheritance:

datadog\_api\_client.v2.model.team\_target module
-------------------------------------------------

Expand Down
27 changes: 0 additions & 27 deletions examples/v2/teams/SyncTeams_3215592344.py

This file was deleted.

4 changes: 4 additions & 0 deletions src/datadog_api_client/v2/api/teams_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,10 @@ def sync_teams(

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

Optionally, provide ``selection_state`` to limit synchronization
to specific teams or organizations and their subtrees, instead
of syncing all teams.

`A GitHub organization must be connected to your Datadog account <https://docs.datadoghq.com/integrations/github/>`_ ,
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
using a normalized exact match; case is ignored and spaces are removed. No modifications are made
Expand Down
14 changes: 13 additions & 1 deletion src/datadog_api_client/v2/model/team_sync_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union, TYPE_CHECKING
from typing import List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
Expand All @@ -15,6 +15,7 @@

if TYPE_CHECKING:
from datadog_api_client.v2.model.team_sync_attributes_frequency import TeamSyncAttributesFrequency
from datadog_api_client.v2.model.team_sync_selection_state_item import TeamSyncSelectionStateItem
from datadog_api_client.v2.model.team_sync_attributes_source import TeamSyncAttributesSource
from datadog_api_client.v2.model.team_sync_attributes_type import TeamSyncAttributesType

Expand All @@ -23,18 +24,21 @@ class TeamSyncAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.team_sync_attributes_frequency import TeamSyncAttributesFrequency
from datadog_api_client.v2.model.team_sync_selection_state_item import TeamSyncSelectionStateItem
from datadog_api_client.v2.model.team_sync_attributes_source import TeamSyncAttributesSource
from datadog_api_client.v2.model.team_sync_attributes_type import TeamSyncAttributesType

return {
"frequency": (TeamSyncAttributesFrequency,),
"selection_state": ([TeamSyncSelectionStateItem],),
"source": (TeamSyncAttributesSource,),
"sync_membership": (bool,),
"type": (TeamSyncAttributesType,),
}

attribute_map = {
"frequency": "frequency",
"selection_state": "selection_state",
"source": "source",
"sync_membership": "sync_membership",
"type": "type",
Expand All @@ -45,6 +49,7 @@ def __init__(
source: TeamSyncAttributesSource,
type: TeamSyncAttributesType,
frequency: Union[TeamSyncAttributesFrequency, UnsetType] = unset,
selection_state: Union[List[TeamSyncSelectionStateItem], UnsetType] = unset,
sync_membership: Union[bool, UnsetType] = unset,
**kwargs,
):
Expand All @@ -54,6 +59,11 @@ def __init__(
:param frequency: How often the sync process should be run. Defaults to ``once`` when not provided.
:type frequency: TeamSyncAttributesFrequency, optional

:param selection_state: Specifies which teams or organizations to sync. When
provided, synchronization is limited to the specified
items and their subtrees.
:type selection_state: [TeamSyncSelectionStateItem], optional

:param source: The external source platform for team synchronization. Only "github" is supported.
:type source: TeamSyncAttributesSource

Expand All @@ -65,6 +75,8 @@ def __init__(
"""
if frequency is not unset:
kwargs["frequency"] = frequency
if selection_state is not unset:
kwargs["selection_state"] = selection_state
if sync_membership is not unset:
kwargs["sync_membership"] = sync_membership
super().__init__(kwargs)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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.team_sync_selection_state_external_id_type import (
TeamSyncSelectionStateExternalIdType,
)


class TeamSyncSelectionStateExternalId(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.team_sync_selection_state_external_id_type import (
TeamSyncSelectionStateExternalIdType,
)

return {
"type": (TeamSyncSelectionStateExternalIdType,),
"value": (str,),
}

attribute_map = {
"type": "type",
"value": "value",
}

def __init__(self_, type: TeamSyncSelectionStateExternalIdType, value: str, **kwargs):
"""
The external identifier for a team or organization in the source platform.

:param type: The type of external identifier for the selection state item.
For GitHub synchronization, the allowed values are ``team`` and
``organization``.
:type type: TeamSyncSelectionStateExternalIdType

:param value: The external identifier value from the source
platform. For GitHub, this is the string
representation of a GitHub organization ID or team
ID.
:type value: str
"""
super().__init__(kwargs)

self_.type = type
self_.value = value
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 datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class TeamSyncSelectionStateExternalIdType(ModelSimple):
"""
The type of external identifier for the selection state item.
For GitHub synchronization, the allowed values are `team` and
`organization`.

:param value: Must be one of ["team", "organization"].
:type value: str
"""

allowed_values = {
"team",
"organization",
}
TEAM: ClassVar["TeamSyncSelectionStateExternalIdType"]
ORGANIZATION: ClassVar["TeamSyncSelectionStateExternalIdType"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


TeamSyncSelectionStateExternalIdType.TEAM = TeamSyncSelectionStateExternalIdType("team")
TeamSyncSelectionStateExternalIdType.ORGANIZATION = TeamSyncSelectionStateExternalIdType("organization")
Loading
Loading