From 327d23f581bb4b887e27b0b4042d79e046d3096b Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 17 Jun 2025 14:57:51 +0000 Subject: [PATCH] Regenerate client from commit b359fdcc of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 180 +++++ examples/v2/teams/AddMemberTeam.java | 33 + examples/v2/teams/ListMemberTeams.java | 25 + .../v2/teams/ListMemberTeams_1662850354.java | 27 + examples/v2/teams/RemoveMemberTeam.java | 23 + .../com/datadog/api/client/ApiClient.java | 3 + .../datadog/api/client/v2/api/TeamsApi.java | 653 ++++++++++++++++++ .../client/v2/model/AddMemberTeamRequest.java | 145 ++++ .../api/client/v2/model/MemberTeam.java | 175 +++++ .../api/client/v2/model/MemberTeamType.java | 54 ++ .../datadog/api/client/v2/api/teams.feature | 60 ++ .../com/datadog/api/client/v2/api/undo.json | 19 + 13 files changed, 1401 insertions(+), 4 deletions(-) create mode 100644 examples/v2/teams/AddMemberTeam.java create mode 100644 examples/v2/teams/ListMemberTeams.java create mode 100644 examples/v2/teams/ListMemberTeams_1662850354.java create mode 100644 examples/v2/teams/RemoveMemberTeam.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AddMemberTeamRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MemberTeam.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MemberTeamType.java diff --git a/.apigentools-info b/.apigentools-info index 4809e830160..f44b3b2316e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-16 16:45:03.092535", - "spec_repo_commit": "6e1eb13f" + "regenerated": "2025-06-17 14:55:54.549540", + "spec_repo_commit": "b359fdcc" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-16 16:45:03.110724", - "spec_repo_commit": "6e1eb13f" + "regenerated": "2025-06-17 14:55:54.565207", + "spec_repo_commit": "b359fdcc" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b0dcc595857..a16a2737629 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2200,6 +2200,14 @@ components: type: string x-enum-varnames: - BILLING_DIMENSIONS + AddMemberTeamRequest: + description: Request to add a member team to super team's hierarchy + properties: + data: + $ref: '#/components/schemas/MemberTeam' + required: + - data + type: object Advisory: description: Advisory. properties: @@ -21300,6 +21308,28 @@ components: - ms_channel_name - redirect_url type: object + MemberTeam: + description: A member team + properties: + id: + description: The member team's identifier + example: aeadc05e-98a8-11ec-ac2c-da7ad0900001 + type: string + type: + $ref: '#/components/schemas/MemberTeamType' + required: + - id + - type + type: object + MemberTeamType: + default: member_teams + description: Member team type + enum: + - member_teams + example: member_teams + type: string + x-enum-varnames: + - MEMBER_TEAMS Metadata: description: The metadata related to this request. properties: @@ -60442,6 +60472,156 @@ paths: permissions: - teams_read - teams_manage + /api/v2/team/{super_team_id}/member_teams: + get: + description: Get all member teams. + operationId: ListMemberTeams + parameters: + - description: None + in: path + name: super_team_id + required: true + schema: + type: string + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + - description: List of fields that need to be fetched. + explode: false + in: query + name: fields[team] + required: false + schema: + items: + $ref: '#/components/schemas/TeamsField' + type: array + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamsResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get all member teams + tags: + - Teams + x-pagination: + limitParam: page[size] + pageParam: page[number] + resultsPath: data + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: 'Add a member team. + + Adds the team given by the `id` in the body as a member team of the super + team.' + operationId: AddMemberTeam + parameters: + - description: None + in: path + name: super_team_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AddMemberTeamRequest' + required: true + responses: + '204': + description: Added + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Add a member team + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/team/{super_team_id}/member_teams/{member_team_id}: + delete: + description: Remove a super team's member team identified by `member_team_id`. + operationId: RemoveMemberTeam + parameters: + - description: None + in: path + name: super_team_id + required: true + schema: + type: string + - description: None + in: path + name: member_team_id + required: true + schema: + type: string + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Remove a member team + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/{team_id}: delete: description: Remove a team using the team's `id`. diff --git a/examples/v2/teams/AddMemberTeam.java b/examples/v2/teams/AddMemberTeam.java new file mode 100644 index 00000000000..f6d99f4ab67 --- /dev/null +++ b/examples/v2/teams/AddMemberTeam.java @@ -0,0 +1,33 @@ +// Add a member team returns "Added" 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.AddMemberTeamRequest; +import com.datadog.api.client.v2.model.MemberTeam; +import com.datadog.api.client.v2.model.MemberTeamType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.addMemberTeam", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + AddMemberTeamRequest body = + new AddMemberTeamRequest() + .data( + new MemberTeam() + .id("aeadc05e-98a8-11ec-ac2c-da7ad0900001") + .type(MemberTeamType.MEMBER_TEAMS)); + + try { + apiInstance.addMemberTeam("super_team_id", body); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#addMemberTeam"); + 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/examples/v2/teams/ListMemberTeams.java b/examples/v2/teams/ListMemberTeams.java new file mode 100644 index 00000000000..0071725d987 --- /dev/null +++ b/examples/v2/teams/ListMemberTeams.java @@ -0,0 +1,25 @@ +// Get all member teams 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.TeamsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listMemberTeams", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + try { + TeamsResponse result = apiInstance.listMemberTeams("super_team_id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#listMemberTeams"); + 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/examples/v2/teams/ListMemberTeams_1662850354.java b/examples/v2/teams/ListMemberTeams_1662850354.java new file mode 100644 index 00000000000..00c7adcc808 --- /dev/null +++ b/examples/v2/teams/ListMemberTeams_1662850354.java @@ -0,0 +1,27 @@ +// Get all member teams returns "OK" response with pagination + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.PaginationIterable; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.model.Team; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listMemberTeams", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + try { + PaginationIterable iterable = + apiInstance.listMemberTeamsWithPagination("super_team_id"); + + for (Team item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println("Exception when calling TeamsApi#listMemberTeamsWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/RemoveMemberTeam.java b/examples/v2/teams/RemoveMemberTeam.java new file mode 100644 index 00000000000..da12f277c50 --- /dev/null +++ b/examples/v2/teams/RemoveMemberTeam.java @@ -0,0 +1,23 @@ +// Remove a member team returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.removeMemberTeam", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + try { + apiInstance.removeMemberTeam("super_team_id", "member_team_id"); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#removeMemberTeam"); + 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 ce436d5eeb7..cfb737701fd 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -689,6 +689,9 @@ public class ApiClient { put("v2.createSLOReportJob", false); put("v2.getSLOReport", false); put("v2.getSLOReportJobStatus", false); + put("v2.addMemberTeam", false); + put("v2.listMemberTeams", false); + put("v2.removeMemberTeam", 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/TeamsApi.java b/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java index 93ee448981b..bf0d185bd81 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 @@ -5,6 +5,7 @@ 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.AddMemberTeamRequest; import com.datadog.api.client.v2.model.GetTeamMembershipsSort; import com.datadog.api.client.v2.model.ListTeamsInclude; import com.datadog.api.client.v2.model.ListTeamsSort; @@ -65,6 +66,179 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Add a member team. + * + *

See {@link #addMemberTeamWithHttpInfo}. + * + * @param superTeamId None (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void addMemberTeam(String superTeamId, AddMemberTeamRequest body) throws ApiException { + addMemberTeamWithHttpInfo(superTeamId, body); + } + + /** + * Add a member team. + * + *

See {@link #addMemberTeamWithHttpInfoAsync}. + * + * @param superTeamId None (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture addMemberTeamAsync(String superTeamId, AddMemberTeamRequest body) { + return addMemberTeamWithHttpInfoAsync(superTeamId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Add a member team. Adds the team given by the id in the body as a member team of + * the super team. + * + * @param superTeamId None (required) + * @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 Added -
403 Forbidden -
409 API error response. -
429 Too many requests -
+ */ + public ApiResponse addMemberTeamWithHttpInfo(String superTeamId, AddMemberTeamRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "addMemberTeam"; + 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 'superTeamId' is set + if (superTeamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'superTeamId' when calling addMemberTeam"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling addMemberTeam"); + } + // create path and map variables + String localVarPath = + "/api/v2/team/{super_team_id}/member_teams" + .replaceAll( + "\\{" + "super_team_id" + "\\}", apiClient.escapeString(superTeamId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.addMemberTeam", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Add a member team. + * + *

See {@link #addMemberTeamWithHttpInfo}. + * + * @param superTeamId None (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> addMemberTeamWithHttpInfoAsync( + String superTeamId, AddMemberTeamRequest body) { + // Check if unstable operation is enabled + String operationId = "addMemberTeam"; + 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 'superTeamId' is set + if (superTeamId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'superTeamId' when calling addMemberTeam")); + return result; + } + + // 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 addMemberTeam")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/team/{super_team_id}/member_teams" + .replaceAll( + "\\{" + "super_team_id" + "\\}", apiClient.escapeString(superTeamId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.addMemberTeam", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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, + null); + } + /** * Create a team. * @@ -1946,6 +2120,309 @@ public CompletableFuture> getUserMembershipsWithH new GenericType() {}); } + /** Manage optional parameters to listMemberTeams. */ + public static class ListMemberTeamsOptionalParameters { + private Long pageSize; + private Long pageNumber; + private List fieldsTeam; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListMemberTeamsOptionalParameters + */ + public ListMemberTeamsOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListMemberTeamsOptionalParameters + */ + public ListMemberTeamsOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set fieldsTeam. + * + * @param fieldsTeam List of fields that need to be fetched. (optional) + * @return ListMemberTeamsOptionalParameters + */ + public ListMemberTeamsOptionalParameters fieldsTeam(List fieldsTeam) { + this.fieldsTeam = fieldsTeam; + return this; + } + } + + /** + * Get all member teams. + * + *

See {@link #listMemberTeamsWithHttpInfo}. + * + * @param superTeamId None (required) + * @return TeamsResponse + * @throws ApiException if fails to make API call + */ + public TeamsResponse listMemberTeams(String superTeamId) throws ApiException { + return listMemberTeamsWithHttpInfo(superTeamId, new ListMemberTeamsOptionalParameters()) + .getData(); + } + + /** + * Get all member teams. + * + *

See {@link #listMemberTeamsWithHttpInfoAsync}. + * + * @param superTeamId None (required) + * @return CompletableFuture<TeamsResponse> + */ + public CompletableFuture listMemberTeamsAsync(String superTeamId) { + return listMemberTeamsWithHttpInfoAsync(superTeamId, new ListMemberTeamsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all member teams. + * + *

See {@link #listMemberTeamsWithHttpInfo}. + * + * @param superTeamId None (required) + * @param parameters Optional parameters for the request. + * @return TeamsResponse + * @throws ApiException if fails to make API call + */ + public TeamsResponse listMemberTeams( + String superTeamId, ListMemberTeamsOptionalParameters parameters) throws ApiException { + return listMemberTeamsWithHttpInfo(superTeamId, parameters).getData(); + } + + /** + * Get all member teams. + * + *

See {@link #listMemberTeamsWithHttpInfoAsync}. + * + * @param superTeamId None (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TeamsResponse> + */ + public CompletableFuture listMemberTeamsAsync( + String superTeamId, ListMemberTeamsOptionalParameters parameters) { + return listMemberTeamsWithHttpInfoAsync(superTeamId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all member teams. + * + *

See {@link #listMemberTeamsWithHttpInfo}. + * + * @param superTeamId None (required) + * @return PaginationIterable<Team> + */ + public PaginationIterable listMemberTeamsWithPagination(String superTeamId) { + ListMemberTeamsOptionalParameters parameters = new ListMemberTeamsOptionalParameters(); + return listMemberTeamsWithPagination(superTeamId, parameters); + } + + /** + * Get all member teams. + * + *

See {@link #listMemberTeamsWithHttpInfo}. + * + * @param superTeamId None (required) + * @return TeamsResponse + */ + public PaginationIterable listMemberTeamsWithPagination( + String superTeamId, ListMemberTeamsOptionalParameters 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("superTeamId", superTeamId); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listMemberTeams", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + false, + limit, + args); + + return iterator; + } + + /** + * Get all member teams. + * + * @param superTeamId None (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<TeamsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 API error response. -
429 Too many requests -
+ */ + public ApiResponse listMemberTeamsWithHttpInfo( + String superTeamId, ListMemberTeamsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listMemberTeams"; + 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 'superTeamId' is set + if (superTeamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'superTeamId' when calling listMemberTeams"); + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + List fieldsTeam = parameters.fieldsTeam; + // create path and map variables + String localVarPath = + "/api/v2/team/{super_team_id}/member_teams" + .replaceAll( + "\\{" + "super_team_id" + "\\}", apiClient.escapeString(superTeamId.toString())); + + 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", "fields[team]", fieldsTeam)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.listMemberTeams", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get all member teams. + * + *

See {@link #listMemberTeamsWithHttpInfo}. + * + * @param superTeamId None (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TeamsResponse>> + */ + public CompletableFuture> listMemberTeamsWithHttpInfoAsync( + String superTeamId, ListMemberTeamsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listMemberTeams"; + 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 'superTeamId' is set + if (superTeamId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'superTeamId' when calling listMemberTeams")); + return result; + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + List fieldsTeam = parameters.fieldsTeam; + // create path and map variables + String localVarPath = + "/api/v2/team/{super_team_id}/member_teams" + .replaceAll( + "\\{" + "super_team_id" + "\\}", apiClient.escapeString(superTeamId.toString())); + + 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", "fields[team]", fieldsTeam)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.listMemberTeams", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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 listTeams. */ public static class ListTeamsOptionalParameters { private Long pageNumber; @@ -2264,6 +2741,182 @@ public CompletableFuture> listTeamsWithHttpInfoAsync( new GenericType() {}); } + /** + * Remove a member team. + * + *

See {@link #removeMemberTeamWithHttpInfo}. + * + * @param superTeamId None (required) + * @param memberTeamId None (required) + * @throws ApiException if fails to make API call + */ + public void removeMemberTeam(String superTeamId, String memberTeamId) throws ApiException { + removeMemberTeamWithHttpInfo(superTeamId, memberTeamId); + } + + /** + * Remove a member team. + * + *

See {@link #removeMemberTeamWithHttpInfoAsync}. + * + * @param superTeamId None (required) + * @param memberTeamId None (required) + * @return CompletableFuture + */ + public CompletableFuture removeMemberTeamAsync(String superTeamId, String memberTeamId) { + return removeMemberTeamWithHttpInfoAsync(superTeamId, memberTeamId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Remove a super team's member team identified by member_team_id. + * + * @param superTeamId None (required) + * @param memberTeamId None (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 -
403 Forbidden -
404 API error response. -
429 Too many requests -
+ */ + public ApiResponse removeMemberTeamWithHttpInfo(String superTeamId, String memberTeamId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "removeMemberTeam"; + 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 'superTeamId' is set + if (superTeamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'superTeamId' when calling removeMemberTeam"); + } + + // verify the required parameter 'memberTeamId' is set + if (memberTeamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'memberTeamId' when calling removeMemberTeam"); + } + // create path and map variables + String localVarPath = + "/api/v2/team/{super_team_id}/member_teams/{member_team_id}" + .replaceAll( + "\\{" + "super_team_id" + "\\}", apiClient.escapeString(superTeamId.toString())) + .replaceAll( + "\\{" + "member_team_id" + "\\}", apiClient.escapeString(memberTeamId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.removeMemberTeam", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Remove a member team. + * + *

See {@link #removeMemberTeamWithHttpInfo}. + * + * @param superTeamId None (required) + * @param memberTeamId None (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> removeMemberTeamWithHttpInfoAsync( + String superTeamId, String memberTeamId) { + // Check if unstable operation is enabled + String operationId = "removeMemberTeam"; + 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 'superTeamId' is set + if (superTeamId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'superTeamId' when calling removeMemberTeam")); + return result; + } + + // verify the required parameter 'memberTeamId' is set + if (memberTeamId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'memberTeamId' when calling removeMemberTeam")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/team/{super_team_id}/member_teams/{member_team_id}" + .replaceAll( + "\\{" + "super_team_id" + "\\}", apiClient.escapeString(superTeamId.toString())) + .replaceAll( + "\\{" + "member_team_id" + "\\}", apiClient.escapeString(memberTeamId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.removeMemberTeam", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Update a team. * diff --git a/src/main/java/com/datadog/api/client/v2/model/AddMemberTeamRequest.java b/src/main/java/com/datadog/api/client/v2/model/AddMemberTeamRequest.java new file mode 100644 index 00000000000..0ce63bb8b73 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AddMemberTeamRequest.java @@ -0,0 +1,145 @@ +/* + * 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.JsonCreator; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to add a member team to super team's hierarchy */ +@JsonPropertyOrder({AddMemberTeamRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AddMemberTeamRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private MemberTeam data; + + public AddMemberTeamRequest() {} + + @JsonCreator + public AddMemberTeamRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) MemberTeam data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AddMemberTeamRequest data(MemberTeam data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A member team + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MemberTeam getData() { + return data; + } + + public void setData(MemberTeam 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 AddMemberTeamRequest + */ + @JsonAnySetter + public AddMemberTeamRequest 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 AddMemberTeamRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddMemberTeamRequest addMemberTeamRequest = (AddMemberTeamRequest) o; + return Objects.equals(this.data, addMemberTeamRequest.data) + && Objects.equals(this.additionalProperties, addMemberTeamRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddMemberTeamRequest {\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/main/java/com/datadog/api/client/v2/model/MemberTeam.java b/src/main/java/com/datadog/api/client/v2/model/MemberTeam.java new file mode 100644 index 00000000000..46eae7cefff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MemberTeam.java @@ -0,0 +1,175 @@ +/* + * 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.JsonCreator; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A member team */ +@JsonPropertyOrder({MemberTeam.JSON_PROPERTY_ID, MemberTeam.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MemberTeam { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private MemberTeamType type = MemberTeamType.MEMBER_TEAMS; + + public MemberTeam() {} + + @JsonCreator + public MemberTeam( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) MemberTeamType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public MemberTeam id(String id) { + this.id = id; + return this; + } + + /** + * The member team's identifier + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public MemberTeam type(MemberTeamType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Member team type + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MemberTeamType getType() { + return type; + } + + public void setType(MemberTeamType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 MemberTeam + */ + @JsonAnySetter + public MemberTeam 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 MemberTeam object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MemberTeam memberTeam = (MemberTeam) o; + return Objects.equals(this.id, memberTeam.id) + && Objects.equals(this.type, memberTeam.type) + && Objects.equals(this.additionalProperties, memberTeam.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MemberTeam {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/main/java/com/datadog/api/client/v2/model/MemberTeamType.java b/src/main/java/com/datadog/api/client/v2/model/MemberTeamType.java new file mode 100644 index 00000000000..244e2c22d3d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MemberTeamType.java @@ -0,0 +1,54 @@ +/* + * 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; + +/** Member team type */ +@JsonSerialize(using = MemberTeamType.MemberTeamTypeSerializer.class) +public class MemberTeamType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("member_teams")); + + public static final MemberTeamType MEMBER_TEAMS = new MemberTeamType("member_teams"); + + MemberTeamType(String value) { + super(value, allowedValues); + } + + public static class MemberTeamTypeSerializer extends StdSerializer { + public MemberTeamTypeSerializer(Class t) { + super(t); + } + + public MemberTeamTypeSerializer() { + this(null); + } + + @Override + public void serialize(MemberTeamType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static MemberTeamType fromValue(String value) { + return new MemberTeamType(value); + } +} 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 5d4069034c9..4cdf61f0fa0 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 @@ -9,6 +9,24 @@ Feature: Teams And a valid "appKeyAuth" key in the system And an instance of "Teams" API + @generated @skip @team:DataDog/core-app + Scenario: Add a member team returns "API error response." response + Given operation "AddMemberTeam" enabled + And new "AddMemberTeam" request + And request contains "super_team_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001", "type": "member_teams"}} + When the request is sent + Then the response status is 409 API error response. + + @generated @skip @team:DataDog/core-app + Scenario: Add a member team returns "Added" response + Given operation "AddMemberTeam" enabled + And new "AddMemberTeam" request + And request contains "super_team_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001", "type": "member_teams"}} + When the request is sent + Then the response status is 204 Added + @generated @skip @team:DataDog/core-app Scenario: Add a user to a team returns "API error response." response Given new "CreateTeamMembership" request @@ -112,6 +130,30 @@ Feature: Teams When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/core-app + Scenario: Get all member teams returns "API error response." response + Given operation "ListMemberTeams" enabled + And new "ListMemberTeams" request + And request contains "super_team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/core-app + Scenario: Get all member teams returns "OK" response + Given operation "ListMemberTeams" enabled + And new "ListMemberTeams" request + And request contains "super_team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/core-app @with-pagination + Scenario: Get all member teams returns "OK" response with pagination + Given operation "ListMemberTeams" enabled + And new "ListMemberTeams" request + And request contains "super_team_id" parameter from "REPLACE.ME" + When the request with pagination is sent + Then the response status is 200 OK + @team:DataDog/core-app Scenario: Get all teams returns "OK" response Given new "ListTeams" request @@ -209,6 +251,24 @@ Feature: Teams Then the response status is 200 Represents a user's association to a team And the response "data" has length 0 + @generated @skip @team:DataDog/core-app + Scenario: Remove a member team returns "API error response." response + Given operation "RemoveMemberTeam" enabled + And new "RemoveMemberTeam" request + And request contains "super_team_id" parameter from "REPLACE.ME" + And request contains "member_team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/core-app + Scenario: Remove a member team returns "No Content" response + Given operation "RemoveMemberTeam" enabled + And new "RemoveMemberTeam" request + And request contains "super_team_id" parameter from "REPLACE.ME" + And request contains "member_team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + @team:DataDog/core-app Scenario: Remove a team link returns "API error response." response Given new "DeleteTeamLink" 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 2d33b5cd716..e81cb7b7ce1 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 @@ -3241,6 +3241,25 @@ "type": "unsafe" } }, + "ListMemberTeams": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "AddMemberTeam": { + "tag": "Teams", + "undo": { + "operationId": "RemoveMemberTeam", + "type": "unsafe" + } + }, + "RemoveMemberTeam": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, "DeleteTeam": { "tag": "Teams", "undo": {