From 241981449badcbffe857841aecd40e7446083c0e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 14 Jul 2025 13:52:56 +0000 Subject: [PATCH] Regenerate client from commit a5e8c5b3 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 256 ++++++++ examples/v2/datasets/CreateDataset.java | 48 ++ examples/v2/datasets/DeleteDataset.java | 22 + examples/v2/datasets/GetAllDatasets.java | 24 + examples/v2/datasets/GetDataset.java | 24 + .../api/client/v2/api/DatasetsApi.java | 557 ++++++++++++++++++ .../datadog/api/client/v2/model/Dataset.java | 202 +++++++ .../client/v2/model/DatasetAttributes.java | 287 +++++++++ .../client/v2/model/DatasetCreateRequest.java | 145 +++++ .../client/v2/model/DatasetResponseMulti.java | 154 +++++ .../v2/model/DatasetResponseSingle.java | 145 +++++ .../client/v2/model/FiltersPerProduct.java | 184 ++++++ .../api/client/v2/api/datasets.feature | 81 +++ .../com/datadog/api/client/v2/api/undo.json | 31 + 15 files changed, 2164 insertions(+), 4 deletions(-) create mode 100644 examples/v2/datasets/CreateDataset.java create mode 100644 examples/v2/datasets/DeleteDataset.java create mode 100644 examples/v2/datasets/GetAllDatasets.java create mode 100644 examples/v2/datasets/GetDataset.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/DatasetsApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/Dataset.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatasetAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatasetCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatasetResponseMulti.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatasetResponseSingle.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FiltersPerProduct.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/datasets.feature diff --git a/.apigentools-info b/.apigentools-info index 8db1964f6a2..4189f28d88d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-11 20:58:18.515089", - "spec_repo_commit": "b5c3e077" + "regenerated": "2025-07-14 13:51:00.551702", + "spec_repo_commit": "a5e8c5b3" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-11 20:58:18.530844", - "spec_repo_commit": "b5c3e077" + "regenerated": "2025-07-14 13:51:00.567924", + "spec_repo_commit": "a5e8c5b3" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 347ca00003e..cab25efed27 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -288,6 +288,14 @@ components: required: true schema: type: string + DatasetID: + description: The ID of a defined dataset. + example: 0879ce27-29a1-481f-a12e-bc2a48ec9ae1 + in: path + name: dataset_id + required: true + schema: + type: string EntityID: description: UUID or Entity Ref. in: path @@ -12178,6 +12186,85 @@ components: required: - databaseMonitoringTrigger type: object + Dataset: + description: Dataset object. + properties: + attributes: + $ref: '#/components/schemas/DatasetAttributes' + id: + description: Unique identifier for the dataset. + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + type: + description: Resource type, always "dataset". + example: dataset + type: string + required: + - type + - attributes + type: object + DatasetAttributes: + description: Dataset metadata and configuration(s). + properties: + created_at: + description: Timestamp when the dataset was created. + format: date-time + nullable: true + type: string + created_by: + description: Unique ID of the user who created the dataset. + format: uuid + type: string + name: + description: Name of the dataset. + example: Security Audit Dataset + type: string + principals: + description: List of access principals, formatted as `principal_type:id`. + Principal can be 'team' or 'role'. + example: + - role:86245fce-0a4e-11f0-92bd-da7ad0900002 + items: + example: role:86245fce-0a4e-11f0-92bd-da7ad0900002 + type: string + type: array + product_filters: + description: List of product-specific filters. + items: + $ref: '#/components/schemas/FiltersPerProduct' + type: array + required: + - name + - product_filters + - principals + type: object + DatasetCreateRequest: + description: Create request for a dataset. + properties: + data: + $ref: '#/components/schemas/Dataset' + required: + - data + type: object + DatasetResponseMulti: + description: Response containing a list of datasets. + properties: + data: + description: The list of datasets returned in response. + items: + $ref: '#/components/schemas/Dataset' + type: array + required: + - data + type: object + DatasetResponseSingle: + description: Response containing a single dataset object. + properties: + data: + $ref: '#/components/schemas/Dataset' + required: + - data + type: object Date: description: Date as Unix timestamp in milliseconds. example: 1722439510282 @@ -15636,6 +15723,38 @@ components: $ref: '#/components/schemas/FastlyServiceData' type: array type: object + FiltersPerProduct: + description: Product-specific filters for the dataset. + properties: + filters: + description: 'Defines the list of tag-based filters used to restrict access + to telemetry data for a specific product. + + These filters act as access control rules. Each filter must follow the + tag query syntax used by + + Datadog (such as `@tag.key:value`), and only one tag or attribute may + be used to define the access strategy + + per telemetry type.' + example: + - '@application.id:ABCD' + items: + example: '@application.id:ABCD' + type: string + type: array + product: + description: 'Name of the product the dataset is for. Possible values are + ''apm'', ''rum'', ''synthetics'', + + ''metrics'', ''logs'', ''sd_repoinfo'', ''error_tracking'', ''cloud_cost'', + and ''ml_obs''.' + example: logs + type: string + required: + - product + - filters + type: object Finding: description: A single finding without the message and resource configuration. properties: @@ -47544,6 +47663,135 @@ paths: tags: - Dashboard Lists x-codegen-request-body-name: body + /api/v2/datasets: + get: + description: Get all datasets that have been configured for an organization. + operationId: GetAllDatasets + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DatasetResponseMulti' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get all datasets + tags: + - Datasets + x-permission: + operator: OPEN + permissions: [] + post: + description: Create a dataset with the configurations in the request. + operationId: CreateDataset + requestBody: + content: + application/json: + example: + data: + attributes: + name: Test RUM Dataset + principals: + - role:23bacb30-1c59-11f0-a596-da7ad0900002 + product_filters: + - filters: + - '@application.id:application_123' + product: rum + type: dataset + schema: + $ref: '#/components/schemas/DatasetCreateRequest' + description: Dataset payload + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DatasetResponseSingle' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create a dataset + tags: + - Datasets + x-codegen-request-body-name: body + x-permission: + operator: OPEN + permissions: [] + /api/v2/datasets/{dataset_id}: + delete: + description: Deletes the dataset associated with the ID. + operationId: DeleteDataset + parameters: + - $ref: '#/components/parameters/DatasetID' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Delete a dataset + tags: + - Datasets + x-permission: + operator: OPEN + permissions: [] + get: + description: Retrieves the dataset associated with the ID. + operationId: GetDataset + parameters: + - $ref: '#/components/parameters/DatasetID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DatasetResponseSingle' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a single dataset by ID + tags: + - Datasets + x-permission: + operator: OPEN + permissions: [] /api/v2/deletion/data/{product}: post: description: Creates a data deletion request by providing a query and a timeframe @@ -65102,6 +65350,14 @@ tags: the allowed products. It's currently enabled for Logs and RUM and depends on `logs_delete_data` and `rum_delete_data` permissions respectively. name: Data Deletion +- description: 'Data Access Controls in Datadog is a feature that allows administrators + and access managers to regulate + + access to sensitive data. By defining Restricted Datasets, you can ensure that + only specific teams or roles can + + view certain types of telemetry (for example, logs, traces, metrics, and RUM data).' + name: Datasets - description: 'Configure your Datadog Email Domain Allowlist directly through the Datadog API. diff --git a/examples/v2/datasets/CreateDataset.java b/examples/v2/datasets/CreateDataset.java new file mode 100644 index 00000000000..4808ebd04d9 --- /dev/null +++ b/examples/v2/datasets/CreateDataset.java @@ -0,0 +1,48 @@ +// Create a dataset returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DatasetsApi; +import com.datadog.api.client.v2.model.Dataset; +import com.datadog.api.client.v2.model.DatasetAttributes; +import com.datadog.api.client.v2.model.DatasetCreateRequest; +import com.datadog.api.client.v2.model.DatasetResponseSingle; +import com.datadog.api.client.v2.model.FiltersPerProduct; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DatasetsApi apiInstance = new DatasetsApi(defaultClient); + + DatasetCreateRequest body = + new DatasetCreateRequest() + .data( + new Dataset() + .attributes( + new DatasetAttributes() + .createdAt(null) + .name("Security Audit Dataset") + .principals( + Collections.singletonList( + "role:86245fce-0a4e-11f0-92bd-da7ad0900002")) + .productFilters( + Collections.singletonList( + new FiltersPerProduct() + .filters(Collections.singletonList("@application.id:ABCD")) + .product("logs")))) + .id("123e4567-e89b-12d3-a456-426614174000") + .type("dataset")); + + try { + DatasetResponseSingle result = apiInstance.createDataset(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DatasetsApi#createDataset"); + 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/datasets/DeleteDataset.java b/examples/v2/datasets/DeleteDataset.java new file mode 100644 index 00000000000..e155042cb10 --- /dev/null +++ b/examples/v2/datasets/DeleteDataset.java @@ -0,0 +1,22 @@ +// Delete a dataset returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DatasetsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DatasetsApi apiInstance = new DatasetsApi(defaultClient); + + try { + apiInstance.deleteDataset("dataset_id"); + } catch (ApiException e) { + System.err.println("Exception when calling DatasetsApi#deleteDataset"); + 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/datasets/GetAllDatasets.java b/examples/v2/datasets/GetAllDatasets.java new file mode 100644 index 00000000000..2e6ae6db61d --- /dev/null +++ b/examples/v2/datasets/GetAllDatasets.java @@ -0,0 +1,24 @@ +// Get all datasets returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DatasetsApi; +import com.datadog.api.client.v2.model.DatasetResponseMulti; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DatasetsApi apiInstance = new DatasetsApi(defaultClient); + + try { + DatasetResponseMulti result = apiInstance.getAllDatasets(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DatasetsApi#getAllDatasets"); + 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/datasets/GetDataset.java b/examples/v2/datasets/GetDataset.java new file mode 100644 index 00000000000..c4dddbe5b93 --- /dev/null +++ b/examples/v2/datasets/GetDataset.java @@ -0,0 +1,24 @@ +// Get a single dataset by ID returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DatasetsApi; +import com.datadog.api.client.v2.model.DatasetResponseSingle; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DatasetsApi apiInstance = new DatasetsApi(defaultClient); + + try { + DatasetResponseSingle result = apiInstance.getDataset("dataset_id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DatasetsApi#getDataset"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/DatasetsApi.java b/src/main/java/com/datadog/api/client/v2/api/DatasetsApi.java new file mode 100644 index 00000000000..ead4186245e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/DatasetsApi.java @@ -0,0 +1,557 @@ +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.Pair; +import com.datadog.api.client.v2.model.DatasetCreateRequest; +import com.datadog.api.client.v2.model.DatasetResponseMulti; +import com.datadog.api.client.v2.model.DatasetResponseSingle; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +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 DatasetsApi { + private ApiClient apiClient; + + public DatasetsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public DatasetsApi(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 a dataset. + * + *

See {@link #createDatasetWithHttpInfo}. + * + * @param body Dataset payload (required) + * @return DatasetResponseSingle + * @throws ApiException if fails to make API call + */ + public DatasetResponseSingle createDataset(DatasetCreateRequest body) throws ApiException { + return createDatasetWithHttpInfo(body).getData(); + } + + /** + * Create a dataset. + * + *

See {@link #createDatasetWithHttpInfoAsync}. + * + * @param body Dataset payload (required) + * @return CompletableFuture<DatasetResponseSingle> + */ + public CompletableFuture createDatasetAsync(DatasetCreateRequest body) { + return createDatasetWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a dataset with the configurations in the request. + * + * @param body Dataset payload (required) + * @return ApiResponse<DatasetResponseSingle> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createDatasetWithHttpInfo(DatasetCreateRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createDataset"); + } + // create path and map variables + String localVarPath = "/api/v2/datasets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.DatasetsApi.createDataset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a dataset. + * + *

See {@link #createDatasetWithHttpInfo}. + * + * @param body Dataset payload (required) + * @return CompletableFuture<ApiResponse<DatasetResponseSingle>> + */ + public CompletableFuture> createDatasetWithHttpInfoAsync( + DatasetCreateRequest body) { + 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 createDataset")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/datasets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.DatasetsApi.createDataset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete a dataset. + * + *

See {@link #deleteDatasetWithHttpInfo}. + * + * @param datasetId The ID of a defined dataset. (required) + * @throws ApiException if fails to make API call + */ + public void deleteDataset(String datasetId) throws ApiException { + deleteDatasetWithHttpInfo(datasetId); + } + + /** + * Delete a dataset. + * + *

See {@link #deleteDatasetWithHttpInfoAsync}. + * + * @param datasetId The ID of a defined dataset. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteDatasetAsync(String datasetId) { + return deleteDatasetWithHttpInfoAsync(datasetId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Deletes the dataset associated with the ID. + * + * @param datasetId The ID of a defined dataset. (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 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteDatasetWithHttpInfo(String datasetId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'datasetId' is set + if (datasetId == null) { + throw new ApiException( + 400, "Missing the required parameter 'datasetId' when calling deleteDataset"); + } + // create path and map variables + String localVarPath = + "/api/v2/datasets/{dataset_id}" + .replaceAll("\\{" + "dataset_id" + "\\}", apiClient.escapeString(datasetId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.DatasetsApi.deleteDataset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a dataset. + * + *

See {@link #deleteDatasetWithHttpInfo}. + * + * @param datasetId The ID of a defined dataset. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteDatasetWithHttpInfoAsync(String datasetId) { + Object localVarPostBody = null; + + // verify the required parameter 'datasetId' is set + if (datasetId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'datasetId' when calling deleteDataset")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/datasets/{dataset_id}" + .replaceAll("\\{" + "dataset_id" + "\\}", apiClient.escapeString(datasetId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.DatasetsApi.deleteDataset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Get all datasets. + * + *

See {@link #getAllDatasetsWithHttpInfo}. + * + * @return DatasetResponseMulti + * @throws ApiException if fails to make API call + */ + public DatasetResponseMulti getAllDatasets() throws ApiException { + return getAllDatasetsWithHttpInfo().getData(); + } + + /** + * Get all datasets. + * + *

See {@link #getAllDatasetsWithHttpInfoAsync}. + * + * @return CompletableFuture<DatasetResponseMulti> + */ + public CompletableFuture getAllDatasetsAsync() { + return getAllDatasetsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all datasets that have been configured for an organization. + * + * @return ApiResponse<DatasetResponseMulti> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Not Authorized -
429 Too many requests -
+ */ + public ApiResponse getAllDatasetsWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/datasets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.DatasetsApi.getAllDatasets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get all datasets. + * + *

See {@link #getAllDatasetsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<DatasetResponseMulti>> + */ + public CompletableFuture> getAllDatasetsWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/datasets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.DatasetsApi.getAllDatasets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a single dataset by ID. + * + *

See {@link #getDatasetWithHttpInfo}. + * + * @param datasetId The ID of a defined dataset. (required) + * @return DatasetResponseSingle + * @throws ApiException if fails to make API call + */ + public DatasetResponseSingle getDataset(String datasetId) throws ApiException { + return getDatasetWithHttpInfo(datasetId).getData(); + } + + /** + * Get a single dataset by ID. + * + *

See {@link #getDatasetWithHttpInfoAsync}. + * + * @param datasetId The ID of a defined dataset. (required) + * @return CompletableFuture<DatasetResponseSingle> + */ + public CompletableFuture getDatasetAsync(String datasetId) { + return getDatasetWithHttpInfoAsync(datasetId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieves the dataset associated with the ID. + * + * @param datasetId The ID of a defined dataset. (required) + * @return ApiResponse<DatasetResponseSingle> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getDatasetWithHttpInfo(String datasetId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'datasetId' is set + if (datasetId == null) { + throw new ApiException( + 400, "Missing the required parameter 'datasetId' when calling getDataset"); + } + // create path and map variables + String localVarPath = + "/api/v2/datasets/{dataset_id}" + .replaceAll("\\{" + "dataset_id" + "\\}", apiClient.escapeString(datasetId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.DatasetsApi.getDataset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a single dataset by ID. + * + *

See {@link #getDatasetWithHttpInfo}. + * + * @param datasetId The ID of a defined dataset. (required) + * @return CompletableFuture<ApiResponse<DatasetResponseSingle>> + */ + public CompletableFuture> getDatasetWithHttpInfoAsync( + String datasetId) { + Object localVarPostBody = null; + + // verify the required parameter 'datasetId' is set + if (datasetId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'datasetId' when calling getDataset")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/datasets/{dataset_id}" + .replaceAll("\\{" + "dataset_id" + "\\}", apiClient.escapeString(datasetId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.DatasetsApi.getDataset", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/Dataset.java b/src/main/java/com/datadog/api/client/v2/model/Dataset.java new file mode 100644 index 00000000000..f990b7a7ba0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Dataset.java @@ -0,0 +1,202 @@ +/* + * 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; + +/** Dataset object. */ +@JsonPropertyOrder({ + Dataset.JSON_PROPERTY_ATTRIBUTES, + Dataset.JSON_PROPERTY_ID, + Dataset.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class Dataset { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private DatasetAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public Dataset() {} + + @JsonCreator + public Dataset( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) DatasetAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + } + + public Dataset attributes(DatasetAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Dataset metadata and configuration(s). + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DatasetAttributes getAttributes() { + return attributes; + } + + public void setAttributes(DatasetAttributes attributes) { + this.attributes = attributes; + } + + public Dataset id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier for the dataset. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Dataset type(String type) { + this.type = type; + return this; + } + + /** + * Resource type, always "dataset". + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 Dataset + */ + @JsonAnySetter + public Dataset 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 Dataset object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dataset dataset = (Dataset) o; + return Objects.equals(this.attributes, dataset.attributes) + && Objects.equals(this.id, dataset.id) + && Objects.equals(this.type, dataset.type) + && Objects.equals(this.additionalProperties, dataset.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dataset {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/DatasetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/DatasetAttributes.java new file mode 100644 index 00000000000..e095030d7f3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetAttributes.java @@ -0,0 +1,287 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Dataset metadata and configuration(s). */ +@JsonPropertyOrder({ + DatasetAttributes.JSON_PROPERTY_CREATED_AT, + DatasetAttributes.JSON_PROPERTY_CREATED_BY, + DatasetAttributes.JSON_PROPERTY_NAME, + DatasetAttributes.JSON_PROPERTY_PRINCIPALS, + DatasetAttributes.JSON_PROPERTY_PRODUCT_FILTERS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatasetAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private JsonNullable createdAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private UUID createdBy; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PRINCIPALS = "principals"; + private List principals = new ArrayList<>(); + + public static final String JSON_PROPERTY_PRODUCT_FILTERS = "product_filters"; + private List productFilters = new ArrayList<>(); + + public DatasetAttributes() {} + + @JsonCreator + public DatasetAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_PRINCIPALS) List principals, + @JsonProperty(required = true, value = JSON_PROPERTY_PRODUCT_FILTERS) + List productFilters) { + this.name = name; + this.principals = principals; + this.productFilters = productFilters; + } + + public DatasetAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = JsonNullable.of(createdAt); + return this; + } + + /** + * Timestamp when the dataset was created. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getCreatedAt() { + return createdAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCreatedAt_JsonNullable() { + return createdAt; + } + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + public void setCreatedAt_JsonNullable(JsonNullable createdAt) { + this.createdAt = createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = JsonNullable.of(createdAt); + } + + public DatasetAttributes createdBy(UUID createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Unique ID of the user who created the dataset. + * + * @return createdBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(UUID createdBy) { + this.createdBy = createdBy; + } + + public DatasetAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Name of the dataset. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DatasetAttributes principals(List principals) { + this.principals = principals; + return this; + } + + public DatasetAttributes addPrincipalsItem(String principalsItem) { + this.principals.add(principalsItem); + return this; + } + + /** + * List of access principals, formatted as principal_type:id. Principal can be 'team' + * or 'role'. + * + * @return principals + */ + @JsonProperty(JSON_PROPERTY_PRINCIPALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getPrincipals() { + return principals; + } + + public void setPrincipals(List principals) { + this.principals = principals; + } + + public DatasetAttributes productFilters(List productFilters) { + this.productFilters = productFilters; + for (FiltersPerProduct item : productFilters) { + this.unparsed |= item.unparsed; + } + return this; + } + + public DatasetAttributes addProductFiltersItem(FiltersPerProduct productFiltersItem) { + this.productFilters.add(productFiltersItem); + this.unparsed |= productFiltersItem.unparsed; + return this; + } + + /** + * List of product-specific filters. + * + * @return productFilters + */ + @JsonProperty(JSON_PROPERTY_PRODUCT_FILTERS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getProductFilters() { + return productFilters; + } + + public void setProductFilters(List productFilters) { + this.productFilters = productFilters; + } + + /** + * 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 DatasetAttributes + */ + @JsonAnySetter + public DatasetAttributes 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 DatasetAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatasetAttributes datasetAttributes = (DatasetAttributes) o; + return Objects.equals(this.createdAt, datasetAttributes.createdAt) + && Objects.equals(this.createdBy, datasetAttributes.createdBy) + && Objects.equals(this.name, datasetAttributes.name) + && Objects.equals(this.principals, datasetAttributes.principals) + && Objects.equals(this.productFilters, datasetAttributes.productFilters) + && Objects.equals(this.additionalProperties, datasetAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, createdBy, name, principals, productFilters, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatasetAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" principals: ").append(toIndentedString(principals)).append("\n"); + sb.append(" productFilters: ").append(toIndentedString(productFilters)).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/DatasetCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/DatasetCreateRequest.java new file mode 100644 index 00000000000..3f6865fe089 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetCreateRequest.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Create request for a dataset. */ +@JsonPropertyOrder({DatasetCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatasetCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private Dataset data; + + public DatasetCreateRequest() {} + + @JsonCreator + public DatasetCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) Dataset data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public DatasetCreateRequest data(Dataset data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Dataset object. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Dataset getData() { + return data; + } + + public void setData(Dataset 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 DatasetCreateRequest + */ + @JsonAnySetter + public DatasetCreateRequest 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 DatasetCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatasetCreateRequest datasetCreateRequest = (DatasetCreateRequest) o; + return Objects.equals(this.data, datasetCreateRequest.data) + && Objects.equals(this.additionalProperties, datasetCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatasetCreateRequest {\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/DatasetResponseMulti.java b/src/main/java/com/datadog/api/client/v2/model/DatasetResponseMulti.java new file mode 100644 index 00000000000..66343081e82 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetResponseMulti.java @@ -0,0 +1,154 @@ +/* + * 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; + +/** Response containing a list of datasets. */ +@JsonPropertyOrder({DatasetResponseMulti.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatasetResponseMulti { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public DatasetResponseMulti() {} + + @JsonCreator + public DatasetResponseMulti( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public DatasetResponseMulti data(List data) { + this.data = data; + for (Dataset item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public DatasetResponseMulti addDataItem(Dataset dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of datasets returned in response. + * + * @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 DatasetResponseMulti + */ + @JsonAnySetter + public DatasetResponseMulti 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 DatasetResponseMulti object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatasetResponseMulti datasetResponseMulti = (DatasetResponseMulti) o; + return Objects.equals(this.data, datasetResponseMulti.data) + && Objects.equals(this.additionalProperties, datasetResponseMulti.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatasetResponseMulti {\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/DatasetResponseSingle.java b/src/main/java/com/datadog/api/client/v2/model/DatasetResponseSingle.java new file mode 100644 index 00000000000..a316ce5d685 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetResponseSingle.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing a single dataset object. */ +@JsonPropertyOrder({DatasetResponseSingle.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatasetResponseSingle { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private Dataset data; + + public DatasetResponseSingle() {} + + @JsonCreator + public DatasetResponseSingle( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) Dataset data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public DatasetResponseSingle data(Dataset data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Dataset object. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Dataset getData() { + return data; + } + + public void setData(Dataset 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 DatasetResponseSingle + */ + @JsonAnySetter + public DatasetResponseSingle 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 DatasetResponseSingle object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatasetResponseSingle datasetResponseSingle = (DatasetResponseSingle) o; + return Objects.equals(this.data, datasetResponseSingle.data) + && Objects.equals(this.additionalProperties, datasetResponseSingle.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatasetResponseSingle {\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/FiltersPerProduct.java b/src/main/java/com/datadog/api/client/v2/model/FiltersPerProduct.java new file mode 100644 index 00000000000..b114147e126 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FiltersPerProduct.java @@ -0,0 +1,184 @@ +/* + * 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; + +/** Product-specific filters for the dataset. */ +@JsonPropertyOrder({ + FiltersPerProduct.JSON_PROPERTY_FILTERS, + FiltersPerProduct.JSON_PROPERTY_PRODUCT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FiltersPerProduct { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FILTERS = "filters"; + private List filters = new ArrayList<>(); + + public static final String JSON_PROPERTY_PRODUCT = "product"; + private String product; + + public FiltersPerProduct() {} + + @JsonCreator + public FiltersPerProduct( + @JsonProperty(required = true, value = JSON_PROPERTY_FILTERS) List filters, + @JsonProperty(required = true, value = JSON_PROPERTY_PRODUCT) String product) { + this.filters = filters; + this.product = product; + } + + public FiltersPerProduct filters(List filters) { + this.filters = filters; + return this; + } + + public FiltersPerProduct addFiltersItem(String filtersItem) { + this.filters.add(filtersItem); + return this; + } + + /** + * Defines the list of tag-based filters used to restrict access to telemetry data for a specific + * product. These filters act as access control rules. Each filter must follow the tag query + * syntax used by Datadog (such as @tag.key:value), and only one tag or attribute may + * be used to define the access strategy per telemetry type. + * + * @return filters + */ + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getFilters() { + return filters; + } + + public void setFilters(List filters) { + this.filters = filters; + } + + public FiltersPerProduct product(String product) { + this.product = product; + return this; + } + + /** + * Name of the product the dataset is for. Possible values are 'apm', 'rum', 'synthetics', + * 'metrics', 'logs', 'sd_repoinfo', 'error_tracking', 'cloud_cost', and 'ml_obs'. + * + * @return product + */ + @JsonProperty(JSON_PROPERTY_PRODUCT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProduct() { + return product; + } + + public void setProduct(String product) { + this.product = product; + } + + /** + * 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 FiltersPerProduct + */ + @JsonAnySetter + public FiltersPerProduct 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 FiltersPerProduct object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FiltersPerProduct filtersPerProduct = (FiltersPerProduct) o; + return Objects.equals(this.filters, filtersPerProduct.filters) + && Objects.equals(this.product, filtersPerProduct.product) + && Objects.equals(this.additionalProperties, filtersPerProduct.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(filters, product, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FiltersPerProduct {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/datasets.feature b/src/test/resources/com/datadog/api/client/v2/api/datasets.feature new file mode 100644 index 00000000000..7ce2e160a37 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/datasets.feature @@ -0,0 +1,81 @@ +@endpoint(datasets) @endpoint(datasets-v2) +Feature: Datasets + Data Access Controls in Datadog is a feature that allows administrators + and access managers to regulate access to sensitive data. By defining + Restricted Datasets, you can ensure that only specific teams or roles can + view certain types of telemetry (for example, logs, traces, metrics, and + RUM data). + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Datasets" API + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Create a dataset returns "Bad Request" response + Given new "CreateDataset" request + And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Create a dataset returns "Conflict" response + Given new "CreateDataset" request + And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Create a dataset returns "OK" response + Given new "CreateDataset" request + And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Delete a dataset returns "Bad Request" response + Given new "DeleteDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Delete a dataset returns "No Content" response + Given new "DeleteDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Delete a dataset returns "Not Found" response + Given new "DeleteDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get a single dataset by ID returns "Bad Request" response + Given new "GetDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get a single dataset by ID returns "Not Found" response + Given new "GetDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get a single dataset by ID returns "OK" response + Given new "GetDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get all datasets returns "OK" response + Given new "GetAllDatasets" request + 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 5b4f718bb95..df87d8d6c90 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 @@ -857,6 +857,37 @@ "type": "safe" } }, + "GetAllDatasets": { + "tag": "Datasets", + "undo": { + "type": "safe" + } + }, + "CreateDataset": { + "tag": "Datasets", + "undo": { + "operationId": "DeleteDataset", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteDataset": { + "tag": "Datasets", + "undo": { + "type": "idempotent" + } + }, + "GetDataset": { + "tag": "Datasets", + "undo": { + "type": "safe" + } + }, "CreateDataDeletionRequest": { "tag": "Data Deletion", "undo": {