diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6ed4b42368e..ce755c7d444 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -11515,6 +11515,35 @@ components: $ref: '#/components/schemas/ConfluentResourceResponseData' type: array type: object + ConnectedTeamRef: + description: Reference to a team from an external system. + properties: + data: + $ref: '#/components/schemas/ConnectedTeamRefData' + type: object + ConnectedTeamRefData: + description: Reference to connected external team. + properties: + id: + description: The connected team ID as it is referenced throughout the Datadog + ecosystem. + example: '@MyGitHubAccount/my-team-name' + type: string + type: + $ref: '#/components/schemas/ConnectedTeamRefDataType' + required: + - id + - type + type: object + ConnectedTeamRefDataType: + default: github_team + description: External team resource type. + enum: + - github_team + example: github_team + type: string + x-enum-varnames: + - GITHUB_TEAM Connection: description: The definition of `Connection` object. properties: @@ -11579,6 +11608,50 @@ components: - label - tags type: object + ConnectionsPagePagination: + description: Page-based pagination metadata. + properties: + first_number: + description: The first page number. + format: int64 + type: integer + last_number: + description: The last page number. + format: int64 + type: integer + next_number: + description: The next page number. + format: int64 + nullable: true + type: integer + number: + description: The current page number. + format: int64 + type: integer + prev_number: + description: The previous page number. + format: int64 + nullable: true + type: integer + size: + description: The page size. + format: int64 + type: integer + total: + description: Total connections matching request. + format: int64 + type: integer + type: + description: Pagination type. + example: number_size + type: string + type: object + ConnectionsResponseMeta: + description: Connections response metadata. + properties: + page: + $ref: '#/components/schemas/ConnectionsPagePagination' + type: object Container: description: Container object. properties: @@ -51314,6 +51387,111 @@ components: - handle - name type: object + TeamConnection: + description: A relationship between a Datadog team and a team from another external + system. + properties: + attributes: + $ref: '#/components/schemas/TeamConnectionAttributes' + id: + description: The unique identifier of the team connection. + example: 12345678-1234-5678-9abc-123456789012 + type: string + relationships: + $ref: '#/components/schemas/TeamConnectionRelationships' + type: + $ref: '#/components/schemas/TeamConnectionType' + required: + - id + - type + type: object + TeamConnectionAttributes: + description: Attributes of the team connection. + properties: + managed_by: + description: The entity that manages this team connection. + example: github_sync + type: string + source: + description: The name of the external source. + example: github + type: string + type: object + TeamConnectionCreateData: + description: Data for creating a team connection. + properties: + attributes: + $ref: '#/components/schemas/TeamConnectionAttributes' + relationships: + $ref: '#/components/schemas/TeamConnectionRelationships' + type: + $ref: '#/components/schemas/TeamConnectionType' + required: + - type + type: object + TeamConnectionCreateRequest: + description: Request for creating team connections. + properties: + data: + description: Array of team connections to create. + items: + $ref: '#/components/schemas/TeamConnectionCreateData' + type: array + required: + - data + type: object + TeamConnectionDeleteRequest: + description: Request for deleting team connections. + properties: + data: + description: Array of team connection IDs to delete. + items: + $ref: '#/components/schemas/TeamConnectionDeleteRequestDataItem' + type: array + required: + - data + type: object + TeamConnectionDeleteRequestDataItem: + description: A collection of connection ids to delete. + properties: + id: + description: The unique identifier of the team connection to delete. + example: 12345678-1234-5678-9abc-123456789012 + type: string + type: + $ref: '#/components/schemas/TeamConnectionType' + required: + - id + - type + type: object + TeamConnectionRelationships: + description: Relationships of the team connection. + properties: + connected_team: + $ref: '#/components/schemas/ConnectedTeamRef' + team: + $ref: '#/components/schemas/TeamRef' + type: object + TeamConnectionType: + default: team_connection + description: Team connection resource type. + enum: + - team_connection + example: team_connection + type: string + x-enum-varnames: + - TEAM_CONNECTION + TeamConnectionsResponse: + description: Response containing information about multiple team connections. + properties: + data: + description: Array of team connections. + items: + $ref: '#/components/schemas/TeamConnection' + type: array + meta: + $ref: '#/components/schemas/ConnectionsResponseMeta' + type: object TeamCreate: description: Team create properties: @@ -51731,6 +51909,34 @@ components: $ref: '#/components/schemas/TeamPermissionSetting' type: array type: object + TeamRef: + description: Reference to a Datadog team. + properties: + data: + $ref: '#/components/schemas/TeamRefData' + type: object + TeamRefData: + description: Reference to a Datadog team. + properties: + id: + description: The Datadog team ID. + example: 87654321-4321-8765-dcba-210987654321 + type: string + type: + $ref: '#/components/schemas/TeamRefDataType' + required: + - id + - type + type: object + TeamRefDataType: + default: team + description: Datadog team resource type. + enum: + - team + example: team + type: string + x-enum-varnames: + - TEAM TeamReference: description: Provides a reference to a team, including ID, type, and basic attributes/relationships. properties: @@ -80747,6 +80953,180 @@ paths: permissions: - teams_read - teams_manage + /api/v2/team/connections: + delete: + description: Delete multiple team connections. + operationId: DeleteTeamConnections + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamConnectionDeleteRequest' + required: true + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Delete team connections + tags: + - Team Connections + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: '**Note**: This endpoint is in Preview. To request access, fill + out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/). + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Returns all team connections. + operationId: ListTeamConnections + parameters: + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + - description: Specific offset to start retrieving results from. + in: query + name: page[offset] + required: false + schema: + format: int64 + type: integer + - description: Maximum number of results to return. + in: query + name: page[limit] + required: false + schema: + format: int64 + type: integer + - description: Filter team connections by external source systems. + explode: false + in: query + name: filter[sources] + required: false + schema: + items: + example: github + type: string + type: array + style: form + - description: Filter team connections by Datadog team IDs. + explode: false + in: query + name: filter[team_ids] + required: false + schema: + items: + example: 12345678-1234-5678-9abc-123456789012 + type: string + type: array + style: form + - description: Filter team connections by connected team IDs from external systems. + explode: false + in: query + name: filter[connected_team_ids] + required: false + schema: + items: + example: '@MyGitHubAccount/my-team-name' + type: string + type: array + style: form + - description: Filter team connections by connection IDs. + explode: false + in: query + name: filter[connection_ids] + required: false + schema: + items: + example: 12345678-1234-5678-9abc-123456789012 + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamConnectionsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: List team connections + tags: + - Team Connections + 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. To request access, fill + out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/). + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create multiple team connections. + operationId: CreateTeamConnections + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamConnectionCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamConnectionsResponse' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Create team connections + tags: + - Team Connections + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: '**Note**: This endpoint is in Preview. To request access, fill + out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/). + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/sync: post: description: 'This endpoint attempts to link your existing Datadog teams with @@ -83952,6 +84332,9 @@ 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/team-connections/CreateTeamConnections.java new file mode 100644 index 00000000000..10005f510ae --- /dev/null +++ b/examples/v2/team-connections/CreateTeamConnections.java @@ -0,0 +1,63 @@ +// Create team connections returns "Created" response + +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.model.ConnectedTeamRef; +import com.datadog.api.client.v2.model.ConnectedTeamRefData; +import com.datadog.api.client.v2.model.ConnectedTeamRefDataType; +import com.datadog.api.client.v2.model.TeamConnectionAttributes; +import com.datadog.api.client.v2.model.TeamConnectionCreateData; +import com.datadog.api.client.v2.model.TeamConnectionCreateRequest; +import com.datadog.api.client.v2.model.TeamConnectionRelationships; +import com.datadog.api.client.v2.model.TeamConnectionType; +import com.datadog.api.client.v2.model.TeamConnectionsResponse; +import com.datadog.api.client.v2.model.TeamRef; +import com.datadog.api.client.v2.model.TeamRefData; +import com.datadog.api.client.v2.model.TeamRefDataType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createTeamConnections", true); + TeamConnectionsApi apiInstance = new TeamConnectionsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + TeamConnectionCreateRequest body = + new TeamConnectionCreateRequest() + .data( + Collections.singletonList( + new TeamConnectionCreateData() + .type(TeamConnectionType.TEAM_CONNECTION) + .attributes( + new TeamConnectionAttributes().source("github").managedBy("datadog")) + .relationships( + new TeamConnectionRelationships() + .team( + new TeamRef() + .data( + new TeamRefData() + .id(DD_TEAM_DATA_ID) + .type(TeamRefDataType.TEAM))) + .connectedTeam( + new ConnectedTeamRef() + .data( + new ConnectedTeamRefData() + .id("@MyGitHubAccount/my-team-name") + .type(ConnectedTeamRefDataType.GITHUB_TEAM)))))); + + try { + TeamConnectionsResponse result = apiInstance.createTeamConnections(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamConnectionsApi#createTeamConnections"); + 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/team-connections/DeleteTeamConnections.java b/examples/v2/team-connections/DeleteTeamConnections.java new file mode 100644 index 00000000000..b025218baea --- /dev/null +++ b/examples/v2/team-connections/DeleteTeamConnections.java @@ -0,0 +1,35 @@ +// Delete team connections returns "No Content" response + +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.model.TeamConnectionDeleteRequest; +import com.datadog.api.client.v2.model.TeamConnectionDeleteRequestDataItem; +import com.datadog.api.client.v2.model.TeamConnectionType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteTeamConnections", true); + TeamConnectionsApi apiInstance = new TeamConnectionsApi(defaultClient); + + TeamConnectionDeleteRequest body = + new TeamConnectionDeleteRequest() + .data( + Collections.singletonList( + new TeamConnectionDeleteRequestDataItem() + .id("12345678-1234-5678-9abc-123456789012") + .type(TeamConnectionType.TEAM_CONNECTION))); + + try { + apiInstance.deleteTeamConnections(body); + } catch (ApiException e) { + System.err.println("Exception when calling TeamConnectionsApi#deleteTeamConnections"); + 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/team-connections/ListTeamConnections.java b/examples/v2/team-connections/ListTeamConnections.java new file mode 100644 index 00000000000..0dc57217411 --- /dev/null +++ b/examples/v2/team-connections/ListTeamConnections.java @@ -0,0 +1,25 @@ +// List team connections returns "OK" response + +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.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); + + try { + TeamConnectionsResponse result = apiInstance.listTeamConnections(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamConnectionsApi#listTeamConnections"); + 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/team-connections/ListTeamConnections_1473516764.java b/examples/v2/team-connections/ListTeamConnections_1473516764.java new file mode 100644 index 00000000000..747fb180a95 --- /dev/null +++ b/examples/v2/team-connections/ListTeamConnections_1473516764.java @@ -0,0 +1,31 @@ +// List team connections with filters returns "OK" response + +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.model.TeamConnectionsResponse; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listTeamConnections", true); + TeamConnectionsApi apiInstance = new TeamConnectionsApi(defaultClient); + + try { + TeamConnectionsResponse result = + apiInstance.listTeamConnections( + new ListTeamConnectionsOptionalParameters() + .filterSources(Collections.singletonList("github")) + .pageSize(10L)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamConnectionsApi#listTeamConnections"); + 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/team-connections/ListTeamConnections_2418873869.java b/examples/v2/team-connections/ListTeamConnections_2418873869.java new file mode 100644 index 00000000000..616c8e5f689 --- /dev/null +++ b/examples/v2/team-connections/ListTeamConnections_2418873869.java @@ -0,0 +1,27 @@ +// List team connections returns "OK" response with pagination + +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.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); + + try { + PaginationIterable iterable = apiInstance.listTeamConnectionsWithPagination(); + + for (TeamConnection item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println( + "Exception when calling TeamConnectionsApi#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 a581f136f0c..68903e5ee1f 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -815,6 +815,9 @@ public class ApiClient { put("v2.listMemberTeams", 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 new file mode 100644 index 00000000000..c0cf0980e8c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/TeamConnectionsApi.java @@ -0,0 +1,711 @@ +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 Long pageOffset; + private Long pageLimit; + 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 pageOffset. + * + * @param pageOffset Specific offset to start retrieving results from. (optional) + * @return ListTeamConnectionsOptionalParameters + */ + public ListTeamConnectionsOptionalParameters pageOffset(Long pageOffset) { + this.pageOffset = pageOffset; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit Maximum number of results to return. (optional) + * @return ListTeamConnectionsOptionalParameters + */ + public ListTeamConnectionsOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; + 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; + Long pageOffset = parameters.pageOffset; + Long pageLimit = parameters.pageLimit; + 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("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + 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; + Long pageOffset = parameters.pageOffset; + Long pageLimit = parameters.pageLimit; + 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("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + 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/model/ConnectedTeamRef.java b/src/main/java/com/datadog/api/client/v2/model/ConnectedTeamRef.java new file mode 100644 index 00000000000..c03fa74283c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConnectedTeamRef.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Reference to a team from an external system. */ +@JsonPropertyOrder({ConnectedTeamRef.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConnectedTeamRef { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ConnectedTeamRefData data; + + public ConnectedTeamRef data(ConnectedTeamRefData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Reference to connected external team. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ConnectedTeamRefData getData() { + return data; + } + + public void setData(ConnectedTeamRefData 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 ConnectedTeamRef + */ + @JsonAnySetter + public ConnectedTeamRef 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 ConnectedTeamRef object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConnectedTeamRef connectedTeamRef = (ConnectedTeamRef) o; + return Objects.equals(this.data, connectedTeamRef.data) + && Objects.equals(this.additionalProperties, connectedTeamRef.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConnectedTeamRef {\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/ConnectedTeamRefData.java b/src/main/java/com/datadog/api/client/v2/model/ConnectedTeamRefData.java new file mode 100644 index 00000000000..7f092e93e91 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConnectedTeamRefData.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; + +/** Reference to connected external team. */ +@JsonPropertyOrder({ConnectedTeamRefData.JSON_PROPERTY_ID, ConnectedTeamRefData.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConnectedTeamRefData { + @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 ConnectedTeamRefDataType type = ConnectedTeamRefDataType.GITHUB_TEAM; + + public ConnectedTeamRefData() {} + + @JsonCreator + public ConnectedTeamRefData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ConnectedTeamRefDataType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ConnectedTeamRefData id(String id) { + this.id = id; + return this; + } + + /** + * The connected team ID as it is referenced throughout the Datadog ecosystem. + * + * @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 ConnectedTeamRefData type(ConnectedTeamRefDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * External team resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ConnectedTeamRefDataType getType() { + return type; + } + + public void setType(ConnectedTeamRefDataType 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 ConnectedTeamRefData + */ + @JsonAnySetter + public ConnectedTeamRefData 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 ConnectedTeamRefData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConnectedTeamRefData connectedTeamRefData = (ConnectedTeamRefData) o; + return Objects.equals(this.id, connectedTeamRefData.id) + && Objects.equals(this.type, connectedTeamRefData.type) + && Objects.equals(this.additionalProperties, connectedTeamRefData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConnectedTeamRefData {\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/ConnectedTeamRefDataType.java b/src/main/java/com/datadog/api/client/v2/model/ConnectedTeamRefDataType.java new file mode 100644 index 00000000000..8094bbcd045 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConnectedTeamRefDataType.java @@ -0,0 +1,57 @@ +/* + * 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; + +/** External team resource type. */ +@JsonSerialize(using = ConnectedTeamRefDataType.ConnectedTeamRefDataTypeSerializer.class) +public class ConnectedTeamRefDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("github_team")); + + public static final ConnectedTeamRefDataType GITHUB_TEAM = + new ConnectedTeamRefDataType("github_team"); + + ConnectedTeamRefDataType(String value) { + super(value, allowedValues); + } + + public static class ConnectedTeamRefDataTypeSerializer + extends StdSerializer { + public ConnectedTeamRefDataTypeSerializer(Class t) { + super(t); + } + + public ConnectedTeamRefDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ConnectedTeamRefDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ConnectedTeamRefDataType fromValue(String value) { + return new ConnectedTeamRefDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConnectionsPagePagination.java b/src/main/java/com/datadog/api/client/v2/model/ConnectionsPagePagination.java new file mode 100644 index 00000000000..3a084c08949 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConnectionsPagePagination.java @@ -0,0 +1,357 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Page-based pagination metadata. */ +@JsonPropertyOrder({ + ConnectionsPagePagination.JSON_PROPERTY_FIRST_NUMBER, + ConnectionsPagePagination.JSON_PROPERTY_LAST_NUMBER, + ConnectionsPagePagination.JSON_PROPERTY_NEXT_NUMBER, + ConnectionsPagePagination.JSON_PROPERTY_NUMBER, + ConnectionsPagePagination.JSON_PROPERTY_PREV_NUMBER, + ConnectionsPagePagination.JSON_PROPERTY_SIZE, + ConnectionsPagePagination.JSON_PROPERTY_TOTAL, + ConnectionsPagePagination.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConnectionsPagePagination { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FIRST_NUMBER = "first_number"; + private Long firstNumber; + + public static final String JSON_PROPERTY_LAST_NUMBER = "last_number"; + private Long lastNumber; + + public static final String JSON_PROPERTY_NEXT_NUMBER = "next_number"; + private JsonNullable nextNumber = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NUMBER = "number"; + private Long number; + + public static final String JSON_PROPERTY_PREV_NUMBER = "prev_number"; + private JsonNullable prevNumber = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SIZE = "size"; + private Long size; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public ConnectionsPagePagination firstNumber(Long firstNumber) { + this.firstNumber = firstNumber; + return this; + } + + /** + * The first page number. + * + * @return firstNumber + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIRST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getFirstNumber() { + return firstNumber; + } + + public void setFirstNumber(Long firstNumber) { + this.firstNumber = firstNumber; + } + + public ConnectionsPagePagination lastNumber(Long lastNumber) { + this.lastNumber = lastNumber; + return this; + } + + /** + * The last page number. + * + * @return lastNumber + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLastNumber() { + return lastNumber; + } + + public void setLastNumber(Long lastNumber) { + this.lastNumber = lastNumber; + } + + public ConnectionsPagePagination nextNumber(Long nextNumber) { + this.nextNumber = JsonNullable.of(nextNumber); + return this; + } + + /** + * The next page number. + * + * @return nextNumber + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getNextNumber() { + return nextNumber.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NEXT_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getNextNumber_JsonNullable() { + return nextNumber; + } + + @JsonProperty(JSON_PROPERTY_NEXT_NUMBER) + public void setNextNumber_JsonNullable(JsonNullable nextNumber) { + this.nextNumber = nextNumber; + } + + public void setNextNumber(Long nextNumber) { + this.nextNumber = JsonNullable.of(nextNumber); + } + + public ConnectionsPagePagination number(Long number) { + this.number = number; + return this; + } + + /** + * The current page number. + * + * @return number + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getNumber() { + return number; + } + + public void setNumber(Long number) { + this.number = number; + } + + public ConnectionsPagePagination prevNumber(Long prevNumber) { + this.prevNumber = JsonNullable.of(prevNumber); + return this; + } + + /** + * The previous page number. + * + * @return prevNumber + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getPrevNumber() { + return prevNumber.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PREV_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPrevNumber_JsonNullable() { + return prevNumber; + } + + @JsonProperty(JSON_PROPERTY_PREV_NUMBER) + public void setPrevNumber_JsonNullable(JsonNullable prevNumber) { + this.prevNumber = prevNumber; + } + + public void setPrevNumber(Long prevNumber) { + this.prevNumber = JsonNullable.of(prevNumber); + } + + public ConnectionsPagePagination size(Long size) { + this.size = size; + return this; + } + + /** + * The page size. + * + * @return size + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + public ConnectionsPagePagination total(Long total) { + this.total = total; + return this; + } + + /** + * Total connections matching request. + * + * @return total + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + public ConnectionsPagePagination type(String type) { + this.type = type; + return this; + } + + /** + * Pagination type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + 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 ConnectionsPagePagination + */ + @JsonAnySetter + public ConnectionsPagePagination 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 ConnectionsPagePagination object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConnectionsPagePagination connectionsPagePagination = (ConnectionsPagePagination) o; + return Objects.equals(this.firstNumber, connectionsPagePagination.firstNumber) + && Objects.equals(this.lastNumber, connectionsPagePagination.lastNumber) + && Objects.equals(this.nextNumber, connectionsPagePagination.nextNumber) + && Objects.equals(this.number, connectionsPagePagination.number) + && Objects.equals(this.prevNumber, connectionsPagePagination.prevNumber) + && Objects.equals(this.size, connectionsPagePagination.size) + && Objects.equals(this.total, connectionsPagePagination.total) + && Objects.equals(this.type, connectionsPagePagination.type) + && Objects.equals( + this.additionalProperties, connectionsPagePagination.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + firstNumber, + lastNumber, + nextNumber, + number, + prevNumber, + size, + total, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConnectionsPagePagination {\n"); + sb.append(" firstNumber: ").append(toIndentedString(firstNumber)).append("\n"); + sb.append(" lastNumber: ").append(toIndentedString(lastNumber)).append("\n"); + sb.append(" nextNumber: ").append(toIndentedString(nextNumber)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" prevNumber: ").append(toIndentedString(prevNumber)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/ConnectionsResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/ConnectionsResponseMeta.java new file mode 100644 index 00000000000..d16c7759833 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConnectionsResponseMeta.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Connections response metadata. */ +@JsonPropertyOrder({ConnectionsResponseMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConnectionsResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private ConnectionsPagePagination page; + + public ConnectionsResponseMeta page(ConnectionsPagePagination page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Page-based pagination metadata. + * + * @return page + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ConnectionsPagePagination getPage() { + return page; + } + + public void setPage(ConnectionsPagePagination page) { + this.page = page; + } + + /** + * 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 ConnectionsResponseMeta + */ + @JsonAnySetter + public ConnectionsResponseMeta 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 ConnectionsResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConnectionsResponseMeta connectionsResponseMeta = (ConnectionsResponseMeta) o; + return Objects.equals(this.page, connectionsResponseMeta.page) + && Objects.equals(this.additionalProperties, connectionsResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConnectionsResponseMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).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/TeamConnection.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnection.java new file mode 100644 index 00000000000..94147bf9297 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnection.java @@ -0,0 +1,234 @@ +/* + * 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 relationship between a Datadog team and a team from another external system. */ +@JsonPropertyOrder({ + TeamConnection.JSON_PROPERTY_ATTRIBUTES, + TeamConnection.JSON_PROPERTY_ID, + TeamConnection.JSON_PROPERTY_RELATIONSHIPS, + TeamConnection.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamConnection { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TeamConnectionAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private TeamConnectionRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamConnectionType type = TeamConnectionType.TEAM_CONNECTION; + + public TeamConnection() {} + + @JsonCreator + public TeamConnection( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamConnectionType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamConnection attributes(TeamConnectionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the team connection. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamConnectionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TeamConnectionAttributes attributes) { + this.attributes = attributes; + } + + public TeamConnection id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the team connection. + * + * @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 TeamConnection relationships(TeamConnectionRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships of the team connection. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamConnectionRelationships getRelationships() { + return relationships; + } + + public void setRelationships(TeamConnectionRelationships relationships) { + this.relationships = relationships; + } + + public TeamConnection type(TeamConnectionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Team connection resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamConnectionType getType() { + return type; + } + + public void setType(TeamConnectionType 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 TeamConnection + */ + @JsonAnySetter + public TeamConnection 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 TeamConnection object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamConnection teamConnection = (TeamConnection) o; + return Objects.equals(this.attributes, teamConnection.attributes) + && Objects.equals(this.id, teamConnection.id) + && Objects.equals(this.relationships, teamConnection.relationships) + && Objects.equals(this.type, teamConnection.type) + && Objects.equals(this.additionalProperties, teamConnection.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamConnection {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/TeamConnectionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionAttributes.java new file mode 100644 index 00000000000..461f883e563 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionAttributes.java @@ -0,0 +1,164 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of the team connection. */ +@JsonPropertyOrder({ + TeamConnectionAttributes.JSON_PROPERTY_MANAGED_BY, + TeamConnectionAttributes.JSON_PROPERTY_SOURCE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamConnectionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_MANAGED_BY = "managed_by"; + private String managedBy; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private String source; + + public TeamConnectionAttributes managedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * The entity that manages this team connection. + * + * @return managedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MANAGED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getManagedBy() { + return managedBy; + } + + public void setManagedBy(String managedBy) { + this.managedBy = managedBy; + } + + public TeamConnectionAttributes source(String source) { + this.source = source; + return this; + } + + /** + * The name of the external source. + * + * @return source + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + /** + * 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 TeamConnectionAttributes + */ + @JsonAnySetter + public TeamConnectionAttributes 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 TeamConnectionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamConnectionAttributes teamConnectionAttributes = (TeamConnectionAttributes) o; + return Objects.equals(this.managedBy, teamConnectionAttributes.managedBy) + && Objects.equals(this.source, teamConnectionAttributes.source) + && Objects.equals(this.additionalProperties, teamConnectionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(managedBy, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamConnectionAttributes {\n"); + sb.append(" managedBy: ").append(toIndentedString(managedBy)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).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/TeamConnectionCreateData.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionCreateData.java new file mode 100644 index 00000000000..4e507e7f74a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionCreateData.java @@ -0,0 +1,206 @@ +/* + * 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; + +/** Data for creating a team connection. */ +@JsonPropertyOrder({ + TeamConnectionCreateData.JSON_PROPERTY_ATTRIBUTES, + TeamConnectionCreateData.JSON_PROPERTY_RELATIONSHIPS, + TeamConnectionCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamConnectionCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TeamConnectionAttributes attributes; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private TeamConnectionRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamConnectionType type = TeamConnectionType.TEAM_CONNECTION; + + public TeamConnectionCreateData() {} + + @JsonCreator + public TeamConnectionCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamConnectionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamConnectionCreateData attributes(TeamConnectionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the team connection. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamConnectionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TeamConnectionAttributes attributes) { + this.attributes = attributes; + } + + public TeamConnectionCreateData relationships(TeamConnectionRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships of the team connection. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamConnectionRelationships getRelationships() { + return relationships; + } + + public void setRelationships(TeamConnectionRelationships relationships) { + this.relationships = relationships; + } + + public TeamConnectionCreateData type(TeamConnectionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Team connection resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamConnectionType getType() { + return type; + } + + public void setType(TeamConnectionType 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 TeamConnectionCreateData + */ + @JsonAnySetter + public TeamConnectionCreateData 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 TeamConnectionCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamConnectionCreateData teamConnectionCreateData = (TeamConnectionCreateData) o; + return Objects.equals(this.attributes, teamConnectionCreateData.attributes) + && Objects.equals(this.relationships, teamConnectionCreateData.relationships) + && Objects.equals(this.type, teamConnectionCreateData.type) + && Objects.equals(this.additionalProperties, teamConnectionCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamConnectionCreateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/TeamConnectionCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionCreateRequest.java new file mode 100644 index 00000000000..bdb6bf2cf13 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionCreateRequest.java @@ -0,0 +1,156 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Request for creating team connections. */ +@JsonPropertyOrder({TeamConnectionCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamConnectionCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public TeamConnectionCreateRequest() {} + + @JsonCreator + public TeamConnectionCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public TeamConnectionCreateRequest data(List data) { + this.data = data; + for (TeamConnectionCreateData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamConnectionCreateRequest addDataItem(TeamConnectionCreateData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of team connections to create. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TeamConnectionCreateRequest + */ + @JsonAnySetter + public TeamConnectionCreateRequest 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 TeamConnectionCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamConnectionCreateRequest teamConnectionCreateRequest = (TeamConnectionCreateRequest) o; + return Objects.equals(this.data, teamConnectionCreateRequest.data) + && Objects.equals( + this.additionalProperties, teamConnectionCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamConnectionCreateRequest {\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/TeamConnectionDeleteRequest.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionDeleteRequest.java new file mode 100644 index 00000000000..3730e1e2350 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionDeleteRequest.java @@ -0,0 +1,156 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Request for deleting team connections. */ +@JsonPropertyOrder({TeamConnectionDeleteRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamConnectionDeleteRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public TeamConnectionDeleteRequest() {} + + @JsonCreator + public TeamConnectionDeleteRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public TeamConnectionDeleteRequest data(List data) { + this.data = data; + for (TeamConnectionDeleteRequestDataItem item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamConnectionDeleteRequest addDataItem(TeamConnectionDeleteRequestDataItem dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of team connection IDs to delete. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TeamConnectionDeleteRequest + */ + @JsonAnySetter + public TeamConnectionDeleteRequest 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 TeamConnectionDeleteRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamConnectionDeleteRequest teamConnectionDeleteRequest = (TeamConnectionDeleteRequest) o; + return Objects.equals(this.data, teamConnectionDeleteRequest.data) + && Objects.equals( + this.additionalProperties, teamConnectionDeleteRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamConnectionDeleteRequest {\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/TeamConnectionDeleteRequestDataItem.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionDeleteRequestDataItem.java new file mode 100644 index 00000000000..41464e66fd3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionDeleteRequestDataItem.java @@ -0,0 +1,180 @@ +/* + * 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 collection of connection ids to delete. */ +@JsonPropertyOrder({ + TeamConnectionDeleteRequestDataItem.JSON_PROPERTY_ID, + TeamConnectionDeleteRequestDataItem.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamConnectionDeleteRequestDataItem { + @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 TeamConnectionType type = TeamConnectionType.TEAM_CONNECTION; + + public TeamConnectionDeleteRequestDataItem() {} + + @JsonCreator + public TeamConnectionDeleteRequestDataItem( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamConnectionType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamConnectionDeleteRequestDataItem id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the team connection to delete. + * + * @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 TeamConnectionDeleteRequestDataItem type(TeamConnectionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Team connection resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamConnectionType getType() { + return type; + } + + public void setType(TeamConnectionType 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 TeamConnectionDeleteRequestDataItem + */ + @JsonAnySetter + public TeamConnectionDeleteRequestDataItem 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 TeamConnectionDeleteRequestDataItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamConnectionDeleteRequestDataItem teamConnectionDeleteRequestDataItem = + (TeamConnectionDeleteRequestDataItem) o; + return Objects.equals(this.id, teamConnectionDeleteRequestDataItem.id) + && Objects.equals(this.type, teamConnectionDeleteRequestDataItem.type) + && Objects.equals( + this.additionalProperties, teamConnectionDeleteRequestDataItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamConnectionDeleteRequestDataItem {\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/TeamConnectionRelationships.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionRelationships.java new file mode 100644 index 00000000000..51a0acd64e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionRelationships.java @@ -0,0 +1,167 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationships of the team connection. */ +@JsonPropertyOrder({ + TeamConnectionRelationships.JSON_PROPERTY_CONNECTED_TEAM, + TeamConnectionRelationships.JSON_PROPERTY_TEAM +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamConnectionRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONNECTED_TEAM = "connected_team"; + private ConnectedTeamRef connectedTeam; + + public static final String JSON_PROPERTY_TEAM = "team"; + private TeamRef team; + + public TeamConnectionRelationships connectedTeam(ConnectedTeamRef connectedTeam) { + this.connectedTeam = connectedTeam; + this.unparsed |= connectedTeam.unparsed; + return this; + } + + /** + * Reference to a team from an external system. + * + * @return connectedTeam + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONNECTED_TEAM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ConnectedTeamRef getConnectedTeam() { + return connectedTeam; + } + + public void setConnectedTeam(ConnectedTeamRef connectedTeam) { + this.connectedTeam = connectedTeam; + } + + public TeamConnectionRelationships team(TeamRef team) { + this.team = team; + this.unparsed |= team.unparsed; + return this; + } + + /** + * Reference to a Datadog team. + * + * @return team + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEAM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamRef getTeam() { + return team; + } + + public void setTeam(TeamRef team) { + this.team = team; + } + + /** + * 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 TeamConnectionRelationships + */ + @JsonAnySetter + public TeamConnectionRelationships 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 TeamConnectionRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamConnectionRelationships teamConnectionRelationships = (TeamConnectionRelationships) o; + return Objects.equals(this.connectedTeam, teamConnectionRelationships.connectedTeam) + && Objects.equals(this.team, teamConnectionRelationships.team) + && Objects.equals( + this.additionalProperties, teamConnectionRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(connectedTeam, team, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamConnectionRelationships {\n"); + sb.append(" connectedTeam: ").append(toIndentedString(connectedTeam)).append("\n"); + sb.append(" team: ").append(toIndentedString(team)).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/TeamConnectionType.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionType.java new file mode 100644 index 00000000000..eb1f016d0ae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionType.java @@ -0,0 +1,55 @@ +/* + * 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; + +/** Team connection resource type. */ +@JsonSerialize(using = TeamConnectionType.TeamConnectionTypeSerializer.class) +public class TeamConnectionType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("team_connection")); + + public static final TeamConnectionType TEAM_CONNECTION = + new TeamConnectionType("team_connection"); + + TeamConnectionType(String value) { + super(value, allowedValues); + } + + public static class TeamConnectionTypeSerializer extends StdSerializer { + public TeamConnectionTypeSerializer(Class t) { + super(t); + } + + public TeamConnectionTypeSerializer() { + this(null); + } + + @Override + public void serialize(TeamConnectionType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamConnectionType fromValue(String value) { + return new TeamConnectionType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamConnectionsResponse.java b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionsResponse.java new file mode 100644 index 00000000000..0549823e4cc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamConnectionsResponse.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing information about multiple team connections. */ +@JsonPropertyOrder({ + TeamConnectionsResponse.JSON_PROPERTY_DATA, + TeamConnectionsResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamConnectionsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_META = "meta"; + private ConnectionsResponseMeta meta; + + public TeamConnectionsResponse data(List data) { + this.data = data; + for (TeamConnection item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamConnectionsResponse addDataItem(TeamConnection dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of team connections. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public TeamConnectionsResponse meta(ConnectionsResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Connections response metadata. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ConnectionsResponseMeta getMeta() { + return meta; + } + + public void setMeta(ConnectionsResponseMeta meta) { + this.meta = meta; + } + + /** + * 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 TeamConnectionsResponse + */ + @JsonAnySetter + public TeamConnectionsResponse 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 TeamConnectionsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamConnectionsResponse teamConnectionsResponse = (TeamConnectionsResponse) o; + return Objects.equals(this.data, teamConnectionsResponse.data) + && Objects.equals(this.meta, teamConnectionsResponse.meta) + && Objects.equals(this.additionalProperties, teamConnectionsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamConnectionsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/TeamRef.java b/src/main/java/com/datadog/api/client/v2/model/TeamRef.java new file mode 100644 index 00000000000..aebc736b4aa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRef.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Reference to a Datadog team. */ +@JsonPropertyOrder({TeamRef.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRef { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TeamRefData data; + + public TeamRef data(TeamRefData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Reference to a Datadog team. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamRefData getData() { + return data; + } + + public void setData(TeamRefData 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 TeamRef + */ + @JsonAnySetter + public TeamRef 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 TeamRef object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRef teamRef = (TeamRef) o; + return Objects.equals(this.data, teamRef.data) + && Objects.equals(this.additionalProperties, teamRef.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRef {\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/TeamRefData.java b/src/main/java/com/datadog/api/client/v2/model/TeamRefData.java new file mode 100644 index 00000000000..099d3600a08 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRefData.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; + +/** Reference to a Datadog team. */ +@JsonPropertyOrder({TeamRefData.JSON_PROPERTY_ID, TeamRefData.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRefData { + @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 TeamRefDataType type = TeamRefDataType.TEAM; + + public TeamRefData() {} + + @JsonCreator + public TeamRefData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamRefDataType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamRefData id(String id) { + this.id = id; + return this; + } + + /** + * The Datadog team ID. + * + * @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 TeamRefData type(TeamRefDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Datadog team resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamRefDataType getType() { + return type; + } + + public void setType(TeamRefDataType 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 TeamRefData + */ + @JsonAnySetter + public TeamRefData 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 TeamRefData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRefData teamRefData = (TeamRefData) o; + return Objects.equals(this.id, teamRefData.id) + && Objects.equals(this.type, teamRefData.type) + && Objects.equals(this.additionalProperties, teamRefData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRefData {\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/TeamRefDataType.java b/src/main/java/com/datadog/api/client/v2/model/TeamRefDataType.java new file mode 100644 index 00000000000..a0954c58afc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRefDataType.java @@ -0,0 +1,53 @@ +/* + * 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; + +/** Datadog team resource type. */ +@JsonSerialize(using = TeamRefDataType.TeamRefDataTypeSerializer.class) +public class TeamRefDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("team")); + + public static final TeamRefDataType TEAM = new TeamRefDataType("team"); + + TeamRefDataType(String value) { + super(value, allowedValues); + } + + public static class TeamRefDataTypeSerializer extends StdSerializer { + public TeamRefDataTypeSerializer(Class t) { + super(t); + } + + public TeamRefDataTypeSerializer() { + this(null); + } + + @Override + public void serialize(TeamRefDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamRefDataType fromValue(String value) { + return new TeamRefDataType(value); + } +} 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 12852be0f21..b67e2d5adcd 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 @@ -1141,6 +1141,13 @@ "tag": "Teams", "operationId": "CreateTeam" }, + { + "source": "data.data[0]", + "step": "there is a valid \"team_connection\" in the system", + "key": "team_connection", + "tag": "Team Connections", + "operationId": "CreateTeamConnections" + }, { "parameters": [ { 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 new file mode 100644 index 00000000000..49a0d92f5e6 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/team_connections.feature @@ -0,0 +1,93 @@ +@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": "@MyGitHubAccount/my-team-name", "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/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index cd8c18bf078..d25ca0a4dba 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 @@ -4268,6 +4268,25 @@ "type": "unsafe" } }, + "DeleteTeamConnections": { + "tag": "Team Connections", + "undo": { + "type": "idempotent" + } + }, + "ListTeamConnections": { + "tag": "Team Connections", + "undo": { + "type": "safe" + } + }, + "CreateTeamConnections": { + "tag": "Team Connections", + "undo": { + "operationId": "DeleteTeamConnections", + "type": "unsafe" + } + }, "SyncTeams": { "tag": "Teams", "undo": {