diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 642bfd7423b..2b877f268dc 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -52263,14 +52263,31 @@ components: TeamSyncAttributes: description: Team sync attributes. properties: + frequency: + $ref: '#/components/schemas/TeamSyncAttributesFrequency' source: $ref: '#/components/schemas/TeamSyncAttributesSource' + sync_membership: + $ref: '#/components/schemas/TeamSyncAttributesSyncMembership' type: $ref: '#/components/schemas/TeamSyncAttributesType' required: - source - type type: object + TeamSyncAttributesFrequency: + description: How often the sync process should be run. Defaults to `once` when + not provided. + enum: + - once + - continuously + - paused + example: once + type: string + x-enum-varnames: + - ONCE + - CONTINUOUSLY + - PAUSED TeamSyncAttributesSource: description: The external source platform for team synchronization. Only "github" is supported. @@ -52280,15 +52297,22 @@ components: type: string x-enum-varnames: - GITHUB + TeamSyncAttributesSyncMembership: + description: Whether to sync members from the external team to the Datadog team. + Defaults to `false` when not provided. + example: true + type: boolean TeamSyncAttributesType: - description: The type of synchronization operation. Only "link" is supported, - which links existing teams by matching names. + description: The type of synchronization operation. "link" connects teams by + matching names. "provision" creates new teams when no match is found. enum: - link + - provision example: link type: string x-enum-varnames: - LINK + - PROVISION TeamSyncBulkType: description: Team sync bulk type. enum: @@ -52298,10 +52322,15 @@ components: x-enum-varnames: - TEAM_SYNC_BULK TeamSyncData: - description: Team sync data. + description: A configuration governing syncing between Datadog teams and teams + from an external system. properties: attributes: $ref: '#/components/schemas/TeamSyncAttributes' + id: + description: The sync's identifier + example: aeadc05e-98a8-11ec-ac2c-da7ad0900001 + type: string type: $ref: '#/components/schemas/TeamSyncBulkType' required: @@ -52322,6 +52351,15 @@ components: required: - data type: object + TeamSyncResponse: + description: Team sync configurations response. + properties: + data: + description: List of team sync configurations + items: + $ref: '#/components/schemas/TeamSyncData' + type: array + type: object TeamTarget: description: Represents a team target for an escalation policy step, including the team's ID and resource type. @@ -81182,6 +81220,52 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/sync: + get: + description: 'Get all team synchronization configurations. + + Returns a list of configurations used for linking or provisioning teams with + external sources like GitHub.' + operationId: GetTeamSync + parameters: + - description: Filter by the external source platform for team synchronization + in: query + name: filter[source] + required: true + schema: + $ref: '#/components/schemas/TeamSyncAttributesSource' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamSyncResponse' + 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: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get team sync configurations + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: '**Note**: This endpoint is in Preview. To request access, fill + out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/). + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' post: description: 'This endpoint attempts to link your existing Datadog teams with GitHub teams by matching their names. @@ -81208,7 +81292,8 @@ paths: using a normalized exact match; case is ignored and spaces are removed. No modifications are made - to teams in GitHub. This will not create new Teams in Datadog.' + to teams in GitHub. This only creates new teams in Datadog when type is set + to `provision`.' operationId: SyncTeams requestBody: content: diff --git a/examples/v2/teams/GetTeamSync.java b/examples/v2/teams/GetTeamSync.java new file mode 100644 index 00000000000..731f7dd3ea2 --- /dev/null +++ b/examples/v2/teams/GetTeamSync.java @@ -0,0 +1,26 @@ +// Get team sync configurations returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.model.TeamSyncAttributesSource; +import com.datadog.api.client.v2.model.TeamSyncResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getTeamSync", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + try { + TeamSyncResponse result = apiInstance.getTeamSync(TeamSyncAttributesSource.GITHUB); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamSync"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 68903e5ee1f..93bdb2a4322 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -812,6 +812,7 @@ public class ApiClient { put("v2.createSCAResolveVulnerableSymbols", false); put("v2.createSCAResult", false); put("v2.addMemberTeam", false); + put("v2.getTeamSync", false); put("v2.listMemberTeams", false); put("v2.removeMemberTeam", false); put("v2.syncTeams", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java b/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java index 77b7658f0b5..7d887905321 100644 --- a/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java @@ -18,7 +18,9 @@ import com.datadog.api.client.v2.model.TeamPermissionSettingUpdateRequest; import com.datadog.api.client.v2.model.TeamPermissionSettingsResponse; import com.datadog.api.client.v2.model.TeamResponse; +import com.datadog.api.client.v2.model.TeamSyncAttributesSource; import com.datadog.api.client.v2.model.TeamSyncRequest; +import com.datadog.api.client.v2.model.TeamSyncResponse; import com.datadog.api.client.v2.model.TeamUpdateRequest; import com.datadog.api.client.v2.model.TeamsField; import com.datadog.api.client.v2.model.TeamsResponse; @@ -1987,6 +1989,162 @@ public ApiResponse getTeamPermissionSettingsWith new GenericType() {}); } + /** + * Get team sync configurations. + * + *

See {@link #getTeamSyncWithHttpInfo}. + * + * @param filterSource Filter by the external source platform for team synchronization (required) + * @return TeamSyncResponse + * @throws ApiException if fails to make API call + */ + public TeamSyncResponse getTeamSync(TeamSyncAttributesSource filterSource) throws ApiException { + return getTeamSyncWithHttpInfo(filterSource).getData(); + } + + /** + * Get team sync configurations. + * + *

See {@link #getTeamSyncWithHttpInfoAsync}. + * + * @param filterSource Filter by the external source platform for team synchronization (required) + * @return CompletableFuture<TeamSyncResponse> + */ + public CompletableFuture getTeamSyncAsync( + TeamSyncAttributesSource filterSource) { + return getTeamSyncWithHttpInfoAsync(filterSource) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all team synchronization configurations. Returns a list of configurations used for linking + * or provisioning teams with external sources like GitHub. + * + * @param filterSource Filter by the external source platform for team synchronization (required) + * @return ApiResponse<TeamSyncResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Team sync configurations not found -
429 Too many requests -
+ */ + public ApiResponse getTeamSyncWithHttpInfo( + TeamSyncAttributesSource filterSource) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getTeamSync"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'filterSource' is set + if (filterSource == null) { + throw new ApiException( + 400, "Missing the required parameter 'filterSource' when calling getTeamSync"); + } + // create path and map variables + String localVarPath = "/api/v2/team/sync"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[source]", filterSource)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.getTeamSync", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get team sync configurations. + * + *

See {@link #getTeamSyncWithHttpInfo}. + * + * @param filterSource Filter by the external source platform for team synchronization (required) + * @return CompletableFuture<ApiResponse<TeamSyncResponse>> + */ + public CompletableFuture> getTeamSyncWithHttpInfoAsync( + TeamSyncAttributesSource filterSource) { + // Check if unstable operation is enabled + String operationId = "getTeamSync"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'filterSource' is set + if (filterSource == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'filterSource' when calling getTeamSync")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/team/sync"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[source]", filterSource)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.getTeamSync", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Get user memberships. * @@ -2958,8 +3116,8 @@ public CompletableFuture syncTeamsAsync(TeamSyncRequest body) { * connected to your Datadog account, 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 to teams in GitHub. This will not create new Teams in - * Datadog. + * removed. No modifications are made to teams in GitHub. This only creates new teams in Datadog + * when type is set to provision. * * @param body (required) * @return ApiResponse<Void> diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributes.java index 8724fdf1191..54697890ee4 100644 --- a/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributes.java @@ -18,14 +18,25 @@ import java.util.Objects; /** Team sync attributes. */ -@JsonPropertyOrder({TeamSyncAttributes.JSON_PROPERTY_SOURCE, TeamSyncAttributes.JSON_PROPERTY_TYPE}) +@JsonPropertyOrder({ + TeamSyncAttributes.JSON_PROPERTY_FREQUENCY, + TeamSyncAttributes.JSON_PROPERTY_SOURCE, + TeamSyncAttributes.JSON_PROPERTY_SYNC_MEMBERSHIP, + TeamSyncAttributes.JSON_PROPERTY_TYPE +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class TeamSyncAttributes { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FREQUENCY = "frequency"; + private TeamSyncAttributesFrequency frequency; + public static final String JSON_PROPERTY_SOURCE = "source"; private TeamSyncAttributesSource source; + public static final String JSON_PROPERTY_SYNC_MEMBERSHIP = "sync_membership"; + private Boolean syncMembership; + public static final String JSON_PROPERTY_TYPE = "type"; private TeamSyncAttributesType type; @@ -41,6 +52,31 @@ public TeamSyncAttributes( this.unparsed |= !type.isValid(); } + public TeamSyncAttributes frequency(TeamSyncAttributesFrequency frequency) { + this.frequency = frequency; + this.unparsed |= !frequency.isValid(); + return this; + } + + /** + * How often the sync process should be run. Defaults to once when not provided. + * + * @return frequency + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FREQUENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamSyncAttributesFrequency getFrequency() { + return frequency; + } + + public void setFrequency(TeamSyncAttributesFrequency frequency) { + if (!frequency.isValid()) { + this.unparsed = true; + } + this.frequency = frequency; + } + public TeamSyncAttributes source(TeamSyncAttributesSource source) { this.source = source; this.unparsed |= !source.isValid(); @@ -65,6 +101,28 @@ public void setSource(TeamSyncAttributesSource source) { this.source = source; } + public TeamSyncAttributes syncMembership(Boolean syncMembership) { + this.syncMembership = syncMembership; + return this; + } + + /** + * Whether to sync members from the external team to the Datadog team. Defaults to false + * when not provided. + * + * @return syncMembership + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SYNC_MEMBERSHIP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getSyncMembership() { + return syncMembership; + } + + public void setSyncMembership(Boolean syncMembership) { + this.syncMembership = syncMembership; + } + public TeamSyncAttributes type(TeamSyncAttributesType type) { this.type = type; this.unparsed |= !type.isValid(); @@ -72,8 +130,8 @@ public TeamSyncAttributes type(TeamSyncAttributesType type) { } /** - * The type of synchronization operation. Only "link" is supported, which links existing teams by - * matching names. + * The type of synchronization operation. "link" connects teams by matching names. "provision" + * creates new teams when no match is found. * * @return type */ @@ -146,21 +204,25 @@ public boolean equals(Object o) { return false; } TeamSyncAttributes teamSyncAttributes = (TeamSyncAttributes) o; - return Objects.equals(this.source, teamSyncAttributes.source) + return Objects.equals(this.frequency, teamSyncAttributes.frequency) + && Objects.equals(this.source, teamSyncAttributes.source) + && Objects.equals(this.syncMembership, teamSyncAttributes.syncMembership) && Objects.equals(this.type, teamSyncAttributes.type) && Objects.equals(this.additionalProperties, teamSyncAttributes.additionalProperties); } @Override public int hashCode() { - return Objects.hash(source, type, additionalProperties); + return Objects.hash(frequency, source, syncMembership, type, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TeamSyncAttributes {\n"); + sb.append(" frequency: ").append(toIndentedString(frequency)).append("\n"); sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" syncMembership: ").append(toIndentedString(syncMembership)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributesFrequency.java b/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributesFrequency.java new file mode 100644 index 00000000000..cfd529e5324 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributesFrequency.java @@ -0,0 +1,60 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** How often the sync process should be run. Defaults to once when not provided. */ +@JsonSerialize(using = TeamSyncAttributesFrequency.TeamSyncAttributesFrequencySerializer.class) +public class TeamSyncAttributesFrequency extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("once", "continuously", "paused")); + + public static final TeamSyncAttributesFrequency ONCE = new TeamSyncAttributesFrequency("once"); + public static final TeamSyncAttributesFrequency CONTINUOUSLY = + new TeamSyncAttributesFrequency("continuously"); + public static final TeamSyncAttributesFrequency PAUSED = + new TeamSyncAttributesFrequency("paused"); + + TeamSyncAttributesFrequency(String value) { + super(value, allowedValues); + } + + public static class TeamSyncAttributesFrequencySerializer + extends StdSerializer { + public TeamSyncAttributesFrequencySerializer(Class t) { + super(t); + } + + public TeamSyncAttributesFrequencySerializer() { + this(null); + } + + @Override + public void serialize( + TeamSyncAttributesFrequency value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamSyncAttributesFrequency fromValue(String value) { + return new TeamSyncAttributesFrequency(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributesType.java b/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributesType.java index cb25445c793..2e532c9ee32 100644 --- a/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributesType.java +++ b/src/main/java/com/datadog/api/client/v2/model/TeamSyncAttributesType.java @@ -19,15 +19,17 @@ import java.util.Set; /** - * The type of synchronization operation. Only "link" is supported, which links existing teams by - * matching names. + * The type of synchronization operation. "link" connects teams by matching names. "provision" + * creates new teams when no match is found. */ @JsonSerialize(using = TeamSyncAttributesType.TeamSyncAttributesTypeSerializer.class) public class TeamSyncAttributesType extends ModelEnum { - private static final Set allowedValues = new HashSet(Arrays.asList("link")); + private static final Set allowedValues = + new HashSet(Arrays.asList("link", "provision")); public static final TeamSyncAttributesType LINK = new TeamSyncAttributesType("link"); + public static final TeamSyncAttributesType PROVISION = new TeamSyncAttributesType("provision"); TeamSyncAttributesType(String value) { super(value, allowedValues); diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamSyncData.java b/src/main/java/com/datadog/api/client/v2/model/TeamSyncData.java index ef2299eb194..b3b09de1f15 100644 --- a/src/main/java/com/datadog/api/client/v2/model/TeamSyncData.java +++ b/src/main/java/com/datadog/api/client/v2/model/TeamSyncData.java @@ -17,8 +17,12 @@ import java.util.Map; import java.util.Objects; -/** Team sync data. */ -@JsonPropertyOrder({TeamSyncData.JSON_PROPERTY_ATTRIBUTES, TeamSyncData.JSON_PROPERTY_TYPE}) +/** A configuration governing syncing between Datadog teams and teams from an external system. */ +@JsonPropertyOrder({ + TeamSyncData.JSON_PROPERTY_ATTRIBUTES, + TeamSyncData.JSON_PROPERTY_ID, + TeamSyncData.JSON_PROPERTY_TYPE +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class TeamSyncData { @@ -26,6 +30,9 @@ public class TeamSyncData { public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; private TeamSyncAttributes attributes; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + public static final String JSON_PROPERTY_TYPE = "type"; private TeamSyncBulkType type; @@ -63,6 +70,27 @@ public void setAttributes(TeamSyncAttributes attributes) { this.attributes = attributes; } + public TeamSyncData id(String id) { + this.id = id; + return this; + } + + /** + * The sync's identifier + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public TeamSyncData type(TeamSyncBulkType type) { this.type = type; this.unparsed |= !type.isValid(); @@ -144,13 +172,14 @@ public boolean equals(Object o) { } TeamSyncData teamSyncData = (TeamSyncData) o; return Objects.equals(this.attributes, teamSyncData.attributes) + && Objects.equals(this.id, teamSyncData.id) && Objects.equals(this.type, teamSyncData.type) && Objects.equals(this.additionalProperties, teamSyncData.additionalProperties); } @Override public int hashCode() { - return Objects.hash(attributes, type, additionalProperties); + return Objects.hash(attributes, id, type, additionalProperties); } @Override @@ -158,6 +187,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TeamSyncData {\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamSyncRequest.java b/src/main/java/com/datadog/api/client/v2/model/TeamSyncRequest.java index a7580825ba6..d681473eda0 100644 --- a/src/main/java/com/datadog/api/client/v2/model/TeamSyncRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/TeamSyncRequest.java @@ -42,7 +42,7 @@ public TeamSyncRequest data(TeamSyncData data) { } /** - * Team sync data. + * A configuration governing syncing between Datadog teams and teams from an external system. * * @return data */ diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamSyncResponse.java b/src/main/java/com/datadog/api/client/v2/model/TeamSyncResponse.java new file mode 100644 index 00000000000..6fb54c3ca80 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamSyncResponse.java @@ -0,0 +1,149 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Team sync configurations response. */ +@JsonPropertyOrder({TeamSyncResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamSyncResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public TeamSyncResponse data(List data) { + this.data = data; + for (TeamSyncData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamSyncResponse addDataItem(TeamSyncData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of team sync configurations + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TeamSyncResponse + */ + @JsonAnySetter + public TeamSyncResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this TeamSyncResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamSyncResponse teamSyncResponse = (TeamSyncResponse) o; + return Objects.equals(this.data, teamSyncResponse.data) + && Objects.equals(this.additionalProperties, teamSyncResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamSyncResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/teams.feature b/src/test/resources/com/datadog/api/client/v2/api/teams.feature index 5ba9294a164..bf11bd0316d 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/teams.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/teams.feature @@ -235,6 +235,22 @@ Feature: Teams Then the response status is 200 OK And the response has 3 items + @generated @skip @team:DataDog/aaa-omg + Scenario: Get team sync configurations returns "OK" response + Given operation "GetTeamSync" enabled + And new "GetTeamSync" request + And request contains "filter[source]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get team sync configurations returns "Team sync configurations not found" response + Given operation "GetTeamSync" enabled + And new "GetTeamSync" request + And request contains "filter[source]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Team sync configurations not found + @generated @skip @team:DataDog/aaa-omg Scenario: Get user memberships returns "API error response." response Given new "GetUserMemberships" request diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index d25ca0a4dba..dba9a5e29d7 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -4287,6 +4287,12 @@ "type": "unsafe" } }, + "GetTeamSync": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, "SyncTeams": { "tag": "Teams", "undo": {