Skip to content

Commit 09fe883

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

15 files changed

+766
-78
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":

examples/v2/teams/SyncTeams_3215592344.java

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

src/main/java/com/datadog/api/client/v2/api/TeamsApi.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,7 +3211,6 @@ public CompletableFuture<TeamSyncResponse> getTeamSyncAsync(
32113211
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
32123212
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
32133213
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
3214-
* <tr><td> 404 </td><td> Team sync configurations not found </td><td> - </td></tr>
32153214
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
32163215
* </table>
32173216
*/
@@ -5019,13 +5018,16 @@ public CompletableFuture<Void> syncTeamsAsync(TeamSyncRequest body) {
50195018
}
50205019

50215020
/**
5022-
* This endpoint attempts to link your existing Datadog teams with GitHub teams by matching their
5023-
* names. It evaluates all current Datadog teams and compares them against teams in the GitHub
5024-
* organization connected to your Datadog account, based on Datadog Team handle and GitHub Team
5025-
* slug (lowercased and kebab-cased).
5021+
* This endpoint configures synchronization between your existing Datadog teams and GitHub teams
5022+
* by matching their names. It evaluates all current Datadog teams and compares them against teams
5023+
* in the GitHub organization connected to your Datadog account, based on Datadog Team handle and
5024+
* GitHub Team slug (lowercased and kebab-cased).
50265025
*
50275026
* <p>This operation is read-only on the GitHub side, no teams will be modified or created.
50285027
*
5028+
* <p>Optionally, provide <code>selection_state</code> to limit synchronization to specific teams
5029+
* or organizations and their subtrees, instead of syncing all teams.
5030+
*
50295031
* <p><a href="https://docs.datadoghq.com/integrations/github/">A GitHub organization must be
50305032
* connected to your Datadog account</a>, and the GitHub App integrated with Datadog must have the
50315033
* <code>Members Read</code> permission. Matching is performed by comparing the Datadog team
@@ -5041,6 +5043,7 @@ public CompletableFuture<Void> syncTeamsAsync(TeamSyncRequest body) {
50415043
* <caption>Response details</caption>
50425044
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
50435045
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
5046+
* <tr><td> 204 </td><td> No Content </td><td> - </td></tr>
50445047
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
50455048
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
50465049
* <tr><td> 500 </td><td> Internal Server Error - Unexpected error during linking. </td><td> - </td></tr>

src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributes.java

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
import com.fasterxml.jackson.annotation.JsonInclude;
1414
import com.fasterxml.jackson.annotation.JsonProperty;
1515
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
16+
import java.util.ArrayList;
1617
import java.util.HashMap;
18+
import java.util.List;
1719
import java.util.Map;
1820
import java.util.Objects;
1921

2022
/** Team sync attributes. */
2123
@JsonPropertyOrder({
2224
TeamSyncAttributes.JSON_PROPERTY_FREQUENCY,
25+
TeamSyncAttributes.JSON_PROPERTY_SELECTION_STATE,
2326
TeamSyncAttributes.JSON_PROPERTY_SOURCE,
2427
TeamSyncAttributes.JSON_PROPERTY_SYNC_MEMBERSHIP,
2528
TeamSyncAttributes.JSON_PROPERTY_TYPE
@@ -31,11 +34,14 @@ public class TeamSyncAttributes {
3134
public static final String JSON_PROPERTY_FREQUENCY = "frequency";
3235
private TeamSyncAttributesFrequency frequency;
3336

37+
public static final String JSON_PROPERTY_SELECTION_STATE = "selection_state";
38+
private List<TeamSyncSelectionStateItem> selectionState = null;
39+
3440
public static final String JSON_PROPERTY_SOURCE = "source";
3541
private TeamSyncAttributesSource source;
3642

3743
public static final String JSON_PROPERTY_SYNC_MEMBERSHIP = "sync_membership";
38-
private Boolean syncMembership;
44+
private Boolean syncMembership = false;
3945

4046
public static final String JSON_PROPERTY_TYPE = "type";
4147
private TeamSyncAttributesType type;
@@ -77,6 +83,40 @@ public void setFrequency(TeamSyncAttributesFrequency frequency) {
7783
this.frequency = frequency;
7884
}
7985

86+
public TeamSyncAttributes selectionState(List<TeamSyncSelectionStateItem> selectionState) {
87+
this.selectionState = selectionState;
88+
for (TeamSyncSelectionStateItem item : selectionState) {
89+
this.unparsed |= item.unparsed;
90+
}
91+
return this;
92+
}
93+
94+
public TeamSyncAttributes addSelectionStateItem(TeamSyncSelectionStateItem selectionStateItem) {
95+
if (this.selectionState == null) {
96+
this.selectionState = new ArrayList<>();
97+
}
98+
this.selectionState.add(selectionStateItem);
99+
this.unparsed |= selectionStateItem.unparsed;
100+
return this;
101+
}
102+
103+
/**
104+
* Specifies which teams or organizations to sync. When provided, synchronization is limited to
105+
* the specified items and their subtrees.
106+
*
107+
* @return selectionState
108+
*/
109+
@jakarta.annotation.Nullable
110+
@JsonProperty(JSON_PROPERTY_SELECTION_STATE)
111+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
112+
public List<TeamSyncSelectionStateItem> getSelectionState() {
113+
return selectionState;
114+
}
115+
116+
public void setSelectionState(List<TeamSyncSelectionStateItem> selectionState) {
117+
this.selectionState = selectionState;
118+
}
119+
80120
public TeamSyncAttributes source(TeamSyncAttributesSource source) {
81121
this.source = source;
82122
this.unparsed |= !source.isValid();
@@ -205,6 +245,7 @@ public boolean equals(Object o) {
205245
}
206246
TeamSyncAttributes teamSyncAttributes = (TeamSyncAttributes) o;
207247
return Objects.equals(this.frequency, teamSyncAttributes.frequency)
248+
&& Objects.equals(this.selectionState, teamSyncAttributes.selectionState)
208249
&& Objects.equals(this.source, teamSyncAttributes.source)
209250
&& Objects.equals(this.syncMembership, teamSyncAttributes.syncMembership)
210251
&& Objects.equals(this.type, teamSyncAttributes.type)
@@ -213,14 +254,16 @@ public boolean equals(Object o) {
213254

214255
@Override
215256
public int hashCode() {
216-
return Objects.hash(frequency, source, syncMembership, type, additionalProperties);
257+
return Objects.hash(
258+
frequency, selectionState, source, syncMembership, type, additionalProperties);
217259
}
218260

219261
@Override
220262
public String toString() {
221263
StringBuilder sb = new StringBuilder();
222264
sb.append("class TeamSyncAttributes {\n");
223265
sb.append(" frequency: ").append(toIndentedString(frequency)).append("\n");
266+
sb.append(" selectionState: ").append(toIndentedString(selectionState)).append("\n");
224267
sb.append(" source: ").append(toIndentedString(source)).append("\n");
225268
sb.append(" syncMembership: ").append(toIndentedString(syncMembership)).append("\n");
226269
sb.append(" type: ").append(toIndentedString(type)).append("\n");

0 commit comments

Comments
 (0)