From e8ea24b585f06759ed8231baa4c904225dc8c479 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 3 Dec 2025 15:33:05 +0000 Subject: [PATCH] Regenerate client from commit 4602cff of spec repo --- .generator/schemas/v2/openapi.yaml | 9 +- .../CreateTeamConnections.java | 6 +- .../DeleteTeamConnections.java | 6 +- .../ListTeamConnections.java | 6 +- .../ListTeamConnections_1473516764.java | 8 +- .../ListTeamConnections_2418873869.java | 7 +- .../com/datadog/api/client/ApiClient.java | 6 +- .../api/client/v2/api/TeamConnectionsApi.java | 679 ------------------ .../datadog/api/client/v2/api/TeamsApi.java | 632 ++++++++++++++++ .../com/datadog/api/client/v2/api/given.json | 2 +- .../client/v2/api/team_connections.feature | 93 --- .../datadog/api/client/v2/api/teams.feature | 84 +++ .../com/datadog/api/client/v2/api/undo.json | 6 +- 13 files changed, 742 insertions(+), 802 deletions(-) rename examples/v2/{team-connections => teams}/CreateTeamConnections.java (92%) rename examples/v2/{team-connections => teams}/DeleteTeamConnections.java (84%) rename examples/v2/{team-connections => teams}/ListTeamConnections.java (77%) rename examples/v2/{team-connections => teams}/ListTeamConnections_1473516764.java (75%) rename examples/v2/{team-connections => teams}/ListTeamConnections_2418873869.java (75%) delete mode 100644 src/main/java/com/datadog/api/client/v2/api/TeamConnectionsApi.java delete mode 100644 src/test/resources/com/datadog/api/client/v2/api/team_connections.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 05ce562f5e2..5f8d776278f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -83879,7 +83879,7 @@ paths: - teams_read summary: Delete team connections tags: - - Team Connections + - Teams x-permission: operator: OR permissions: @@ -83958,7 +83958,7 @@ paths: - teams_read summary: List team connections tags: - - Team Connections + - Teams x-pagination: limitParam: page[size] pageParam: page[number] @@ -84002,7 +84002,7 @@ paths: - teams_read summary: Create team connections tags: - - Team Connections + - Teams x-permission: operator: OR permissions: @@ -87323,9 +87323,6 @@ tags: use Datadog\u2019s API to\nmanage both test types programmatically.\n\nFor more information about Synthetics, see the [Synthetics overview](https://docs.datadoghq.com/synthetics/)." name: Synthetics -- description: View and manage relationships between Datadog teams and teams from - external sources, such as GitHub. - name: Team Connections - description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information. name: Teams diff --git a/examples/v2/team-connections/CreateTeamConnections.java b/examples/v2/teams/CreateTeamConnections.java similarity index 92% rename from examples/v2/team-connections/CreateTeamConnections.java rename to examples/v2/teams/CreateTeamConnections.java index 10005f510ae..95e06e2bbfb 100644 --- a/examples/v2/team-connections/CreateTeamConnections.java +++ b/examples/v2/teams/CreateTeamConnections.java @@ -2,7 +2,7 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.TeamConnectionsApi; +import com.datadog.api.client.v2.api.TeamsApi; import com.datadog.api.client.v2.model.ConnectedTeamRef; import com.datadog.api.client.v2.model.ConnectedTeamRefData; import com.datadog.api.client.v2.model.ConnectedTeamRefDataType; @@ -21,7 +21,7 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.createTeamConnections", true); - TeamConnectionsApi apiInstance = new TeamConnectionsApi(defaultClient); + TeamsApi apiInstance = new TeamsApi(defaultClient); // there is a valid "dd_team" in the system String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); @@ -53,7 +53,7 @@ public static void main(String[] args) { TeamConnectionsResponse result = apiInstance.createTeamConnections(body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling TeamConnectionsApi#createTeamConnections"); + System.err.println("Exception when calling TeamsApi#createTeamConnections"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/team-connections/DeleteTeamConnections.java b/examples/v2/teams/DeleteTeamConnections.java similarity index 84% rename from examples/v2/team-connections/DeleteTeamConnections.java rename to examples/v2/teams/DeleteTeamConnections.java index b025218baea..3a67286fa03 100644 --- a/examples/v2/team-connections/DeleteTeamConnections.java +++ b/examples/v2/teams/DeleteTeamConnections.java @@ -2,7 +2,7 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.TeamConnectionsApi; +import com.datadog.api.client.v2.api.TeamsApi; import com.datadog.api.client.v2.model.TeamConnectionDeleteRequest; import com.datadog.api.client.v2.model.TeamConnectionDeleteRequestDataItem; import com.datadog.api.client.v2.model.TeamConnectionType; @@ -12,7 +12,7 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.deleteTeamConnections", true); - TeamConnectionsApi apiInstance = new TeamConnectionsApi(defaultClient); + TeamsApi apiInstance = new TeamsApi(defaultClient); TeamConnectionDeleteRequest body = new TeamConnectionDeleteRequest() @@ -25,7 +25,7 @@ public static void main(String[] args) { try { apiInstance.deleteTeamConnections(body); } catch (ApiException e) { - System.err.println("Exception when calling TeamConnectionsApi#deleteTeamConnections"); + System.err.println("Exception when calling TeamsApi#deleteTeamConnections"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/team-connections/ListTeamConnections.java b/examples/v2/teams/ListTeamConnections.java similarity index 77% rename from examples/v2/team-connections/ListTeamConnections.java rename to examples/v2/teams/ListTeamConnections.java index 0dc57217411..9336f55c0a2 100644 --- a/examples/v2/team-connections/ListTeamConnections.java +++ b/examples/v2/teams/ListTeamConnections.java @@ -2,20 +2,20 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.TeamConnectionsApi; +import com.datadog.api.client.v2.api.TeamsApi; import com.datadog.api.client.v2.model.TeamConnectionsResponse; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.listTeamConnections", true); - TeamConnectionsApi apiInstance = new TeamConnectionsApi(defaultClient); + TeamsApi apiInstance = new TeamsApi(defaultClient); try { TeamConnectionsResponse result = apiInstance.listTeamConnections(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling TeamConnectionsApi#listTeamConnections"); + System.err.println("Exception when calling TeamsApi#listTeamConnections"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/team-connections/ListTeamConnections_1473516764.java b/examples/v2/teams/ListTeamConnections_1473516764.java similarity index 75% rename from examples/v2/team-connections/ListTeamConnections_1473516764.java rename to examples/v2/teams/ListTeamConnections_1473516764.java index 747fb180a95..86966c150fd 100644 --- a/examples/v2/team-connections/ListTeamConnections_1473516764.java +++ b/examples/v2/teams/ListTeamConnections_1473516764.java @@ -2,8 +2,8 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.TeamConnectionsApi; -import com.datadog.api.client.v2.api.TeamConnectionsApi.ListTeamConnectionsOptionalParameters; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.ListTeamConnectionsOptionalParameters; import com.datadog.api.client.v2.model.TeamConnectionsResponse; import java.util.Collections; @@ -11,7 +11,7 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.listTeamConnections", true); - TeamConnectionsApi apiInstance = new TeamConnectionsApi(defaultClient); + TeamsApi apiInstance = new TeamsApi(defaultClient); try { TeamConnectionsResponse result = @@ -21,7 +21,7 @@ public static void main(String[] args) { .pageSize(10L)); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling TeamConnectionsApi#listTeamConnections"); + System.err.println("Exception when calling TeamsApi#listTeamConnections"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/team-connections/ListTeamConnections_2418873869.java b/examples/v2/teams/ListTeamConnections_2418873869.java similarity index 75% rename from examples/v2/team-connections/ListTeamConnections_2418873869.java rename to examples/v2/teams/ListTeamConnections_2418873869.java index 616c8e5f689..d3b04e3ecab 100644 --- a/examples/v2/team-connections/ListTeamConnections_2418873869.java +++ b/examples/v2/teams/ListTeamConnections_2418873869.java @@ -2,14 +2,14 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.PaginationIterable; -import com.datadog.api.client.v2.api.TeamConnectionsApi; +import com.datadog.api.client.v2.api.TeamsApi; import com.datadog.api.client.v2.model.TeamConnection; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.listTeamConnections", true); - TeamConnectionsApi apiInstance = new TeamConnectionsApi(defaultClient); + TeamsApi apiInstance = new TeamsApi(defaultClient); try { PaginationIterable iterable = apiInstance.listTeamConnectionsWithPagination(); @@ -18,8 +18,7 @@ public static void main(String[] args) { System.out.println(item); } } catch (RuntimeException e) { - System.err.println( - "Exception when calling TeamConnectionsApi#listTeamConnectionsWithPagination"); + System.err.println("Exception when calling TeamsApi#listTeamConnectionsWithPagination"); System.err.println("Reason: " + e.getMessage()); 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 0544b80c31c..5610aacb75f 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -831,13 +831,13 @@ public class ApiClient { put("v2.createSCAResolveVulnerableSymbols", false); put("v2.createSCAResult", false); put("v2.addMemberTeam", false); + put("v2.createTeamConnections", false); + put("v2.deleteTeamConnections", false); put("v2.getTeamSync", false); put("v2.listMemberTeams", false); + put("v2.listTeamConnections", false); put("v2.removeMemberTeam", false); put("v2.syncTeams", false); - put("v2.createTeamConnections", false); - put("v2.deleteTeamConnections", false); - put("v2.listTeamConnections", false); put("v2.createIncidentTeam", false); put("v2.deleteIncidentTeam", false); put("v2.getIncidentTeam", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/TeamConnectionsApi.java b/src/main/java/com/datadog/api/client/v2/api/TeamConnectionsApi.java deleted file mode 100644 index 84cd0509b2b..00000000000 --- a/src/main/java/com/datadog/api/client/v2/api/TeamConnectionsApi.java +++ /dev/null @@ -1,679 +0,0 @@ -package com.datadog.api.client.v2.api; - -import com.datadog.api.client.ApiClient; -import com.datadog.api.client.ApiException; -import com.datadog.api.client.ApiResponse; -import com.datadog.api.client.PaginationIterable; -import com.datadog.api.client.Pair; -import com.datadog.api.client.v2.model.TeamConnection; -import com.datadog.api.client.v2.model.TeamConnectionCreateRequest; -import com.datadog.api.client.v2.model.TeamConnectionDeleteRequest; -import com.datadog.api.client.v2.model.TeamConnectionsResponse; -import jakarta.ws.rs.client.Invocation; -import jakarta.ws.rs.core.GenericType; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class TeamConnectionsApi { - private ApiClient apiClient; - - public TeamConnectionsApi() { - this(ApiClient.getDefaultApiClient()); - } - - public TeamConnectionsApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API client. - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API client. - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Create team connections. - * - *

See {@link #createTeamConnectionsWithHttpInfo}. - * - * @param body (required) - * @return TeamConnectionsResponse - * @throws ApiException if fails to make API call - */ - public TeamConnectionsResponse createTeamConnections(TeamConnectionCreateRequest body) - throws ApiException { - return createTeamConnectionsWithHttpInfo(body).getData(); - } - - /** - * Create team connections. - * - *

See {@link #createTeamConnectionsWithHttpInfoAsync}. - * - * @param body (required) - * @return CompletableFuture<TeamConnectionsResponse> - */ - public CompletableFuture createTeamConnectionsAsync( - TeamConnectionCreateRequest body) { - return createTeamConnectionsWithHttpInfoAsync(body) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * Create multiple team connections. - * - * @param body (required) - * @return ApiResponse<TeamConnectionsResponse> - * @throws ApiException if fails to make API call - * @http.response.details - * - * - * - * - * - * - * - * - *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
409 Conflict -
429 Too many requests -
- */ - public ApiResponse createTeamConnectionsWithHttpInfo( - TeamConnectionCreateRequest body) throws ApiException { - // Check if unstable operation is enabled - String operationId = "createTeamConnections"; - 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 = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException( - 400, "Missing the required parameter 'body' when calling createTeamConnections"); - } - // create path and map variables - String localVarPath = "/api/v2/team/connections"; - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder = - apiClient.createBuilder( - "v2.TeamConnectionsApi.createTeamConnections", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); - return apiClient.invokeAPI( - "POST", - builder, - localVarHeaderParams, - new String[] {"application/json"}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * Create team connections. - * - *

See {@link #createTeamConnectionsWithHttpInfo}. - * - * @param body (required) - * @return CompletableFuture<ApiResponse<TeamConnectionsResponse>> - */ - public CompletableFuture> - createTeamConnectionsWithHttpInfoAsync(TeamConnectionCreateRequest body) { - // Check if unstable operation is enabled - String operationId = "createTeamConnections"; - 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 = body; - - // verify the required parameter 'body' is set - if (body == null) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException( - 400, "Missing the required parameter 'body' when calling createTeamConnections")); - return result; - } - // create path and map variables - String localVarPath = "/api/v2/team/connections"; - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder; - try { - builder = - apiClient.createBuilder( - "v2.TeamConnectionsApi.createTeamConnections", - localVarPath, - new ArrayList(), - 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( - "POST", - builder, - localVarHeaderParams, - new String[] {"application/json"}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * Delete team connections. - * - *

See {@link #deleteTeamConnectionsWithHttpInfo}. - * - * @param body (required) - * @throws ApiException if fails to make API call - */ - public void deleteTeamConnections(TeamConnectionDeleteRequest body) throws ApiException { - deleteTeamConnectionsWithHttpInfo(body); - } - - /** - * Delete team connections. - * - *

See {@link #deleteTeamConnectionsWithHttpInfoAsync}. - * - * @param body (required) - * @return CompletableFuture - */ - public CompletableFuture deleteTeamConnectionsAsync(TeamConnectionDeleteRequest body) { - return deleteTeamConnectionsWithHttpInfoAsync(body) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * Delete multiple team connections. - * - * @param body (required) - * @return ApiResponse<Void> - * @throws ApiException if fails to make API call - * @http.response.details - * - * - * - * - * - * - * - * - *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
- */ - public ApiResponse deleteTeamConnectionsWithHttpInfo(TeamConnectionDeleteRequest body) - throws ApiException { - // Check if unstable operation is enabled - String operationId = "deleteTeamConnections"; - 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 = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException( - 400, "Missing the required parameter 'body' when calling deleteTeamConnections"); - } - // create path and map variables - String localVarPath = "/api/v2/team/connections"; - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder = - apiClient.createBuilder( - "v2.TeamConnectionsApi.deleteTeamConnections", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"*/*"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); - return apiClient.invokeAPI( - "DELETE", - builder, - localVarHeaderParams, - new String[] {"application/json"}, - localVarPostBody, - new HashMap(), - false, - null); - } - - /** - * Delete team connections. - * - *

See {@link #deleteTeamConnectionsWithHttpInfo}. - * - * @param body (required) - * @return CompletableFuture<ApiResponse<Void>> - */ - public CompletableFuture> deleteTeamConnectionsWithHttpInfoAsync( - TeamConnectionDeleteRequest body) { - // Check if unstable operation is enabled - String operationId = "deleteTeamConnections"; - 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 = body; - - // verify the required parameter 'body' is set - if (body == null) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException( - 400, "Missing the required parameter 'body' when calling deleteTeamConnections")); - return result; - } - // create path and map variables - String localVarPath = "/api/v2/team/connections"; - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder; - try { - builder = - apiClient.createBuilder( - "v2.TeamConnectionsApi.deleteTeamConnections", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"*/*"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); - } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally(ex); - return result; - } - return apiClient.invokeAPIAsync( - "DELETE", - builder, - localVarHeaderParams, - new String[] {"application/json"}, - localVarPostBody, - new HashMap(), - false, - null); - } - - /** Manage optional parameters to listTeamConnections. */ - public static class ListTeamConnectionsOptionalParameters { - private Long pageSize; - private Long pageNumber; - private List filterSources; - private List filterTeamIds; - private List filterConnectedTeamIds; - private List filterConnectionIds; - - /** - * Set pageSize. - * - * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default - * to 10) - * @return ListTeamConnectionsOptionalParameters - */ - public ListTeamConnectionsOptionalParameters pageSize(Long pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Set pageNumber. - * - * @param pageNumber Specific page number to return. (optional, default to 0) - * @return ListTeamConnectionsOptionalParameters - */ - public ListTeamConnectionsOptionalParameters pageNumber(Long pageNumber) { - this.pageNumber = pageNumber; - return this; - } - - /** - * Set filterSources. - * - * @param filterSources Filter team connections by external source systems. (optional) - * @return ListTeamConnectionsOptionalParameters - */ - public ListTeamConnectionsOptionalParameters filterSources(List filterSources) { - this.filterSources = filterSources; - return this; - } - - /** - * Set filterTeamIds. - * - * @param filterTeamIds Filter team connections by Datadog team IDs. (optional) - * @return ListTeamConnectionsOptionalParameters - */ - public ListTeamConnectionsOptionalParameters filterTeamIds(List filterTeamIds) { - this.filterTeamIds = filterTeamIds; - return this; - } - - /** - * Set filterConnectedTeamIds. - * - * @param filterConnectedTeamIds Filter team connections by connected team IDs from external - * systems. (optional) - * @return ListTeamConnectionsOptionalParameters - */ - public ListTeamConnectionsOptionalParameters filterConnectedTeamIds( - List filterConnectedTeamIds) { - this.filterConnectedTeamIds = filterConnectedTeamIds; - return this; - } - - /** - * Set filterConnectionIds. - * - * @param filterConnectionIds Filter team connections by connection IDs. (optional) - * @return ListTeamConnectionsOptionalParameters - */ - public ListTeamConnectionsOptionalParameters filterConnectionIds( - List filterConnectionIds) { - this.filterConnectionIds = filterConnectionIds; - return this; - } - } - - /** - * List team connections. - * - *

See {@link #listTeamConnectionsWithHttpInfo}. - * - * @return TeamConnectionsResponse - * @throws ApiException if fails to make API call - */ - public TeamConnectionsResponse listTeamConnections() throws ApiException { - return listTeamConnectionsWithHttpInfo(new ListTeamConnectionsOptionalParameters()).getData(); - } - - /** - * List team connections. - * - *

See {@link #listTeamConnectionsWithHttpInfoAsync}. - * - * @return CompletableFuture<TeamConnectionsResponse> - */ - public CompletableFuture listTeamConnectionsAsync() { - return listTeamConnectionsWithHttpInfoAsync(new ListTeamConnectionsOptionalParameters()) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * List team connections. - * - *

See {@link #listTeamConnectionsWithHttpInfo}. - * - * @param parameters Optional parameters for the request. - * @return TeamConnectionsResponse - * @throws ApiException if fails to make API call - */ - public TeamConnectionsResponse listTeamConnections( - ListTeamConnectionsOptionalParameters parameters) throws ApiException { - return listTeamConnectionsWithHttpInfo(parameters).getData(); - } - - /** - * List team connections. - * - *

See {@link #listTeamConnectionsWithHttpInfoAsync}. - * - * @param parameters Optional parameters for the request. - * @return CompletableFuture<TeamConnectionsResponse> - */ - public CompletableFuture listTeamConnectionsAsync( - ListTeamConnectionsOptionalParameters parameters) { - return listTeamConnectionsWithHttpInfoAsync(parameters) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * List team connections. - * - *

See {@link #listTeamConnectionsWithHttpInfo}. - * - * @return PaginationIterable<TeamConnection> - */ - public PaginationIterable listTeamConnectionsWithPagination() { - ListTeamConnectionsOptionalParameters parameters = new ListTeamConnectionsOptionalParameters(); - return listTeamConnectionsWithPagination(parameters); - } - - /** - * List team connections. - * - *

See {@link #listTeamConnectionsWithHttpInfo}. - * - * @return TeamConnectionsResponse - */ - public PaginationIterable listTeamConnectionsWithPagination( - ListTeamConnectionsOptionalParameters parameters) { - String resultsPath = "getData"; - String valueGetterPath = ""; - String valueSetterPath = "pageNumber"; - Boolean valueSetterParamOptional = true; - parameters.pageNumber(0l); - Long limit; - - if (parameters.pageSize == null) { - limit = 10l; - parameters.pageSize(limit); - } else { - limit = parameters.pageSize; - } - - LinkedHashMap args = new LinkedHashMap(); - args.put("optionalParams", parameters); - - PaginationIterable iterator = - new PaginationIterable( - this, - "listTeamConnections", - resultsPath, - valueGetterPath, - valueSetterPath, - valueSetterParamOptional, - false, - limit, - args); - - return iterator; - } - - /** - * Returns all team connections. - * - * @param parameters Optional parameters for the request. - * @return ApiResponse<TeamConnectionsResponse> - * @throws ApiException if fails to make API call - * @http.response.details - * - * - * - * - * - * - * - *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
- */ - public ApiResponse listTeamConnectionsWithHttpInfo( - ListTeamConnectionsOptionalParameters parameters) throws ApiException { - // Check if unstable operation is enabled - String operationId = "listTeamConnections"; - 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; - Long pageSize = parameters.pageSize; - Long pageNumber = parameters.pageNumber; - List filterSources = parameters.filterSources; - List filterTeamIds = parameters.filterTeamIds; - List filterConnectedTeamIds = parameters.filterConnectedTeamIds; - List filterConnectionIds = parameters.filterConnectionIds; - // create path and map variables - String localVarPath = "/api/v2/team/connections"; - - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "filter[sources]", filterSources)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("csv", "filter[team_ids]", filterTeamIds)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("csv", "filter[connected_team_ids]", filterConnectedTeamIds)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("csv", "filter[connection_ids]", filterConnectionIds)); - - Invocation.Builder builder = - apiClient.createBuilder( - "v2.TeamConnectionsApi.listTeamConnections", - 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() {}); - } - - /** - * List team connections. - * - *

See {@link #listTeamConnectionsWithHttpInfo}. - * - * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<TeamConnectionsResponse>> - */ - public CompletableFuture> - listTeamConnectionsWithHttpInfoAsync(ListTeamConnectionsOptionalParameters parameters) { - // Check if unstable operation is enabled - String operationId = "listTeamConnections"; - 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; - Long pageSize = parameters.pageSize; - Long pageNumber = parameters.pageNumber; - List filterSources = parameters.filterSources; - List filterTeamIds = parameters.filterTeamIds; - List filterConnectedTeamIds = parameters.filterConnectedTeamIds; - List filterConnectionIds = parameters.filterConnectionIds; - // create path and map variables - String localVarPath = "/api/v2/team/connections"; - - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "filter[sources]", filterSources)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("csv", "filter[team_ids]", filterTeamIds)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("csv", "filter[connected_team_ids]", filterConnectedTeamIds)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("csv", "filter[connection_ids]", filterConnectionIds)); - - Invocation.Builder builder; - try { - builder = - apiClient.createBuilder( - "v2.TeamConnectionsApi.listTeamConnections", - 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() {}); - } -} 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 f0edff68fae..e589875fc8c 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 @@ -10,6 +10,10 @@ import com.datadog.api.client.v2.model.ListTeamsInclude; import com.datadog.api.client.v2.model.ListTeamsSort; import com.datadog.api.client.v2.model.Team; +import com.datadog.api.client.v2.model.TeamConnection; +import com.datadog.api.client.v2.model.TeamConnectionCreateRequest; +import com.datadog.api.client.v2.model.TeamConnectionDeleteRequest; +import com.datadog.api.client.v2.model.TeamConnectionsResponse; import com.datadog.api.client.v2.model.TeamCreateRequest; import com.datadog.api.client.v2.model.TeamHierarchyLink; import com.datadog.api.client.v2.model.TeamHierarchyLinkCreateRequest; @@ -521,6 +525,157 @@ public CompletableFuture> createTeamWithHttpInfoAsync( new GenericType() {}); } + /** + * Create team connections. + * + *

See {@link #createTeamConnectionsWithHttpInfo}. + * + * @param body (required) + * @return TeamConnectionsResponse + * @throws ApiException if fails to make API call + */ + public TeamConnectionsResponse createTeamConnections(TeamConnectionCreateRequest body) + throws ApiException { + return createTeamConnectionsWithHttpInfo(body).getData(); + } + + /** + * Create team connections. + * + *

See {@link #createTeamConnectionsWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<TeamConnectionsResponse> + */ + public CompletableFuture createTeamConnectionsAsync( + TeamConnectionCreateRequest body) { + return createTeamConnectionsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create multiple team connections. + * + * @param body (required) + * @return ApiResponse<TeamConnectionsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createTeamConnectionsWithHttpInfo( + TeamConnectionCreateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createTeamConnections"; + 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 = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createTeamConnections"); + } + // create path and map variables + String localVarPath = "/api/v2/team/connections"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.createTeamConnections", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create team connections. + * + *

See {@link #createTeamConnectionsWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<TeamConnectionsResponse>> + */ + public CompletableFuture> + createTeamConnectionsWithHttpInfoAsync(TeamConnectionCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createTeamConnections"; + 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 = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createTeamConnections")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/team/connections"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.createTeamConnections", + localVarPath, + new ArrayList(), + 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( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Create a team link. * @@ -966,6 +1121,154 @@ public CompletableFuture> deleteTeamWithHttpInfoAsync(String t null); } + /** + * Delete team connections. + * + *

See {@link #deleteTeamConnectionsWithHttpInfo}. + * + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void deleteTeamConnections(TeamConnectionDeleteRequest body) throws ApiException { + deleteTeamConnectionsWithHttpInfo(body); + } + + /** + * Delete team connections. + * + *

See {@link #deleteTeamConnectionsWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture deleteTeamConnectionsAsync(TeamConnectionDeleteRequest body) { + return deleteTeamConnectionsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete multiple team connections. + * + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteTeamConnectionsWithHttpInfo(TeamConnectionDeleteRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteTeamConnections"; + 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 = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling deleteTeamConnections"); + } + // create path and map variables + String localVarPath = "/api/v2/team/connections"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.deleteTeamConnections", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete team connections. + * + *

See {@link #deleteTeamConnectionsWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteTeamConnectionsWithHttpInfoAsync( + TeamConnectionDeleteRequest body) { + // Check if unstable operation is enabled + String operationId = "deleteTeamConnections"; + 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 = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling deleteTeamConnections")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/team/connections"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.deleteTeamConnections", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Remove a team link. * @@ -2887,6 +3190,335 @@ public CompletableFuture> listMemberTeamsWithHttpInfo new GenericType() {}); } + /** Manage optional parameters to listTeamConnections. */ + public static class ListTeamConnectionsOptionalParameters { + private Long pageSize; + private Long pageNumber; + private List filterSources; + private List filterTeamIds; + private List filterConnectedTeamIds; + private List filterConnectionIds; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListTeamConnectionsOptionalParameters + */ + public ListTeamConnectionsOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListTeamConnectionsOptionalParameters + */ + public ListTeamConnectionsOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set filterSources. + * + * @param filterSources Filter team connections by external source systems. (optional) + * @return ListTeamConnectionsOptionalParameters + */ + public ListTeamConnectionsOptionalParameters filterSources(List filterSources) { + this.filterSources = filterSources; + return this; + } + + /** + * Set filterTeamIds. + * + * @param filterTeamIds Filter team connections by Datadog team IDs. (optional) + * @return ListTeamConnectionsOptionalParameters + */ + public ListTeamConnectionsOptionalParameters filterTeamIds(List filterTeamIds) { + this.filterTeamIds = filterTeamIds; + return this; + } + + /** + * Set filterConnectedTeamIds. + * + * @param filterConnectedTeamIds Filter team connections by connected team IDs from external + * systems. (optional) + * @return ListTeamConnectionsOptionalParameters + */ + public ListTeamConnectionsOptionalParameters filterConnectedTeamIds( + List filterConnectedTeamIds) { + this.filterConnectedTeamIds = filterConnectedTeamIds; + return this; + } + + /** + * Set filterConnectionIds. + * + * @param filterConnectionIds Filter team connections by connection IDs. (optional) + * @return ListTeamConnectionsOptionalParameters + */ + public ListTeamConnectionsOptionalParameters filterConnectionIds( + List filterConnectionIds) { + this.filterConnectionIds = filterConnectionIds; + return this; + } + } + + /** + * List team connections. + * + *

See {@link #listTeamConnectionsWithHttpInfo}. + * + * @return TeamConnectionsResponse + * @throws ApiException if fails to make API call + */ + public TeamConnectionsResponse listTeamConnections() throws ApiException { + return listTeamConnectionsWithHttpInfo(new ListTeamConnectionsOptionalParameters()).getData(); + } + + /** + * List team connections. + * + *

See {@link #listTeamConnectionsWithHttpInfoAsync}. + * + * @return CompletableFuture<TeamConnectionsResponse> + */ + public CompletableFuture listTeamConnectionsAsync() { + return listTeamConnectionsWithHttpInfoAsync(new ListTeamConnectionsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List team connections. + * + *

See {@link #listTeamConnectionsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return TeamConnectionsResponse + * @throws ApiException if fails to make API call + */ + public TeamConnectionsResponse listTeamConnections( + ListTeamConnectionsOptionalParameters parameters) throws ApiException { + return listTeamConnectionsWithHttpInfo(parameters).getData(); + } + + /** + * List team connections. + * + *

See {@link #listTeamConnectionsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TeamConnectionsResponse> + */ + public CompletableFuture listTeamConnectionsAsync( + ListTeamConnectionsOptionalParameters parameters) { + return listTeamConnectionsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List team connections. + * + *

See {@link #listTeamConnectionsWithHttpInfo}. + * + * @return PaginationIterable<TeamConnection> + */ + public PaginationIterable listTeamConnectionsWithPagination() { + ListTeamConnectionsOptionalParameters parameters = new ListTeamConnectionsOptionalParameters(); + return listTeamConnectionsWithPagination(parameters); + } + + /** + * List team connections. + * + *

See {@link #listTeamConnectionsWithHttpInfo}. + * + * @return TeamConnectionsResponse + */ + public PaginationIterable listTeamConnectionsWithPagination( + ListTeamConnectionsOptionalParameters parameters) { + String resultsPath = "getData"; + String valueGetterPath = ""; + String valueSetterPath = "pageNumber"; + Boolean valueSetterParamOptional = true; + parameters.pageNumber(0l); + Long limit; + + if (parameters.pageSize == null) { + limit = 10l; + parameters.pageSize(limit); + } else { + limit = parameters.pageSize; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listTeamConnections", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + false, + limit, + args); + + return iterator; + } + + /** + * Returns all team connections. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<TeamConnectionsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listTeamConnectionsWithHttpInfo( + ListTeamConnectionsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listTeamConnections"; + 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; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + List filterSources = parameters.filterSources; + List filterTeamIds = parameters.filterTeamIds; + List filterConnectedTeamIds = parameters.filterConnectedTeamIds; + List filterConnectionIds = parameters.filterConnectionIds; + // create path and map variables + String localVarPath = "/api/v2/team/connections"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "filter[sources]", filterSources)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("csv", "filter[team_ids]", filterTeamIds)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("csv", "filter[connected_team_ids]", filterConnectedTeamIds)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("csv", "filter[connection_ids]", filterConnectionIds)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.listTeamConnections", + 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() {}); + } + + /** + * List team connections. + * + *

See {@link #listTeamConnectionsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TeamConnectionsResponse>> + */ + public CompletableFuture> + listTeamConnectionsWithHttpInfoAsync(ListTeamConnectionsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listTeamConnections"; + 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; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + List filterSources = parameters.filterSources; + List filterTeamIds = parameters.filterTeamIds; + List filterConnectedTeamIds = parameters.filterConnectedTeamIds; + List filterConnectionIds = parameters.filterConnectionIds; + // create path and map variables + String localVarPath = "/api/v2/team/connections"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "filter[sources]", filterSources)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("csv", "filter[team_ids]", filterTeamIds)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("csv", "filter[connected_team_ids]", filterConnectedTeamIds)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("csv", "filter[connection_ids]", filterConnectionIds)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.listTeamConnections", + 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() {}); + } + /** Manage optional parameters to listTeamHierarchyLinks. */ public static class ListTeamHierarchyLinksOptionalParameters { private Long pageNumber; diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 6c6d3bf98f4..d919b983487 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -1209,7 +1209,7 @@ "source": "data.data[0]", "step": "there is a valid \"team_connection\" in the system", "key": "team_connection", - "tag": "Team Connections", + "tag": "Teams", "operationId": "CreateTeamConnections" }, { diff --git a/src/test/resources/com/datadog/api/client/v2/api/team_connections.feature b/src/test/resources/com/datadog/api/client/v2/api/team_connections.feature deleted file mode 100644 index 7bbce889e1e..00000000000 --- a/src/test/resources/com/datadog/api/client/v2/api/team_connections.feature +++ /dev/null @@ -1,93 +0,0 @@ -@endpoint(team-connections) @endpoint(team-connections-v2) -Feature: Team Connections - View and manage relationships between Datadog teams and teams from - external sources, such as GitHub. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "TeamConnections" API - - @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Bad Request" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And body with value {"data": [{"attributes": {"source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"type": "team"}}}, "type": "team_connection"}]} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Conflict" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And body with value {"data": [{"attributes": {"managed_by": "github_sync", "source": "github"}, "relationships": {"connected_team": {"data": {"id": "@GitHubOrg/team-handle", "type": "github_team"}}, "team": {"data": {"id": "87654321-4321-8765-dcba-210987654321", "type": "team"}}}, "type": "team_connection"}]} - When the request is sent - Then the response status is 409 Conflict - - @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Created" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And there is a valid "dd_team" in the system - And body with value {"data": [{"type": "team_connection", "attributes": {"source": "github", "managed_by": "datadog"}, "relationships": {"team": {"data": {"id": "{{ dd_team.data.id }}", "type": "team"}}, "connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}}}]} - When the request is sent - Then the response status is 201 Created - And the response "data.data[0].attributes.source" is equal to "github" - And the response "data.data[0].attributes.managed_by" is equal to "datadog" - And the response "data.data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}" - And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name" - And the response "data.data[0].type" is equal to "team_connection" - - @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "Bad Request" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"type": "team_connection"}]} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "No Content" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} - When the request is sent - Then the response status is 204 No Content - - @generated @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "Not Found" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-omg - Scenario: List team connections returns "Bad Request" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request is sent - Then the response status is 400 Bad Request - - @skip @team:DataDog/aaa-omg - Scenario: List team connections returns "OK" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-omg @with-pagination - Scenario: List team connections returns "OK" response with pagination - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request with pagination is sent - Then the response status is 200 OK - - @skip @team:DataDog/aaa-omg - Scenario: List team connections with filters returns "OK" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - And request contains "filter[sources]" parameter with value ["github"] - And request contains "page[size]" parameter with value 10 - When the request is sent - Then the response status is 200 OK 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 faa1ca0889d..c2f52d0d96e 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 @@ -115,6 +115,60 @@ Feature: Teams And the response "data.attributes.visible_modules" is equal to ["m1","m2"] And the response "data.attributes.hidden_modules" is equal to ["m3"] + @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Bad Request" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And body with value {"data": [{"attributes": {"source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"type": "team"}}}, "type": "team_connection"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Conflict" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And body with value {"data": [{"attributes": {"managed_by": "github_sync", "source": "github"}, "relationships": {"connected_team": {"data": {"id": "@GitHubOrg/team-handle", "type": "github_team"}}, "team": {"data": {"id": "87654321-4321-8765-dcba-210987654321", "type": "team"}}}, "type": "team_connection"}]} + When the request is sent + Then the response status is 409 Conflict + + @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Created" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And there is a valid "dd_team" in the system + And body with value {"data": [{"type": "team_connection", "attributes": {"source": "github", "managed_by": "datadog"}, "relationships": {"team": {"data": {"id": "{{ dd_team.data.id }}", "type": "team"}}, "connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}}}]} + When the request is sent + Then the response status is 201 Created + And the response "data.data[0].attributes.source" is equal to "github" + And the response "data.data[0].attributes.managed_by" is equal to "datadog" + And the response "data.data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name" + And the response "data.data[0].type" is equal to "team_connection" + + @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "Bad Request" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"type": "team_connection"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "No Content" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "Not Found" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/aaa-omg Scenario: Get a team hierarchy link returns "API error response." response Given new "GetTeamHierarchyLink" request @@ -341,6 +395,36 @@ Feature: Teams When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-omg + Scenario: List team connections returns "Bad Request" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: List team connections returns "OK" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg @with-pagination + Scenario: List team connections returns "OK" response with pagination + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request with pagination is sent + Then the response status is 200 OK + + @skip @team:DataDog/aaa-omg + Scenario: List team connections with filters returns "OK" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + And request contains "filter[sources]" parameter with value ["github"] + And request contains "page[size]" parameter with value 10 + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-omg Scenario: Remove a member team returns "API error response." response Given operation "RemoveMemberTeam" enabled 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 2e54bbe0afb..2231f8c9613 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 @@ -4494,19 +4494,19 @@ } }, "DeleteTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "type": "idempotent" } }, "ListTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "type": "safe" } }, "CreateTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "operationId": "DeleteTeamConnections", "type": "unsafe"