diff --git a/.generated-info b/.generated-info index 5a034d6e0df..c7d6d2dd0ce 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "ab8171f", - "generated": "2025-07-31 17:35:11.690" + "spec_repo_commit": "672a533", + "generated": "2025-07-31 18:09:11.566" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9e86624abd1..ea57695f053 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13145,31 +13145,33 @@ components: required: - type type: object - Dataset: - description: "Dataset object.\n\n### Datasets Constraints\n- **Tag Limit per - Dataset**:\n - Each restricted dataset supports a maximum of 10 key:value - pairs per product.\n\n- **Tag Key Rules per Telemetry Type**:\n - Only one - tag key or attribute may be used to define access within a single telemetry - type.\n - The same or different tag key may be used across different telemetry - types.\n\n- **Tag Value Uniqueness**:\n - Tag values must be unique within - a single dataset.\n - A tag value used in one dataset cannot be reused in - another dataset of the same telemetry type." + DatasetAttributesRequest: + description: Dataset metadata and configurations. 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 + 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:94172442-be03-11e9-a77a-3b7612558ac1 + items: + example: role:94172442-be03-11e9-a77a-3b7612558ac1 + type: string + type: array + product_filters: + description: List of product-specific filters. + items: + $ref: '#/components/schemas/FiltersPerProduct' + type: array required: - - type - - attributes + - name + - product_filters + - principals type: object - DatasetAttributes: + DatasetAttributesResponse: description: Dataset metadata and configuration(s). properties: created_at: @@ -13199,43 +13201,76 @@ components: 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' + $ref: '#/components/schemas/DatasetRequest' required: - data type: object + DatasetRequest: + description: "**Datasets Object Constraints**\n- **Tag limit per dataset**:\n + \ - Each restricted dataset supports a maximum of 10 key:value pairs per product.\n\n- + **Tag key rules per telemetry type**:\n - Only one tag key or attribute may + be used to define access within a single telemetry type.\n - The same or + different tag key may be used across different telemetry types.\n\n- **Tag + value uniqueness**:\n - Tag values must be unique within a single dataset.\n + \ - A tag value used in one dataset cannot be reused in another dataset of + the same telemetry type." + properties: + attributes: + $ref: '#/components/schemas/DatasetAttributesRequest' + type: + description: Resource type, always "dataset". + example: dataset + type: string + required: + - type + - attributes + type: object + DatasetResponse: + description: "**Datasets Object Constraints**\n- **Tag Limit per Dataset**:\n + \ - Each restricted dataset supports a maximum of 10 key:value pairs per product.\n\n- + **Tag Key Rules per Telemetry Type**:\n - Only one tag key or attribute may + be used to define access within a single telemetry type.\n - The same or + different tag key may be used across different telemetry types.\n\n- **Tag + Value Uniqueness**:\n - Tag values must be unique within a single dataset.\n + \ - A tag value used in one dataset cannot be reused in another dataset of + the same telemetry type." + properties: + attributes: + $ref: '#/components/schemas/DatasetAttributesResponse' + 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 + 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' + $ref: '#/components/schemas/DatasetResponse' type: array - required: - - data type: object DatasetResponseSingle: description: Response containing a single dataset object. properties: data: - $ref: '#/components/schemas/Dataset' - required: - - data + $ref: '#/components/schemas/DatasetResponse' type: object DatasetUpdateRequest: description: Edit request for a dataset. properties: data: - $ref: '#/components/schemas/Dataset' + $ref: '#/components/schemas/DatasetRequest' required: - data type: object @@ -49913,6 +49948,9 @@ paths: operator: OR permissions: - user_access_read + x-unstable: '**Note: Data Access is in preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' post: description: Create a dataset with the configurations in the request. operationId: CreateDataset @@ -49924,7 +49962,7 @@ paths: attributes: name: Test RUM Dataset principals: - - role:23bacb30-1c59-11f0-a596-da7ad0900002 + - role:94172442-be03-11e9-a77a-3b7612558ac1 product_filters: - filters: - '@application.id:application_123' @@ -49962,6 +50000,9 @@ paths: operator: OR permissions: - user_access_manage + x-unstable: '**Note: Data Access is in preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' /api/v2/datasets/{dataset_id}: delete: description: Deletes the dataset associated with the ID. @@ -49989,6 +50030,9 @@ paths: x-permission: operator: OPEN permissions: [] + x-unstable: '**Note: Data Access is in preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' get: description: Retrieves the dataset associated with the ID. operationId: GetDataset @@ -50019,6 +50063,9 @@ paths: x-permission: operator: OPEN permissions: [] + x-unstable: '**Note: Data Access is in preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' put: description: Edits the dataset associated with the ID. operationId: UpdateDataset @@ -50057,6 +50104,9 @@ paths: x-permission: operator: OPEN permissions: [] + x-unstable: '**Note: Data Access is in preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' /api/v2/deletion/data/{product}: post: description: Creates a data deletion request by providing a query and a timeframe diff --git a/examples/v2/datasets/CreateDataset.java b/examples/v2/datasets/CreateDataset.java index 4808ebd04d9..8a055a7fb37 100644 --- a/examples/v2/datasets/CreateDataset.java +++ b/examples/v2/datasets/CreateDataset.java @@ -3,9 +3,9 @@ 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.DatasetAttributesRequest; import com.datadog.api.client.v2.model.DatasetCreateRequest; +import com.datadog.api.client.v2.model.DatasetRequest; import com.datadog.api.client.v2.model.DatasetResponseSingle; import com.datadog.api.client.v2.model.FiltersPerProduct; import java.util.Collections; @@ -13,25 +13,24 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createDataset", true); DatasetsApi apiInstance = new DatasetsApi(defaultClient); DatasetCreateRequest body = new DatasetCreateRequest() .data( - new Dataset() + new DatasetRequest() .attributes( - new DatasetAttributes() - .createdAt(null) + new DatasetAttributesRequest() .name("Security Audit Dataset") .principals( Collections.singletonList( - "role:86245fce-0a4e-11f0-92bd-da7ad0900002")) + "role:94172442-be03-11e9-a77a-3b7612558ac1")) .productFilters( Collections.singletonList( new FiltersPerProduct() .filters(Collections.singletonList("@application.id:ABCD")) - .product("logs")))) - .id("123e4567-e89b-12d3-a456-426614174000") + .product("metrics")))) .type("dataset")); try { diff --git a/examples/v2/datasets/DeleteDataset.java b/examples/v2/datasets/DeleteDataset.java index e155042cb10..db56c8cfadf 100644 --- a/examples/v2/datasets/DeleteDataset.java +++ b/examples/v2/datasets/DeleteDataset.java @@ -7,10 +7,14 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteDataset", true); DatasetsApi apiInstance = new DatasetsApi(defaultClient); + // there is a valid "dataset" in the system + String DATASET_DATA_ID = System.getenv("DATASET_DATA_ID"); + try { - apiInstance.deleteDataset("dataset_id"); + apiInstance.deleteDataset(DATASET_DATA_ID); } catch (ApiException e) { System.err.println("Exception when calling DatasetsApi#deleteDataset"); System.err.println("Status code: " + e.getCode()); diff --git a/examples/v2/datasets/GetAllDatasets.java b/examples/v2/datasets/GetAllDatasets.java index 2e6ae6db61d..78b96f32548 100644 --- a/examples/v2/datasets/GetAllDatasets.java +++ b/examples/v2/datasets/GetAllDatasets.java @@ -8,6 +8,7 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getAllDatasets", true); DatasetsApi apiInstance = new DatasetsApi(defaultClient); try { diff --git a/examples/v2/datasets/GetDataset.java b/examples/v2/datasets/GetDataset.java index c4dddbe5b93..5825ca87c28 100644 --- a/examples/v2/datasets/GetDataset.java +++ b/examples/v2/datasets/GetDataset.java @@ -8,10 +8,14 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getDataset", true); DatasetsApi apiInstance = new DatasetsApi(defaultClient); + // there is a valid "dataset" in the system + String DATASET_DATA_ID = System.getenv("DATASET_DATA_ID"); + try { - DatasetResponseSingle result = apiInstance.getDataset("dataset_id"); + DatasetResponseSingle result = apiInstance.getDataset(DATASET_DATA_ID); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DatasetsApi#getDataset"); diff --git a/examples/v2/datasets/UpdateDataset.java b/examples/v2/datasets/UpdateDataset.java index fa5c90e0f38..a87604dd6de 100644 --- a/examples/v2/datasets/UpdateDataset.java +++ b/examples/v2/datasets/UpdateDataset.java @@ -3,8 +3,8 @@ 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.DatasetAttributesRequest; +import com.datadog.api.client.v2.model.DatasetRequest; import com.datadog.api.client.v2.model.DatasetResponseSingle; import com.datadog.api.client.v2.model.DatasetUpdateRequest; import com.datadog.api.client.v2.model.FiltersPerProduct; @@ -13,29 +13,31 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateDataset", true); DatasetsApi apiInstance = new DatasetsApi(defaultClient); + // there is a valid "dataset" in the system + String DATASET_DATA_ID = System.getenv("DATASET_DATA_ID"); + DatasetUpdateRequest body = new DatasetUpdateRequest() .data( - new Dataset() + new DatasetRequest() .attributes( - new DatasetAttributes() - .createdAt(null) + new DatasetAttributesRequest() .name("Security Audit Dataset") .principals( Collections.singletonList( - "role:86245fce-0a4e-11f0-92bd-da7ad0900002")) + "role:94172442-be03-11e9-a77a-3b7612558ac1")) .productFilters( Collections.singletonList( new FiltersPerProduct() - .filters(Collections.singletonList("@application.id:ABCD")) - .product("logs")))) - .id("123e4567-e89b-12d3-a456-426614174000") + .filters(Collections.singletonList("@application.id:1234")) + .product("metrics")))) .type("dataset")); try { - DatasetResponseSingle result = apiInstance.updateDataset("dataset_id", body); + DatasetResponseSingle result = apiInstance.updateDataset(DATASET_DATA_ID, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DatasetsApi#updateDataset"); diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index e9058574e0d..ab1c6b163f3 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -706,6 +706,11 @@ public class ApiClient { put("v2.listVulnerableAssets", false); put("v2.muteFindings", false); put("v2.runHistoricalJob", false); + put("v2.createDataset", false); + put("v2.deleteDataset", false); + put("v2.getAllDatasets", false); + put("v2.getDataset", false); + put("v2.updateDataset", false); put("v2.cancelDataDeletionRequest", false); put("v2.createDataDeletionRequest", false); put("v2.getDataDeletionRequests", false); 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 index 89c92b1f840..36dfd338a83 100644 --- a/src/main/java/com/datadog/api/client/v2/api/DatasetsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/DatasetsApi.java @@ -94,6 +94,13 @@ public CompletableFuture createDatasetAsync(DatasetCreate */ public ApiResponse createDatasetWithHttpInfo(DatasetCreateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createDataset"; + 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 @@ -136,6 +143,16 @@ public ApiResponse createDatasetWithHttpInfo(DatasetCreat */ public CompletableFuture> createDatasetWithHttpInfoAsync( DatasetCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createDataset"; + 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 @@ -224,6 +241,13 @@ public CompletableFuture deleteDatasetAsync(String datasetId) { * */ public ApiResponse deleteDatasetWithHttpInfo(String datasetId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteDataset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } Object localVarPostBody = null; // verify the required parameter 'datasetId' is set @@ -267,6 +291,16 @@ public ApiResponse deleteDatasetWithHttpInfo(String datasetId) throws ApiE * @return CompletableFuture<ApiResponse<Void>> */ public CompletableFuture> deleteDatasetWithHttpInfoAsync(String datasetId) { + // Check if unstable operation is enabled + String operationId = "deleteDataset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } Object localVarPostBody = null; // verify the required parameter 'datasetId' is set @@ -353,6 +387,13 @@ public CompletableFuture getAllDatasetsAsync() { * */ public ApiResponse getAllDatasetsWithHttpInfo() throws ApiException { + // Check if unstable operation is enabled + String operationId = "getAllDatasets"; + 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; // create path and map variables String localVarPath = "/api/v2/datasets"; @@ -387,6 +428,16 @@ public ApiResponse getAllDatasetsWithHttpInfo() throws Api * @return CompletableFuture<ApiResponse<DatasetResponseMulti>> */ public CompletableFuture> getAllDatasetsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "getAllDatasets"; + 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; // create path and map variables String localVarPath = "/api/v2/datasets"; @@ -468,6 +519,13 @@ public CompletableFuture getDatasetAsync(String datasetId */ public ApiResponse getDatasetWithHttpInfo(String datasetId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getDataset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } Object localVarPostBody = null; // verify the required parameter 'datasetId' is set @@ -512,6 +570,16 @@ public ApiResponse getDatasetWithHttpInfo(String datasetI */ public CompletableFuture> getDatasetWithHttpInfoAsync( String datasetId) { + // Check if unstable operation is enabled + String operationId = "getDataset"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } Object localVarPostBody = null; // verify the required parameter 'datasetId' is set @@ -609,6 +677,13 @@ public CompletableFuture updateDatasetAsync( */ public ApiResponse updateDatasetWithHttpInfo( String datasetId, DatasetUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateDataset"; + 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 'datasetId' is set @@ -660,6 +735,16 @@ public ApiResponse updateDatasetWithHttpInfo( */ public CompletableFuture> updateDatasetWithHttpInfoAsync( String datasetId, DatasetUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateDataset"; + 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 'datasetId' is set diff --git a/src/main/java/com/datadog/api/client/v2/model/DatasetAttributesRequest.java b/src/main/java/com/datadog/api/client/v2/model/DatasetAttributesRequest.java new file mode 100644 index 00000000000..f0c28bae180 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetAttributesRequest.java @@ -0,0 +1,219 @@ +/* + * 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; + +/** Dataset metadata and configurations. */ +@JsonPropertyOrder({ + DatasetAttributesRequest.JSON_PROPERTY_NAME, + DatasetAttributesRequest.JSON_PROPERTY_PRINCIPALS, + DatasetAttributesRequest.JSON_PROPERTY_PRODUCT_FILTERS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatasetAttributesRequest { + @JsonIgnore public boolean unparsed = false; + 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 DatasetAttributesRequest() {} + + @JsonCreator + public DatasetAttributesRequest( + @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 DatasetAttributesRequest 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 DatasetAttributesRequest principals(List principals) { + this.principals = principals; + return this; + } + + public DatasetAttributesRequest 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 DatasetAttributesRequest productFilters(List productFilters) { + this.productFilters = productFilters; + for (FiltersPerProduct item : productFilters) { + this.unparsed |= item.unparsed; + } + return this; + } + + public DatasetAttributesRequest 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 DatasetAttributesRequest + */ + @JsonAnySetter + public DatasetAttributesRequest 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 DatasetAttributesRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatasetAttributesRequest datasetAttributesRequest = (DatasetAttributesRequest) o; + return Objects.equals(this.name, datasetAttributesRequest.name) + && Objects.equals(this.principals, datasetAttributesRequest.principals) + && Objects.equals(this.productFilters, datasetAttributesRequest.productFilters) + && Objects.equals(this.additionalProperties, datasetAttributesRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, principals, productFilters, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatasetAttributesRequest {\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/DatasetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/DatasetAttributesResponse.java similarity index 75% rename from src/main/java/com/datadog/api/client/v2/model/DatasetAttributes.java rename to src/main/java/com/datadog/api/client/v2/model/DatasetAttributesResponse.java index e095030d7f3..9be9798fe04 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DatasetAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetAttributesResponse.java @@ -8,7 +8,6 @@ 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; @@ -24,15 +23,15 @@ /** 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 + DatasetAttributesResponse.JSON_PROPERTY_CREATED_AT, + DatasetAttributesResponse.JSON_PROPERTY_CREATED_BY, + DatasetAttributesResponse.JSON_PROPERTY_NAME, + DatasetAttributesResponse.JSON_PROPERTY_PRINCIPALS, + DatasetAttributesResponse.JSON_PROPERTY_PRODUCT_FILTERS }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class DatasetAttributes { +public class DatasetAttributesResponse { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_CREATED_AT = "created_at"; private JsonNullable createdAt = JsonNullable.undefined(); @@ -44,25 +43,12 @@ public class DatasetAttributes { private String name; public static final String JSON_PROPERTY_PRINCIPALS = "principals"; - private List principals = new ArrayList<>(); + private List principals = null; public static final String JSON_PROPERTY_PRODUCT_FILTERS = "product_filters"; - private List productFilters = new ArrayList<>(); + private List productFilters = null; - 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) { + public DatasetAttributesResponse createdAt(OffsetDateTime createdAt) { this.createdAt = JsonNullable.of(createdAt); return this; } @@ -93,7 +79,7 @@ public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = JsonNullable.of(createdAt); } - public DatasetAttributes createdBy(UUID createdBy) { + public DatasetAttributesResponse createdBy(UUID createdBy) { this.createdBy = createdBy; return this; } @@ -114,7 +100,7 @@ public void setCreatedBy(UUID createdBy) { this.createdBy = createdBy; } - public DatasetAttributes name(String name) { + public DatasetAttributesResponse name(String name) { this.name = name; return this; } @@ -124,8 +110,9 @@ public DatasetAttributes name(String name) { * * @return name */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; } @@ -134,12 +121,15 @@ public void setName(String name) { this.name = name; } - public DatasetAttributes principals(List principals) { + public DatasetAttributesResponse principals(List principals) { this.principals = principals; return this; } - public DatasetAttributes addPrincipalsItem(String principalsItem) { + public DatasetAttributesResponse addPrincipalsItem(String principalsItem) { + if (this.principals == null) { + this.principals = new ArrayList<>(); + } this.principals.add(principalsItem); return this; } @@ -150,8 +140,9 @@ public DatasetAttributes addPrincipalsItem(String principalsItem) { * * @return principals */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_PRINCIPALS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getPrincipals() { return principals; } @@ -160,7 +151,7 @@ public void setPrincipals(List principals) { this.principals = principals; } - public DatasetAttributes productFilters(List productFilters) { + public DatasetAttributesResponse productFilters(List productFilters) { this.productFilters = productFilters; for (FiltersPerProduct item : productFilters) { this.unparsed |= item.unparsed; @@ -168,7 +159,10 @@ public DatasetAttributes productFilters(List productFilters) return this; } - public DatasetAttributes addProductFiltersItem(FiltersPerProduct productFiltersItem) { + public DatasetAttributesResponse addProductFiltersItem(FiltersPerProduct productFiltersItem) { + if (this.productFilters == null) { + this.productFilters = new ArrayList<>(); + } this.productFilters.add(productFiltersItem); this.unparsed |= productFiltersItem.unparsed; return this; @@ -179,8 +173,9 @@ public DatasetAttributes addProductFiltersItem(FiltersPerProduct productFiltersI * * @return productFilters */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_PRODUCT_FILTERS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getProductFilters() { return productFilters; } @@ -201,10 +196,10 @@ public void setProductFilters(List productFilters) { * * @param key The arbitrary key to set * @param value The associated value - * @return DatasetAttributes + * @return DatasetAttributesResponse */ @JsonAnySetter - public DatasetAttributes putAdditionalProperty(String key, Object value) { + public DatasetAttributesResponse putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -235,7 +230,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this DatasetAttributes object is equal to o. */ + /** Return true if this DatasetAttributesResponse object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -244,13 +239,14 @@ public boolean equals(Object o) { 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); + DatasetAttributesResponse datasetAttributesResponse = (DatasetAttributesResponse) o; + return Objects.equals(this.createdAt, datasetAttributesResponse.createdAt) + && Objects.equals(this.createdBy, datasetAttributesResponse.createdBy) + && Objects.equals(this.name, datasetAttributesResponse.name) + && Objects.equals(this.principals, datasetAttributesResponse.principals) + && Objects.equals(this.productFilters, datasetAttributesResponse.productFilters) + && Objects.equals( + this.additionalProperties, datasetAttributesResponse.additionalProperties); } @Override @@ -262,7 +258,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class DatasetAttributes {\n"); + sb.append("class DatasetAttributesResponse {\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"); 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 index b1ffd0d2776..0448faceda9 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DatasetCreateRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetCreateRequest.java @@ -24,40 +24,35 @@ public class DatasetCreateRequest { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private Dataset data; + private DatasetRequest data; public DatasetCreateRequest() {} @JsonCreator public DatasetCreateRequest( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) Dataset data) { + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) DatasetRequest data) { this.data = data; this.unparsed |= data.unparsed; } - public DatasetCreateRequest data(Dataset data) { + public DatasetCreateRequest data(DatasetRequest data) { this.data = data; this.unparsed |= data.unparsed; return this; } /** - * Dataset object. - * - *

Datasets Constraints

+ * Datasets Object Constraints - Tag limit per dataset: - Each + * restricted dataset supports a maximum of 10 key:value pairs per product. * *
    - *
  • Tag Limit per Dataset: - *
  • - *

    Each restricted dataset supports a maximum of 10 key:value pairs per product. - *

  • - *

    Tag Key Rules per Telemetry Type: + *

  • Tag key rules per telemetry type: *
  • Only one tag key or attribute may be used to define access within a single telemetry * type. *
  • *

    The same or different tag key may be used across different telemetry types. *

  • - *

    Tag Value Uniqueness: + *

    Tag value uniqueness: *

  • Tag values must be unique within a single dataset. *
  • A tag value used in one dataset cannot be reused in another dataset of the same telemetry * type. @@ -67,11 +62,11 @@ public DatasetCreateRequest data(Dataset data) { */ @JsonProperty(JSON_PROPERTY_DATA) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Dataset getData() { + public DatasetRequest getData() { return data; } - public void setData(Dataset data) { + public void setData(DatasetRequest data) { this.data = data; } diff --git a/src/main/java/com/datadog/api/client/v2/model/DatasetRequest.java b/src/main/java/com/datadog/api/client/v2/model/DatasetRequest.java new file mode 100644 index 00000000000..fcbb8382a79 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetRequest.java @@ -0,0 +1,188 @@ +/* + * 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; + +/** + * Datasets Object Constraints - Tag limit per dataset: - Each + * restricted dataset supports a maximum of 10 key:value pairs per product. + * + *
      + *
    • Tag key rules per telemetry type: + *
    • Only one tag key or attribute may be used to define access within a single telemetry type. + *
    • + *

      The same or different tag key may be used across different telemetry types. + *

    • + *

      Tag value uniqueness: + *

    • Tag values must be unique within a single dataset. + *
    • A tag value used in one dataset cannot be reused in another dataset of the same telemetry + * type. + *
    + */ +@JsonPropertyOrder({DatasetRequest.JSON_PROPERTY_ATTRIBUTES, DatasetRequest.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatasetRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private DatasetAttributesRequest attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public DatasetRequest() {} + + @JsonCreator + public DatasetRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + DatasetAttributesRequest attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + } + + public DatasetRequest attributes(DatasetAttributesRequest attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Dataset metadata and configurations. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DatasetAttributesRequest getAttributes() { + return attributes; + } + + public void setAttributes(DatasetAttributesRequest attributes) { + this.attributes = attributes; + } + + public DatasetRequest 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 DatasetRequest + */ + @JsonAnySetter + public DatasetRequest 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 DatasetRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatasetRequest datasetRequest = (DatasetRequest) o; + return Objects.equals(this.attributes, datasetRequest.attributes) + && Objects.equals(this.type, datasetRequest.type) + && Objects.equals(this.additionalProperties, datasetRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatasetRequest {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).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/Dataset.java b/src/main/java/com/datadog/api/client/v2/model/DatasetResponse.java similarity index 74% rename from src/main/java/com/datadog/api/client/v2/model/Dataset.java rename to src/main/java/com/datadog/api/client/v2/model/DatasetResponse.java index 4b8cef5c856..68f92f26e13 100644 --- a/src/main/java/com/datadog/api/client/v2/model/Dataset.java +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetResponse.java @@ -8,7 +8,6 @@ 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; @@ -18,16 +17,11 @@ import java.util.Objects; /** - * Dataset object. - * - *

    Datasets Constraints

    + * Datasets Object Constraints - Tag Limit per Dataset: - Each + * restricted dataset supports a maximum of 10 key:value pairs per product. * *
      - *
    • Tag Limit per Dataset: - *
    • - *

      Each restricted dataset supports a maximum of 10 key:value pairs per product. - *

    • - *

      Tag Key Rules per Telemetry Type: + *

    • Tag Key Rules per Telemetry Type: *
    • Only one tag key or attribute may be used to define access within a single telemetry type. *
    • *

      The same or different tag key may be used across different telemetry types. @@ -39,16 +33,16 @@ *

    */ @JsonPropertyOrder({ - Dataset.JSON_PROPERTY_ATTRIBUTES, - Dataset.JSON_PROPERTY_ID, - Dataset.JSON_PROPERTY_TYPE + DatasetResponse.JSON_PROPERTY_ATTRIBUTES, + DatasetResponse.JSON_PROPERTY_ID, + DatasetResponse.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class Dataset { +public class DatasetResponse { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; - private DatasetAttributes attributes; + private DatasetAttributesResponse attributes; public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -56,18 +50,7 @@ public class Dataset { 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) { + public DatasetResponse attributes(DatasetAttributesResponse attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; return this; @@ -78,17 +61,18 @@ public Dataset attributes(DatasetAttributes attributes) { * * @return attributes */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public DatasetAttributes getAttributes() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DatasetAttributesResponse getAttributes() { return attributes; } - public void setAttributes(DatasetAttributes attributes) { + public void setAttributes(DatasetAttributesResponse attributes) { this.attributes = attributes; } - public Dataset id(String id) { + public DatasetResponse id(String id) { this.id = id; return this; } @@ -109,7 +93,7 @@ public void setId(String id) { this.id = id; } - public Dataset type(String type) { + public DatasetResponse type(String type) { this.type = type; return this; } @@ -119,8 +103,9 @@ public Dataset type(String type) { * * @return type */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getType() { return type; } @@ -141,10 +126,10 @@ public void setType(String type) { * * @param key The arbitrary key to set * @param value The associated value - * @return Dataset + * @return DatasetResponse */ @JsonAnySetter - public Dataset putAdditionalProperty(String key, Object value) { + public DatasetResponse putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -175,7 +160,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this Dataset object is equal to o. */ + /** Return true if this DatasetResponse object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -184,11 +169,11 @@ public boolean equals(Object o) { 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); + DatasetResponse datasetResponse = (DatasetResponse) o; + return Objects.equals(this.attributes, datasetResponse.attributes) + && Objects.equals(this.id, datasetResponse.id) + && Objects.equals(this.type, datasetResponse.type) + && Objects.equals(this.additionalProperties, datasetResponse.additionalProperties); } @Override @@ -199,7 +184,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Dataset {\n"); + sb.append("class DatasetResponse {\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"); 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 index 66343081e82..a9b246c289a 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DatasetResponseMulti.java +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetResponseMulti.java @@ -8,7 +8,6 @@ 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; @@ -26,25 +25,20 @@ public class DatasetResponseMulti { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private List data = new ArrayList<>(); + private List data = null; - public DatasetResponseMulti() {} - - @JsonCreator - public DatasetResponseMulti( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + public DatasetResponseMulti data(List data) { this.data = data; - } - - public DatasetResponseMulti data(List data) { - this.data = data; - for (Dataset item : data) { + for (DatasetResponse item : data) { this.unparsed |= item.unparsed; } return this; } - public DatasetResponseMulti addDataItem(Dataset dataItem) { + public DatasetResponseMulti addDataItem(DatasetResponse dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); this.unparsed |= dataItem.unparsed; return this; @@ -55,13 +49,14 @@ public DatasetResponseMulti addDataItem(Dataset dataItem) { * * @return data */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DATA) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getData() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } 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 index 27b8420fb57..ebf633e22a4 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DatasetResponseSingle.java +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetResponseSingle.java @@ -8,7 +8,6 @@ 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; @@ -24,34 +23,20 @@ public class DatasetResponseSingle { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private Dataset data; + private DatasetResponse 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) { + public DatasetResponseSingle data(DatasetResponse data) { this.data = data; this.unparsed |= data.unparsed; return this; } /** - * Dataset object. - * - *

    Datasets Constraints

    + * Datasets Object Constraints - Tag Limit per Dataset: - Each + * restricted dataset supports a maximum of 10 key:value pairs per product. * *
      - *
    • Tag Limit per Dataset: - *
    • - *

      Each restricted dataset supports a maximum of 10 key:value pairs per product. - *

    • - *

      Tag Key Rules per Telemetry Type: + *

    • Tag Key Rules per Telemetry Type: *
    • Only one tag key or attribute may be used to define access within a single telemetry * type. *
    • @@ -65,13 +50,14 @@ public DatasetResponseSingle data(Dataset data) { * * @return data */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DATA) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Dataset getData() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DatasetResponse getData() { return data; } - public void setData(Dataset data) { + public void setData(DatasetResponse data) { this.data = data; } diff --git a/src/main/java/com/datadog/api/client/v2/model/DatasetUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/DatasetUpdateRequest.java index cf8fcd56284..ca7bbfef176 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DatasetUpdateRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/DatasetUpdateRequest.java @@ -24,40 +24,35 @@ public class DatasetUpdateRequest { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private Dataset data; + private DatasetRequest data; public DatasetUpdateRequest() {} @JsonCreator public DatasetUpdateRequest( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) Dataset data) { + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) DatasetRequest data) { this.data = data; this.unparsed |= data.unparsed; } - public DatasetUpdateRequest data(Dataset data) { + public DatasetUpdateRequest data(DatasetRequest data) { this.data = data; this.unparsed |= data.unparsed; return this; } /** - * Dataset object. - * - *

      Datasets Constraints

      + * Datasets Object Constraints - Tag limit per dataset: - Each + * restricted dataset supports a maximum of 10 key:value pairs per product. * *
        - *
      • Tag Limit per Dataset: - *
      • - *

        Each restricted dataset supports a maximum of 10 key:value pairs per product. - *

      • - *

        Tag Key Rules per Telemetry Type: + *

      • Tag key rules per telemetry type: *
      • Only one tag key or attribute may be used to define access within a single telemetry * type. *
      • *

        The same or different tag key may be used across different telemetry types. *

      • - *

        Tag Value Uniqueness: + *

        Tag value uniqueness: *

      • Tag values must be unique within a single dataset. *
      • A tag value used in one dataset cannot be reused in another dataset of the same telemetry * type. @@ -67,11 +62,11 @@ public DatasetUpdateRequest data(Dataset data) { */ @JsonProperty(JSON_PROPERTY_DATA) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Dataset getData() { + public DatasetRequest getData() { return data; } - public void setData(Dataset data) { + public void setData(DatasetRequest data) { this.data = data; } diff --git a/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..71929eb2a5f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:35:57.144Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Bad_Request_response.json new file mode 100644 index 00000000000..e9a5e9f3fb8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"test\":\"bad_request\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid request: Request body contains invalid json\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "15dba2ce-708f-f0e1-2a5f-cc843f353d7d" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Conflict_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Conflict_response.freeze new file mode 100644 index 00000000000..f6e462458c6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Conflict_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:35:57.324Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Conflict_response.json b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Conflict_response.json new file mode 100644 index 00000000000..38f24fd0d91 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_Conflict_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Security Audit Dataset\",\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"product_filters\":[{\"filters\":[\"@application.id:ABCD\"],\"product\":\"metrics\"}]},\"type\":\"dataset\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"dataset\",\"id\":\"7cbada94-7d01-4e73-8c74-ea70fb3b3088\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:ABCD\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "32c558cf-4a2e-f914-f443-ab94000addce" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Security Audit Dataset\",\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"product_filters\":[{\"filters\":[\"@application.id:ABCD\"],\"product\":\"metrics\"}]},\"type\":\"dataset\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid request: [DatasetNameConflict] dataset with name \\\"Security Audit Dataset\\\" already exists\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 409, + "reasonPhrase": "Conflict" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "32c558cf-4a2e-f914-f443-ab94000addcf" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/7cbada94-7d01-4e73-8c74-ea70fb3b3088", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f569dd34-ba2b-185c-e332-0a771e7e15c2" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_OK_response.freeze new file mode 100644 index 00000000000..a11869c8f1a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:35:57.839Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_OK_response.json new file mode 100644 index 00000000000..fba8b2ccd41 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_dataset_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Security Audit Dataset\",\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"product_filters\":[{\"filters\":[\"@application.id:ABCD\"],\"product\":\"metrics\"}]},\"type\":\"dataset\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"dataset\",\"id\":\"86f67664-8b7b-49ae-b671-919ebe11886c\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:ABCD\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "32c558cf-4a2e-f914-f443-ab94000addcd" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/86f67664-8b7b-49ae-b671-919ebe11886c", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e15cf984-73c5-d05e-382b-a27da41631f3" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..5c83b1435b5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:35:58.251Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Bad_Request_response.json new file mode 100644 index 00000000000..5413c786222 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/malformed_id", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid request: [UUIDInvalidValue] \\\"malformed_id\\\" is not a valid UUID: invalid UUID length: 12\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "265bc0a6-583e-816b-e699-e28a0e8f4c87" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_No_Content_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_No_Content_response.freeze new file mode 100644 index 00000000000..3f1f084a921 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:35:58.429Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_No_Content_response.json b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_No_Content_response.json new file mode 100644 index 00000000000..c6c67c9a8f4 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_No_Content_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Security Audit Dataset\",\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"product_filters\":[{\"filters\":[\"@application.id:ABCD\"],\"product\":\"metrics\"}]},\"type\":\"dataset\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"dataset\",\"id\":\"60ee6562-48f5-455f-bdb4-fd3f5f899978\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:ABCD\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "32c558cf-4a2e-f914-f443-ab94000addcb" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/60ee6562-48f5-455f-bdb4-fd3f5f899978", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e6d82f13-5ad3-4466-edde-778425f3614b" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/60ee6562-48f5-455f-bdb4-fd3f5f899978", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid request: [DatasetNotFound] dataset \\\"60ee6562-48f5-455f-bdb4-fd3f5f899978\\\" not found\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e6d82f13-5ad3-4466-edde-778425f3614c" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..a6e2fb84649 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:35:58.996Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Not_Found_response.json new file mode 100644 index 00000000000..c66ade533fb --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_dataset_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/00000000-0000-0000-0000-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid request: [DatasetNotFound] dataset \\\"00000000-0000-0000-0000-000000000000\\\" not found\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0a216acc-59a3-31cb-3f15-30656435998f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..cdc3a3a57aa --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:35:59.180Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_Bad_Request_response.json new file mode 100644 index 00000000000..d5036b6c7dd --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "PUT", + "path": "/api/v2/datasets/malformed_id", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid request: Request body contains invalid json\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "98c186af-6616-6aeb-0513-fa2b1140d02f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_OK_response.freeze new file mode 100644 index 00000000000..89c4ccef775 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:35:59.399Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_OK_response.json new file mode 100644 index 00000000000..8ae72d22717 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Edit_a_dataset_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Security Audit Dataset\",\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"product_filters\":[{\"filters\":[\"@application.id:ABCD\"],\"product\":\"metrics\"}]},\"type\":\"dataset\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"dataset\",\"id\":\"2bf848a1-b18a-4602-8348-814a53862c52\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:ABCD\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "32c558cf-4a2e-f914-f443-ab94000addca" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Security Audit Dataset\",\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"product_filters\":[{\"filters\":[\"@application.id:1234\"],\"product\":\"metrics\"}]},\"type\":\"dataset\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/datasets/2bf848a1-b18a-4602-8348-814a53862c52", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"dataset\",\"id\":\"2bf848a1-b18a-4602-8348-814a53862c52\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:1234\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3dd90d49-9042-50c7-d2c0-d10377768bbb" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/2bf848a1-b18a-4602-8348-814a53862c52", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "20213939-3ba1-8fe0-e52d-054b00f716c1" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..f1b51544443 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:36:00.009Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_Bad_Request_response.json new file mode 100644 index 00000000000..8e816878395 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/datasets/malformed_id", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid request: [UUIDInvalidValue] \\\"malformed_id\\\" is not a valid UUID: invalid UUID length: 12\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2bf51849-cca5-524a-24b4-d999943d9ea9" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_OK_response.freeze new file mode 100644 index 00000000000..e339d721db2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:36:00.186Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_OK_response.json new file mode 100644 index 00000000000..bf2af7a3b6a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_single_dataset_by_ID_returns_OK_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Security Audit Dataset\",\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"product_filters\":[{\"filters\":[\"@application.id:ABCD\"],\"product\":\"metrics\"}]},\"type\":\"dataset\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"dataset\",\"id\":\"9e576299-3cc1-4145-8aad-67a1ab914829\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:ABCD\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "32c558cf-4a2e-f914-f443-ab94000addc9" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/datasets/9e576299-3cc1-4145-8aad-67a1ab914829", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"dataset\",\"id\":\"9e576299-3cc1-4145-8aad-67a1ab914829\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:ABCD\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5f6432cf-6e61-c956-e2a5-7822c9c7a3ac" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/9e576299-3cc1-4145-8aad-67a1ab914829", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "347efd06-18b8-98bd-c9c7-745a1d2f53cf" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_datasets_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_datasets_returns_OK_response.freeze new file mode 100644 index 00000000000..7db64cb6bc1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_datasets_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-07-29T20:36:00.713Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_datasets_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_all_datasets_returns_OK_response.json new file mode 100644 index 00000000000..bd35bd59ea6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_datasets_returns_OK_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Security Audit Dataset\",\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"product_filters\":[{\"filters\":[\"@application.id:ABCD\"],\"product\":\"metrics\"}]},\"type\":\"dataset\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"dataset\",\"id\":\"b0f617b4-affb-4411-970a-2c157933514c\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:ABCD\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "32c558cf-4a2e-f914-f443-ab94000addcc" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/datasets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"type\":\"dataset\",\"id\":\"b0f617b4-affb-4411-970a-2c157933514c\",\"attributes\":{\"name\":\"Security Audit Dataset\",\"product_filters\":[{\"product\":\"metrics\",\"filters\":[\"@application.id:ABCD\"]}],\"principals\":[\"role:94172442-be03-11e9-a77a-3b7612558ac1\"],\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"created_at\":\"2025-07-29T20:36:00.94442Z\"}}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c38493f7-b33f-3354-897c-e07393c8ebdf" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/datasets/b0f617b4-affb-4411-970a-2c157933514c", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c45d6552-7feb-2f60-bba6-55c4c2d537ff" + } +] \ No newline at end of file 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 index 4a220a3c845..f4d4ac7888b 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/datasets.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/datasets.feature @@ -11,95 +11,113 @@ Feature: Datasets And a valid "appKeyAuth" key in the system And an instance of "Datasets" API - @generated @skip @team:DataDog/aaa-granular-access + @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-typescript @skip-validation @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"}} + And operation "CreateDataset" enabled + And body with value {"test": "bad_request"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/aaa-granular-access + @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"}} + Given there is a valid "dataset" in the system + And operation "CreateDataset" enabled + And new "CreateDataset" request + And body with value {"data": {"attributes": {"name": "Security Audit Dataset", "principals": ["role:94172442-be03-11e9-a77a-3b7612558ac1"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "metrics"}]}, "type": "dataset"}} When the request is sent Then the response status is 409 Conflict - @generated @skip @team:DataDog/aaa-granular-access + @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"}} + And operation "CreateDataset" enabled + And body with value {"data": {"attributes": {"name": "Security Audit Dataset", "principals": ["role:94172442-be03-11e9-a77a-3b7612558ac1"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "metrics"}]}, "type": "dataset"}} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/aaa-granular-access + @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" + And operation "DeleteDataset" enabled + And request contains "dataset_id" parameter with value "malformed_id" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/aaa-granular-access + @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" + Given there is a valid "dataset" in the system + And operation "DeleteDataset" enabled + And new "DeleteDataset" request + And request contains "dataset_id" parameter from "dataset.data.id" When the request is sent Then the response status is 204 No Content - @generated @skip @team:DataDog/aaa-granular-access + @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" + And operation "DeleteDataset" enabled + And request contains "dataset_id" parameter with value "00000000-0000-0000-0000-000000000000" When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/aaa-granular-access + @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-typescript @skip-validation @team:DataDog/aaa-granular-access Scenario: Edit a dataset returns "Bad Request" response Given new "UpdateDataset" request - And request contains "dataset_id" parameter from "REPLACE.ME" - 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"}} + And operation "UpdateDataset" enabled + And request contains "dataset_id" parameter with value "malformed_id" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/aaa-granular-access + @skip @team:DataDog/aaa-granular-access Scenario: Edit a dataset returns "Not Found" response - Given new "UpdateDataset" request - And request contains "dataset_id" parameter from "REPLACE.ME" - 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"}} + Given there is a valid "dataset" in the system + And operation "UpdateDataset" enabled + And new "UpdateDataset" request + And request contains "dataset_id" parameter from "dataset.data.id" + And body with value {"data": {"attributes": {"name": "Security Audit Dataset", "principals": ["role:94172442-be03-11e9-a77a-3b7612558ac1"], "product_filters": [{"filters": ["@application.id:1234"], "product": "metrics"}]}, "type": "dataset"}} When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/aaa-granular-access + @team:DataDog/aaa-granular-access Scenario: Edit a dataset returns "OK" response - Given new "UpdateDataset" request - And request contains "dataset_id" parameter from "REPLACE.ME" - 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"}} + Given there is a valid "dataset" in the system + And operation "UpdateDataset" enabled + And new "UpdateDataset" request + And request contains "dataset_id" parameter from "dataset.data.id" + And body with value {"data": {"attributes": {"name": "Security Audit Dataset", "principals": ["role:94172442-be03-11e9-a77a-3b7612558ac1"], "product_filters": [{"filters": ["@application.id:1234"], "product": "metrics"}]}, "type": "dataset"}} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/aaa-granular-access + @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" + And operation "GetDataset" enabled + And request contains "dataset_id" parameter with value "malformed_id" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/aaa-granular-access + @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" + Given operation "GetDataset" enabled + And new "GetDataset" request + And request contains "dataset_id" parameter with value "00000000-0000-0000-0000-000000000000" When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/aaa-granular-access + @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" + Given there is a valid "dataset" in the system + And operation "GetDataset" enabled + And new "GetDataset" request + And request contains "dataset_id" parameter from "dataset.data.id" When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/aaa-granular-access + @team:DataDog/aaa-granular-access Scenario: Get all datasets returns "OK" response - Given new "GetAllDatasets" request + Given there is a valid "dataset" in the system + And operation "GetAllDatasets" enabled + And 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/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 9a7a5557689..d1f630f71a8 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 @@ -176,6 +176,19 @@ "tag": "Dashboard Lists", "operationId": "CreateDashboardListItems" }, + { + "parameters": [ + { + "name": "body", + "origin": "request", + "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"Security Audit Dataset\",\n \"principals\": [\n \"role:94172442-be03-11e9-a77a-3b7612558ac1\"\n ],\n \"product_filters\": [\n {\n \"filters\": [\n \"@application.id:ABCD\"\n ],\n \"product\": \"metrics\"\n }\n ]\n },\n \"type\": \"dataset\"\n }\n}" + } + ], + "step": "there is a valid \"dataset\" in the system", + "key": "dataset", + "tag": "Datasets", + "operationId": "CreateDataset" + }, { "parameters": [ { 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 53bef5692a4..40ab14773c4 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 @@ -875,7 +875,7 @@ "operationId": "DeleteDataset", "parameters": [ { - "name": "id", + "name": "dataset_id", "source": "data.id" } ],