Skip to content

Commit 0f61819

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add documentation for /api/v2/team/sync (DataDog#3262)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent b5481f2 commit 0f61819

17 files changed

Lines changed: 975 additions & 47 deletions

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "b434599",
3-
"generated": "2025-08-13 22:17:28.678"
2+
"spec_repo_commit": "c38287b",
3+
"generated": "2025-08-15 18:55:16.469"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42824,6 +42824,68 @@ components:
4282442824
urgency:
4282542825
$ref: '#/components/schemas/Urgency'
4282642826
type: object
42827+
TeamSyncAttributes:
42828+
description: Team sync attributes.
42829+
properties:
42830+
source:
42831+
$ref: '#/components/schemas/TeamSyncAttributesSource'
42832+
type:
42833+
$ref: '#/components/schemas/TeamSyncAttributesType'
42834+
required:
42835+
- source
42836+
- type
42837+
type: object
42838+
TeamSyncAttributesSource:
42839+
description: The external source platform for team synchronization. Only "github"
42840+
is supported.
42841+
enum:
42842+
- github
42843+
example: github
42844+
type: string
42845+
x-enum-varnames:
42846+
- GITHUB
42847+
TeamSyncAttributesType:
42848+
description: The type of synchronization operation. Only "link" is supported,
42849+
which links existing teams by matching names.
42850+
enum:
42851+
- link
42852+
example: link
42853+
type: string
42854+
x-enum-varnames:
42855+
- LINK
42856+
TeamSyncBulkType:
42857+
description: Team sync bulk type.
42858+
enum:
42859+
- team_sync_bulk
42860+
example: team_sync_bulk
42861+
type: string
42862+
x-enum-varnames:
42863+
- TEAM_SYNC_BULK
42864+
TeamSyncData:
42865+
description: Team sync data.
42866+
properties:
42867+
attributes:
42868+
$ref: '#/components/schemas/TeamSyncAttributes'
42869+
type:
42870+
$ref: '#/components/schemas/TeamSyncBulkType'
42871+
required:
42872+
- attributes
42873+
- type
42874+
type: object
42875+
TeamSyncRequest:
42876+
description: Team sync request.
42877+
example:
42878+
data:
42879+
attributes:
42880+
source: github
42881+
type: link
42882+
type: team_sync_bulk
42883+
properties:
42884+
data:
42885+
$ref: '#/components/schemas/TeamSyncData'
42886+
required:
42887+
- data
42888+
type: object
4282742889
TeamTarget:
4282842890
description: Represents a team target for an escalation policy step, including
4282942891
the team's ID and resource type.
@@ -65913,6 +65975,71 @@ paths:
6591365975
permissions:
6591465976
- teams_read
6591565977
- teams_manage
65978+
/api/v2/team/sync:
65979+
post:
65980+
description: 'This endpoint attempts to link your existing Datadog teams with
65981+
GitHub teams by matching their names.
65982+
65983+
It evaluates all current Datadog teams and compares them against teams in
65984+
the GitHub organization
65985+
65986+
connected to your Datadog account, based on Datadog Team handle and GitHub
65987+
Team slug
65988+
65989+
(lowercased and kebab-cased).
65990+
65991+
65992+
This operation is read-only on the GitHub side, no teams will be modified
65993+
or created.
65994+
65995+
65996+
[A GitHub organization must be connected to your Datadog account](https://docs.datadoghq.com/integrations/github/),
65997+
65998+
and the GitHub App integrated with Datadog must have the `Members Read` permission.
65999+
Matching is performed by comparing the Datadog team handle to the GitHub team
66000+
slug
66001+
66002+
using a normalized exact match; case is ignored and spaces are removed. No
66003+
modifications are made
66004+
66005+
to teams in GitHub. This will not create new Teams in Datadog.'
66006+
operationId: SyncTeams
66007+
requestBody:
66008+
content:
66009+
application/json:
66010+
schema:
66011+
$ref: '#/components/schemas/TeamSyncRequest'
66012+
required: true
66013+
responses:
66014+
'200':
66015+
description: OK
66016+
'403':
66017+
$ref: '#/components/responses/ForbiddenResponse'
66018+
'429':
66019+
$ref: '#/components/responses/TooManyRequestsResponse'
66020+
'500':
66021+
content:
66022+
application/json:
66023+
schema:
66024+
$ref: '#/components/schemas/APIErrorResponse'
66025+
description: Internal Server Error - Unexpected error during linking.
66026+
security:
66027+
- apiKeyAuth: []
66028+
appKeyAuth: []
66029+
- AuthZ:
66030+
- teams_manage
66031+
summary: Link Teams with GitHub Teams
66032+
tags:
66033+
- Teams
66034+
x-codegen-request-body-name: body
66035+
x-permission:
66036+
operator: AND
66037+
permissions:
66038+
- teams_manage
66039+
x-unstable: '**Note**: This endpoint is in Preview. To request access, fill
66040+
out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/).
66041+
66042+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6591666043
/api/v2/team/{super_team_id}/member_teams:
6591766044
get:
6591866045
description: Get all member teams.

api/datadog/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ func NewConfiguration() *Configuration {
688688
"v2.AddMemberTeam": false,
689689
"v2.ListMemberTeams": false,
690690
"v2.RemoveMemberTeam": false,
691+
"v2.SyncTeams": false,
691692
"v2.CreateIncidentTeam": false,
692693
"v2.DeleteIncidentTeam": false,
693694
"v2.GetIncidentTeam": false,

api/datadogV2/api_teams.go

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,95 @@ func (a *TeamsApi) RemoveMemberTeam(ctx _context.Context, superTeamId string, me
16061606
return localVarHTTPResponse, nil
16071607
}
16081608

1609+
// SyncTeams Link Teams with GitHub Teams.
1610+
// This endpoint attempts to link your existing Datadog teams with GitHub teams by matching their names.
1611+
// It evaluates all current Datadog teams and compares them against teams in the GitHub organization
1612+
// connected to your Datadog account, based on Datadog Team handle and GitHub Team slug
1613+
// (lowercased and kebab-cased).
1614+
//
1615+
// This operation is read-only on the GitHub side, no teams will be modified or created.
1616+
//
1617+
// [A GitHub organization must be connected to your Datadog account](https://docs.datadoghq.com/integrations/github/),
1618+
// 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
1619+
// using a normalized exact match; case is ignored and spaces are removed. No modifications are made
1620+
// to teams in GitHub. This will not create new Teams in Datadog.
1621+
func (a *TeamsApi) SyncTeams(ctx _context.Context, body TeamSyncRequest) (*_nethttp.Response, error) {
1622+
var (
1623+
localVarHTTPMethod = _nethttp.MethodPost
1624+
localVarPostBody interface{}
1625+
)
1626+
1627+
operationId := "v2.SyncTeams"
1628+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
1629+
if !isOperationEnabled {
1630+
return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
1631+
}
1632+
if isOperationEnabled && a.Client.Cfg.Debug {
1633+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
1634+
}
1635+
1636+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.SyncTeams")
1637+
if err != nil {
1638+
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
1639+
}
1640+
1641+
localVarPath := localBasePath + "/api/v2/team/sync"
1642+
1643+
localVarHeaderParams := make(map[string]string)
1644+
localVarQueryParams := _neturl.Values{}
1645+
localVarFormParams := _neturl.Values{}
1646+
localVarHeaderParams["Content-Type"] = "application/json"
1647+
localVarHeaderParams["Accept"] = "*/*"
1648+
1649+
// body params
1650+
localVarPostBody = &body
1651+
if a.Client.Cfg.DelegatedTokenConfig != nil {
1652+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
1653+
if err != nil {
1654+
return nil, err
1655+
}
1656+
} else {
1657+
datadog.SetAuthKeys(
1658+
ctx,
1659+
&localVarHeaderParams,
1660+
[2]string{"apiKeyAuth", "DD-API-KEY"},
1661+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
1662+
)
1663+
}
1664+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
1665+
if err != nil {
1666+
return nil, err
1667+
}
1668+
1669+
localVarHTTPResponse, err := a.Client.CallAPI(req)
1670+
if err != nil || localVarHTTPResponse == nil {
1671+
return localVarHTTPResponse, err
1672+
}
1673+
1674+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
1675+
if err != nil {
1676+
return localVarHTTPResponse, err
1677+
}
1678+
1679+
if localVarHTTPResponse.StatusCode >= 300 {
1680+
newErr := datadog.GenericOpenAPIError{
1681+
ErrorBody: localVarBody,
1682+
ErrorMessage: localVarHTTPResponse.Status,
1683+
}
1684+
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 || localVarHTTPResponse.StatusCode == 500 {
1685+
var v APIErrorResponse
1686+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
1687+
if err != nil {
1688+
return localVarHTTPResponse, newErr
1689+
}
1690+
newErr.ErrorModel = v
1691+
}
1692+
return localVarHTTPResponse, newErr
1693+
}
1694+
1695+
return localVarHTTPResponse, nil
1696+
}
1697+
16091698
// UpdateTeam Update a team.
16101699
// Update a team using the team's `id`.
16111700
// If the `team_links` relationship is present, the associated links are updated to be in the order they appear in the array, and any existing team links not present are removed.

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@
508508
// - [TeamsApi.ListMemberTeams]
509509
// - [TeamsApi.ListTeams]
510510
// - [TeamsApi.RemoveMemberTeam]
511+
// - [TeamsApi.SyncTeams]
511512
// - [TeamsApi.UpdateTeam]
512513
// - [TeamsApi.UpdateTeamLink]
513514
// - [TeamsApi.UpdateTeamMembership]

0 commit comments

Comments
 (0)