From b0683acfb91b75be1b68df2c2ba4c4fbc649babd Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 14 Nov 2025 19:13:22 +0000 Subject: [PATCH] Regenerate client from commit a1b0ee6 of spec repo --- .generator/schemas/v2/openapi.yaml | 131 +++--- .../CreateReferenceTable.java | 43 +- .../v2/model/TableResultV2DataAttributes.java | 7 + ...bleResultV2DataAttributesFileMetadata.java | 442 +++++++----------- ...ataAttributesFileMetadataCloudStorage.java | 219 --------- ...V2DataAttributesFileMetadataLocalFile.java | 117 ----- .../client/v2/api/reference_tables.feature | 6 +- 7 files changed, 278 insertions(+), 687 deletions(-) delete mode 100644 src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadataCloudStorage.java delete mode 100644 src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadataLocalFile.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ea3da24e20a..c5c1761de8f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13142,30 +13142,6 @@ components: CreateTableRequest: description: Request body for creating a new reference table from a local file or cloud storage. - example: - data: - attributes: - description: this is a cloud table generated via a cloud bucket sync - file_metadata: - access_details: - aws_detail: - aws_account_id: test-account-id - aws_bucket_name: test-bucket - file_path: test_rt.csv - sync_enabled: true - schema: - fields: - - name: name - type: STRING - - name: account_id - type: STRING - primary_keys: - - account_id - source: S3 - table_name: test_reference_table - tags: - - test_tag - type: reference_table properties: data: $ref: '#/components/schemas/CreateTableRequestData' @@ -13387,6 +13363,17 @@ components: CreateUploadRequest: description: Request to create an upload for a file to be ingested into a reference table. + example: + data: + attributes: + headers: + - product_id + - product_name + - price + part_count: 3 + part_size: 10000000 + table_name: my_products_table + type: upload properties: data: $ref: '#/components/schemas/CreateUploadRequestData' @@ -51089,32 +51076,35 @@ components: type: string type: object TableResultV2DataAttributesFileMetadata: - description: Metadata specifying where and how to access the reference table's - data file. - oneOf: - - $ref: '#/components/schemas/TableResultV2DataAttributesFileMetadataCloudStorage' - - $ref: '#/components/schemas/TableResultV2DataAttributesFileMetadataLocalFile' - TableResultV2DataAttributesFileMetadataCloudStorage: additionalProperties: false - description: File metadata for reference tables created by cloud storage. + description: "Metadata specifying where and how to access the reference table's + data file.\n\nFor cloud storage tables (S3/GCS/Azure):\n - sync_enabled and + access_details will always be present\n - error fields (error_message, error_row_count, + error_type) are present only when errors occur\n\nFor local file tables:\n + \ - error fields (error_message, error_row_count) are present only when errors + occur\n - sync_enabled, access_details are never present" properties: access_details: $ref: '#/components/schemas/TableResultV2DataAttributesFileMetadataOneOfAccessDetails' + description: Cloud storage access configuration. Only present for cloud + storage sources (S3, GCS, Azure). error_message: - description: The error message returned from the sync. + description: The error message returned from the last operation (sync for + cloud storage, upload for local file). type: string error_row_count: - description: The number of rows that failed to sync. + description: The number of rows that failed to process. format: int64 type: integer error_type: $ref: '#/components/schemas/TableResultV2DataAttributesFileMetadataCloudStorageErrorType' + description: The type of error that occurred during file processing. Only + applicable for cloud storage sources. sync_enabled: - description: Whether this table is synced automatically. + description: Whether this table is synced automatically from cloud storage. + Only applicable for cloud storage sources. type: boolean - required: - - access_details - title: CloudFileMetadataV2 + title: FileMetadataV2 type: object TableResultV2DataAttributesFileMetadataCloudStorageErrorType: description: The type of error that occurred during file processing. This field @@ -51141,21 +51131,6 @@ components: - STATE_ERROR - OPERATION_ERROR - SYSTEM_ERROR - TableResultV2DataAttributesFileMetadataLocalFile: - additionalProperties: false - description: File metadata for reference tables created by upload. Note that - upload_id is only returned in the immediate create/replace response and is - not available in subsequent GET requests. - properties: - error_message: - description: The error message returned from the creation/update. - type: string - error_row_count: - description: The number of rows that failed to create/update. - format: int64 - type: integer - title: LocalFileMetadataV2 - type: object TableResultV2DataAttributesFileMetadataOneOfAccessDetails: description: Cloud storage access configuration for the reference table data file. @@ -73470,6 +73445,58 @@ paths: requestBody: content: application/json: + examples: + cloud_storage: + summary: Create table from cloud storage (S3) + value: + data: + attributes: + description: Customer reference data synced from S3 + file_metadata: + access_details: + aws_detail: + aws_account_id: '924305315327' + aws_bucket_name: my-data-bucket + file_path: customers.csv + sync_enabled: true + schema: + fields: + - name: customer_id + type: STRING + - name: customer_name + type: STRING + - name: email + type: STRING + primary_keys: + - customer_id + source: S3 + table_name: customer_reference_data + tags: + - team:data-platform + type: reference_table + local_file: + summary: Create table from local file upload + value: + data: + attributes: + description: Product catalog uploaded via local file + file_metadata: + upload_id: 00000000-0000-0000-0000-000000000000 + schema: + fields: + - name: product_id + type: STRING + - name: product_name + type: STRING + - name: price + type: DOUBLE + primary_keys: + - product_id + source: LOCAL_FILE + table_name: product_catalog + tags: + - team:ecommerce + type: reference_table schema: $ref: '#/components/schemas/CreateTableRequest' required: true diff --git a/examples/v2/reference-tables/CreateReferenceTable.java b/examples/v2/reference-tables/CreateReferenceTable.java index 63288105cbc..0d426c4ee99 100644 --- a/examples/v2/reference-tables/CreateReferenceTable.java +++ b/examples/v2/reference-tables/CreateReferenceTable.java @@ -10,6 +10,8 @@ import com.datadog.api.client.v2.model.CreateTableRequestDataAttributesFileMetadataCloudStorage; import com.datadog.api.client.v2.model.CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails; import com.datadog.api.client.v2.model.CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail; +import com.datadog.api.client.v2.model.CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAzureDetail; +import com.datadog.api.client.v2.model.CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsGcpDetail; import com.datadog.api.client.v2.model.CreateTableRequestDataAttributesSchema; import com.datadog.api.client.v2.model.CreateTableRequestDataAttributesSchemaFieldsItems; import com.datadog.api.client.v2.model.CreateTableRequestDataType; @@ -30,7 +32,6 @@ public static void main(String[] args) { new CreateTableRequestData() .attributes( new CreateTableRequestDataAttributes() - .description("this is a cloud table generated via a cloud bucket sync") .fileMetadata( new CreateTableRequestDataAttributesFileMetadata( new CreateTableRequestDataAttributesFileMetadataCloudStorage() @@ -38,24 +39,38 @@ public static void main(String[] args) { new CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails() .awsDetail( new CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail() - .awsAccountId("test-account-id") - .awsBucketName("test-bucket") - .filePath("test_rt.csv"))) - .syncEnabled(true))) + .awsAccountId("123456789000") + .awsBucketName("example-data-bucket") + .filePath("reference-tables/users.csv")) + .azureDetail( + new CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAzureDetail() + .azureClientId( + "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb") + .azureContainerName("reference-data") + .azureStorageAccountName( + "examplestorageaccount") + .azureTenantId( + "cccccccc-4444-5555-6666-dddddddddddd") + .filePath("tables/users.csv")) + .gcpDetail( + new CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsGcpDetail() + .filePath("data/reference_tables/users.csv") + .gcpBucketName("example-data-bucket") + .gcpProjectId("example-gcp-project-12345") + .gcpServiceAccountEmail( + "example-service@example-gcp-project-12345.iam.gserviceaccount.com"))) + .syncEnabled(false))) .schema( new CreateTableRequestDataAttributesSchema() .fields( - Arrays.asList( + Collections.singletonList( new CreateTableRequestDataAttributesSchemaFieldsItems() - .name("name") - .type(ReferenceTableSchemaFieldType.STRING), - new CreateTableRequestDataAttributesSchemaFieldsItems() - .name("account_id") + .name("field_1") .type(ReferenceTableSchemaFieldType.STRING))) - .primaryKeys(Collections.singletonList("account_id"))) - .source(ReferenceTableCreateSourceType.S3) - .tableName("test_reference_table") - .tags(Collections.singletonList("test_tag"))) + .primaryKeys(Collections.singletonList("field_1"))) + .source(ReferenceTableCreateSourceType.LOCAL_FILE) + .tableName("table_1") + .tags(Arrays.asList("tag_1", "tag_2"))) .type(CreateTableRequestDataType.REFERENCE_TABLE)); try { diff --git a/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributes.java index f534f45c61a..6e70d163ba3 100644 --- a/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributes.java @@ -121,6 +121,13 @@ public TableResultV2DataAttributes fileMetadata( /** * Metadata specifying where and how to access the reference table's data file. * + *

For cloud storage tables (S3/GCS/Azure): - sync_enabled and access_details will always be + * present - error fields (error_message, error_row_count, error_type) are present only when + * errors occur + * + *

For local file tables: - error fields (error_message, error_row_count) are present only when + * errors occur - sync_enabled, access_details are never present + * * @return fileMetadata */ @jakarta.annotation.Nullable diff --git a/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadata.java b/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadata.java index ed168a41763..c4ac8231a1d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadata.java +++ b/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadata.java @@ -6,329 +6,207 @@ package com.datadog.api.client.v2.model; -import com.datadog.api.client.AbstractOpenApiSchema; -import com.datadog.api.client.JSON; -import com.datadog.api.client.UnparsedObject; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import jakarta.ws.rs.core.GenericType; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** + * Metadata specifying where and how to access the reference table's data file. + * + *

For cloud storage tables (S3/GCS/Azure): - sync_enabled and access_details will always be + * present - error fields (error_message, error_row_count, error_type) are present only when errors + * occur + * + *

For local file tables: - error fields (error_message, error_row_count) are present only when + * errors occur - sync_enabled, access_details are never present + */ +@JsonPropertyOrder({ + TableResultV2DataAttributesFileMetadata.JSON_PROPERTY_ACCESS_DETAILS, + TableResultV2DataAttributesFileMetadata.JSON_PROPERTY_ERROR_MESSAGE, + TableResultV2DataAttributesFileMetadata.JSON_PROPERTY_ERROR_ROW_COUNT, + TableResultV2DataAttributesFileMetadata.JSON_PROPERTY_ERROR_TYPE, + TableResultV2DataAttributesFileMetadata.JSON_PROPERTY_SYNC_ENABLED +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -@JsonDeserialize( - using = - TableResultV2DataAttributesFileMetadata.TableResultV2DataAttributesFileMetadataDeserializer - .class) -@JsonSerialize( - using = - TableResultV2DataAttributesFileMetadata.TableResultV2DataAttributesFileMetadataSerializer - .class) -public class TableResultV2DataAttributesFileMetadata extends AbstractOpenApiSchema { - private static final Logger log = - Logger.getLogger(TableResultV2DataAttributesFileMetadata.class.getName()); - +public class TableResultV2DataAttributesFileMetadata { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCESS_DETAILS = "access_details"; + private TableResultV2DataAttributesFileMetadataOneOfAccessDetails accessDetails; - public static class TableResultV2DataAttributesFileMetadataSerializer - extends StdSerializer { - public TableResultV2DataAttributesFileMetadataSerializer( - Class t) { - super(t); - } - - public TableResultV2DataAttributesFileMetadataSerializer() { - this(null); - } + public static final String JSON_PROPERTY_ERROR_MESSAGE = "error_message"; + private String errorMessage; - @Override - public void serialize( - TableResultV2DataAttributesFileMetadata value, - JsonGenerator jgen, - SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } + public static final String JSON_PROPERTY_ERROR_ROW_COUNT = "error_row_count"; + private Long errorRowCount; - public static class TableResultV2DataAttributesFileMetadataDeserializer - extends StdDeserializer { - public TableResultV2DataAttributesFileMetadataDeserializer() { - this(TableResultV2DataAttributesFileMetadata.class); - } + public static final String JSON_PROPERTY_ERROR_TYPE = "error_type"; + private TableResultV2DataAttributesFileMetadataCloudStorageErrorType errorType; - public TableResultV2DataAttributesFileMetadataDeserializer(Class vc) { - super(vc); - } + public static final String JSON_PROPERTY_SYNC_ENABLED = "sync_enabled"; + private Boolean syncEnabled; - @Override - public TableResultV2DataAttributesFileMetadata deserialize( - JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - Object tmp = null; - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize TableResultV2DataAttributesFileMetadataCloudStorage - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(Integer.class) - || TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(Long.class) - || TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(Float.class) - || TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(Double.class) - || TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(Boolean.class) - || TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(Integer.class) - || TableResultV2DataAttributesFileMetadataCloudStorage.class.equals( - Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(Float.class) - || TableResultV2DataAttributesFileMetadataCloudStorage.class.equals( - Double.class)) - && (token == JsonToken.VALUE_NUMBER_FLOAT - || token == JsonToken.VALUE_NUMBER_INT)); - attemptParsing |= - (TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (TableResultV2DataAttributesFileMetadataCloudStorage.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - tmp = - tree.traverse(jp.getCodec()) - .readValueAs(TableResultV2DataAttributesFileMetadataCloudStorage.class); - // TODO: there is no validation against JSON schema constraints - // (min, max, enum, pattern...), this does not perform a strict JSON - // validation, which means the 'match' count may be higher than it should be. - if (!((TableResultV2DataAttributesFileMetadataCloudStorage) tmp).unparsed) { - deserialized = tmp; - match++; - } - log.log( - Level.FINER, - "Input data matches schema 'TableResultV2DataAttributesFileMetadataCloudStorage'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log( - Level.FINER, - "Input data does not match schema" - + " 'TableResultV2DataAttributesFileMetadataCloudStorage'", - e); - } + public TableResultV2DataAttributesFileMetadata accessDetails( + TableResultV2DataAttributesFileMetadataOneOfAccessDetails accessDetails) { + this.accessDetails = accessDetails; + this.unparsed |= accessDetails.unparsed; + return this; + } - // deserialize TableResultV2DataAttributesFileMetadataLocalFile - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (TableResultV2DataAttributesFileMetadataLocalFile.class.equals(Integer.class) - || TableResultV2DataAttributesFileMetadataLocalFile.class.equals(Long.class) - || TableResultV2DataAttributesFileMetadataLocalFile.class.equals(Float.class) - || TableResultV2DataAttributesFileMetadataLocalFile.class.equals(Double.class) - || TableResultV2DataAttributesFileMetadataLocalFile.class.equals(Boolean.class) - || TableResultV2DataAttributesFileMetadataLocalFile.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((TableResultV2DataAttributesFileMetadataLocalFile.class.equals(Integer.class) - || TableResultV2DataAttributesFileMetadataLocalFile.class.equals( - Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((TableResultV2DataAttributesFileMetadataLocalFile.class.equals(Float.class) - || TableResultV2DataAttributesFileMetadataLocalFile.class.equals( - Double.class)) - && (token == JsonToken.VALUE_NUMBER_FLOAT - || token == JsonToken.VALUE_NUMBER_INT)); - attemptParsing |= - (TableResultV2DataAttributesFileMetadataLocalFile.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (TableResultV2DataAttributesFileMetadataLocalFile.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - tmp = - tree.traverse(jp.getCodec()) - .readValueAs(TableResultV2DataAttributesFileMetadataLocalFile.class); - // TODO: there is no validation against JSON schema constraints - // (min, max, enum, pattern...), this does not perform a strict JSON - // validation, which means the 'match' count may be higher than it should be. - if (!((TableResultV2DataAttributesFileMetadataLocalFile) tmp).unparsed) { - deserialized = tmp; - match++; - } - log.log( - Level.FINER, - "Input data matches schema 'TableResultV2DataAttributesFileMetadataLocalFile'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log( - Level.FINER, - "Input data does not match schema 'TableResultV2DataAttributesFileMetadataLocalFile'", - e); - } + /** + * Cloud storage access configuration for the reference table data file. + * + * @return accessDetails + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCESS_DETAILS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TableResultV2DataAttributesFileMetadataOneOfAccessDetails getAccessDetails() { + return accessDetails; + } - TableResultV2DataAttributesFileMetadata ret = new TableResultV2DataAttributesFileMetadata(); - if (match == 1) { - ret.setActualInstance(deserialized); - } else { - Map res = - new ObjectMapper() - .readValue( - tree.traverse(jp.getCodec()).readValueAsTree().toString(), - new TypeReference>() {}); - ret.setActualInstance(new UnparsedObject(res)); - } - return ret; - } + public void setAccessDetails( + TableResultV2DataAttributesFileMetadataOneOfAccessDetails accessDetails) { + this.accessDetails = accessDetails; + } - /** Handle deserialization of the 'null' value. */ - @Override - public TableResultV2DataAttributesFileMetadata getNullValue(DeserializationContext ctxt) - throws JsonMappingException { - throw new JsonMappingException( - ctxt.getParser(), "TableResultV2DataAttributesFileMetadata cannot be null"); - } + public TableResultV2DataAttributesFileMetadata errorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; } - // store a list of schema names defined in oneOf - public static final Map schemas = new HashMap(); + /** + * The error message returned from the last operation (sync for cloud storage, upload for local + * file). + * + * @return errorMessage + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERROR_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getErrorMessage() { + return errorMessage; + } - public TableResultV2DataAttributesFileMetadata() { - super("oneOf", Boolean.FALSE); + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; } - public TableResultV2DataAttributesFileMetadata( - TableResultV2DataAttributesFileMetadataCloudStorage o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); + public TableResultV2DataAttributesFileMetadata errorRowCount(Long errorRowCount) { + this.errorRowCount = errorRowCount; + return this; } - public TableResultV2DataAttributesFileMetadata( - TableResultV2DataAttributesFileMetadataLocalFile o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); + /** + * The number of rows that failed to process. + * + * @return errorRowCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERROR_ROW_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getErrorRowCount() { + return errorRowCount; } - static { - schemas.put( - "TableResultV2DataAttributesFileMetadataCloudStorage", - new GenericType() {}); - schemas.put( - "TableResultV2DataAttributesFileMetadataLocalFile", - new GenericType() {}); - JSON.registerDescendants( - TableResultV2DataAttributesFileMetadata.class, Collections.unmodifiableMap(schemas)); + public void setErrorRowCount(Long errorRowCount) { + this.errorRowCount = errorRowCount; } - @Override - public Map getSchemas() { - return TableResultV2DataAttributesFileMetadata.schemas; + public TableResultV2DataAttributesFileMetadata errorType( + TableResultV2DataAttributesFileMetadataCloudStorageErrorType errorType) { + this.errorType = errorType; + this.unparsed |= !errorType.isValid(); + return this; } /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: TableResultV2DataAttributesFileMetadataCloudStorage, - * TableResultV2DataAttributesFileMetadataLocalFile + * The type of error that occurred during file processing. This field provides high-level error + * categories for easier troubleshooting and is only present when there are errors. * - *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a - * composed schema (allOf, anyOf, oneOf). + * @return errorType */ - @Override - public void setActualInstance(Object instance) { - if (JSON.isInstanceOf( - TableResultV2DataAttributesFileMetadataCloudStorage.class, - instance, - new HashSet>())) { - super.setActualInstance(instance); - return; - } - if (JSON.isInstanceOf( - TableResultV2DataAttributesFileMetadataLocalFile.class, - instance, - new HashSet>())) { - super.setActualInstance(instance); - return; - } + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERROR_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TableResultV2DataAttributesFileMetadataCloudStorageErrorType getErrorType() { + return errorType; + } - if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; + public void setErrorType(TableResultV2DataAttributesFileMetadataCloudStorageErrorType errorType) { + if (!errorType.isValid()) { + this.unparsed = true; } - throw new RuntimeException( - "Invalid instance type. Must be TableResultV2DataAttributesFileMetadataCloudStorage," - + " TableResultV2DataAttributesFileMetadataLocalFile"); + this.errorType = errorType; + } + + public TableResultV2DataAttributesFileMetadata syncEnabled(Boolean syncEnabled) { + this.syncEnabled = syncEnabled; + return this; } /** - * Get the actual instance, which can be the following: - * TableResultV2DataAttributesFileMetadataCloudStorage, - * TableResultV2DataAttributesFileMetadataLocalFile + * Whether this table is synced automatically from cloud storage. Only applicable for cloud + * storage sources. * - * @return The actual instance (TableResultV2DataAttributesFileMetadataCloudStorage, - * TableResultV2DataAttributesFileMetadataLocalFile) + * @return syncEnabled */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SYNC_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getSyncEnabled() { + return syncEnabled; + } + + public void setSyncEnabled(Boolean syncEnabled) { + this.syncEnabled = syncEnabled; + } + + /** Return true if this TableResultV2DataAttributesFileMetadata object is equal to o. */ @Override - public Object getActualInstance() { - return super.getActualInstance(); + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TableResultV2DataAttributesFileMetadata tableResultV2DataAttributesFileMetadata = + (TableResultV2DataAttributesFileMetadata) o; + return Objects.equals(this.accessDetails, tableResultV2DataAttributesFileMetadata.accessDetails) + && Objects.equals(this.errorMessage, tableResultV2DataAttributesFileMetadata.errorMessage) + && Objects.equals(this.errorRowCount, tableResultV2DataAttributesFileMetadata.errorRowCount) + && Objects.equals(this.errorType, tableResultV2DataAttributesFileMetadata.errorType) + && Objects.equals(this.syncEnabled, tableResultV2DataAttributesFileMetadata.syncEnabled); } - /** - * Get the actual instance of `TableResultV2DataAttributesFileMetadataCloudStorage`. If the actual - * instance is not `TableResultV2DataAttributesFileMetadataCloudStorage`, the ClassCastException - * will be thrown. - * - * @return The actual instance of `TableResultV2DataAttributesFileMetadataCloudStorage` - * @throws ClassCastException if the instance is not - * `TableResultV2DataAttributesFileMetadataCloudStorage` - */ - public TableResultV2DataAttributesFileMetadataCloudStorage - getTableResultV2DataAttributesFileMetadataCloudStorage() throws ClassCastException { - return (TableResultV2DataAttributesFileMetadataCloudStorage) super.getActualInstance(); + @Override + public int hashCode() { + return Objects.hash(accessDetails, errorMessage, errorRowCount, errorType, syncEnabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TableResultV2DataAttributesFileMetadata {\n"); + sb.append(" accessDetails: ").append(toIndentedString(accessDetails)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" errorRowCount: ").append(toIndentedString(errorRowCount)).append("\n"); + sb.append(" errorType: ").append(toIndentedString(errorType)).append("\n"); + sb.append(" syncEnabled: ").append(toIndentedString(syncEnabled)).append("\n"); + sb.append('}'); + return sb.toString(); } /** - * Get the actual instance of `TableResultV2DataAttributesFileMetadataLocalFile`. If the actual - * instance is not `TableResultV2DataAttributesFileMetadataLocalFile`, the ClassCastException will - * be thrown. - * - * @return The actual instance of `TableResultV2DataAttributesFileMetadataLocalFile` - * @throws ClassCastException if the instance is not - * `TableResultV2DataAttributesFileMetadataLocalFile` + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ - public TableResultV2DataAttributesFileMetadataLocalFile - getTableResultV2DataAttributesFileMetadataLocalFile() throws ClassCastException { - return (TableResultV2DataAttributesFileMetadataLocalFile) super.getActualInstance(); + 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/TableResultV2DataAttributesFileMetadataCloudStorage.java b/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadataCloudStorage.java deleted file mode 100644 index eb8ea9bfc9f..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadataCloudStorage.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * 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.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.Objects; - -/** File metadata for reference tables created by cloud storage. */ -@JsonPropertyOrder({ - TableResultV2DataAttributesFileMetadataCloudStorage.JSON_PROPERTY_ACCESS_DETAILS, - TableResultV2DataAttributesFileMetadataCloudStorage.JSON_PROPERTY_ERROR_MESSAGE, - TableResultV2DataAttributesFileMetadataCloudStorage.JSON_PROPERTY_ERROR_ROW_COUNT, - TableResultV2DataAttributesFileMetadataCloudStorage.JSON_PROPERTY_ERROR_TYPE, - TableResultV2DataAttributesFileMetadataCloudStorage.JSON_PROPERTY_SYNC_ENABLED -}) -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class TableResultV2DataAttributesFileMetadataCloudStorage { - @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_ACCESS_DETAILS = "access_details"; - private TableResultV2DataAttributesFileMetadataOneOfAccessDetails accessDetails; - - public static final String JSON_PROPERTY_ERROR_MESSAGE = "error_message"; - private String errorMessage; - - public static final String JSON_PROPERTY_ERROR_ROW_COUNT = "error_row_count"; - private Long errorRowCount; - - public static final String JSON_PROPERTY_ERROR_TYPE = "error_type"; - private TableResultV2DataAttributesFileMetadataCloudStorageErrorType errorType; - - public static final String JSON_PROPERTY_SYNC_ENABLED = "sync_enabled"; - private Boolean syncEnabled; - - public TableResultV2DataAttributesFileMetadataCloudStorage() {} - - @JsonCreator - public TableResultV2DataAttributesFileMetadataCloudStorage( - @JsonProperty(required = true, value = JSON_PROPERTY_ACCESS_DETAILS) - TableResultV2DataAttributesFileMetadataOneOfAccessDetails accessDetails) { - this.accessDetails = accessDetails; - this.unparsed |= accessDetails.unparsed; - } - - public TableResultV2DataAttributesFileMetadataCloudStorage accessDetails( - TableResultV2DataAttributesFileMetadataOneOfAccessDetails accessDetails) { - this.accessDetails = accessDetails; - this.unparsed |= accessDetails.unparsed; - return this; - } - - /** - * Cloud storage access configuration for the reference table data file. - * - * @return accessDetails - */ - @JsonProperty(JSON_PROPERTY_ACCESS_DETAILS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public TableResultV2DataAttributesFileMetadataOneOfAccessDetails getAccessDetails() { - return accessDetails; - } - - public void setAccessDetails( - TableResultV2DataAttributesFileMetadataOneOfAccessDetails accessDetails) { - this.accessDetails = accessDetails; - } - - public TableResultV2DataAttributesFileMetadataCloudStorage errorMessage(String errorMessage) { - this.errorMessage = errorMessage; - return this; - } - - /** - * The error message returned from the sync. - * - * @return errorMessage - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_ERROR_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public TableResultV2DataAttributesFileMetadataCloudStorage errorRowCount(Long errorRowCount) { - this.errorRowCount = errorRowCount; - return this; - } - - /** - * The number of rows that failed to sync. - * - * @return errorRowCount - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_ERROR_ROW_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getErrorRowCount() { - return errorRowCount; - } - - public void setErrorRowCount(Long errorRowCount) { - this.errorRowCount = errorRowCount; - } - - public TableResultV2DataAttributesFileMetadataCloudStorage errorType( - TableResultV2DataAttributesFileMetadataCloudStorageErrorType errorType) { - this.errorType = errorType; - this.unparsed |= !errorType.isValid(); - return this; - } - - /** - * The type of error that occurred during file processing. This field provides high-level error - * categories for easier troubleshooting and is only present when there are errors. - * - * @return errorType - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_ERROR_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public TableResultV2DataAttributesFileMetadataCloudStorageErrorType getErrorType() { - return errorType; - } - - public void setErrorType(TableResultV2DataAttributesFileMetadataCloudStorageErrorType errorType) { - if (!errorType.isValid()) { - this.unparsed = true; - } - this.errorType = errorType; - } - - public TableResultV2DataAttributesFileMetadataCloudStorage syncEnabled(Boolean syncEnabled) { - this.syncEnabled = syncEnabled; - return this; - } - - /** - * Whether this table is synced automatically. - * - * @return syncEnabled - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_SYNC_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getSyncEnabled() { - return syncEnabled; - } - - public void setSyncEnabled(Boolean syncEnabled) { - this.syncEnabled = syncEnabled; - } - - /** - * Return true if this TableResultV2DataAttributesFileMetadataCloudStorage object is equal to o. - */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TableResultV2DataAttributesFileMetadataCloudStorage - tableResultV2DataAttributesFileMetadataCloudStorage = - (TableResultV2DataAttributesFileMetadataCloudStorage) o; - return Objects.equals( - this.accessDetails, tableResultV2DataAttributesFileMetadataCloudStorage.accessDetails) - && Objects.equals( - this.errorMessage, tableResultV2DataAttributesFileMetadataCloudStorage.errorMessage) - && Objects.equals( - this.errorRowCount, tableResultV2DataAttributesFileMetadataCloudStorage.errorRowCount) - && Objects.equals( - this.errorType, tableResultV2DataAttributesFileMetadataCloudStorage.errorType) - && Objects.equals( - this.syncEnabled, tableResultV2DataAttributesFileMetadataCloudStorage.syncEnabled); - } - - @Override - public int hashCode() { - return Objects.hash(accessDetails, errorMessage, errorRowCount, errorType, syncEnabled); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TableResultV2DataAttributesFileMetadataCloudStorage {\n"); - sb.append(" accessDetails: ").append(toIndentedString(accessDetails)).append("\n"); - sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); - sb.append(" errorRowCount: ").append(toIndentedString(errorRowCount)).append("\n"); - sb.append(" errorType: ").append(toIndentedString(errorType)).append("\n"); - sb.append(" syncEnabled: ").append(toIndentedString(syncEnabled)).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/TableResultV2DataAttributesFileMetadataLocalFile.java b/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadataLocalFile.java deleted file mode 100644 index 5cd29e76eac..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/TableResultV2DataAttributesFileMetadataLocalFile.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** - * File metadata for reference tables created by upload. Note that upload_id is only returned in the - * immediate create/replace response and is not available in subsequent GET requests. - */ -@JsonPropertyOrder({ - TableResultV2DataAttributesFileMetadataLocalFile.JSON_PROPERTY_ERROR_MESSAGE, - TableResultV2DataAttributesFileMetadataLocalFile.JSON_PROPERTY_ERROR_ROW_COUNT -}) -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class TableResultV2DataAttributesFileMetadataLocalFile { - @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_ERROR_MESSAGE = "error_message"; - private String errorMessage; - - public static final String JSON_PROPERTY_ERROR_ROW_COUNT = "error_row_count"; - private Long errorRowCount; - - public TableResultV2DataAttributesFileMetadataLocalFile errorMessage(String errorMessage) { - this.errorMessage = errorMessage; - return this; - } - - /** - * The error message returned from the creation/update. - * - * @return errorMessage - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_ERROR_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public TableResultV2DataAttributesFileMetadataLocalFile errorRowCount(Long errorRowCount) { - this.errorRowCount = errorRowCount; - return this; - } - - /** - * The number of rows that failed to create/update. - * - * @return errorRowCount - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_ERROR_ROW_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getErrorRowCount() { - return errorRowCount; - } - - public void setErrorRowCount(Long errorRowCount) { - this.errorRowCount = errorRowCount; - } - - /** Return true if this TableResultV2DataAttributesFileMetadataLocalFile object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TableResultV2DataAttributesFileMetadataLocalFile - tableResultV2DataAttributesFileMetadataLocalFile = - (TableResultV2DataAttributesFileMetadataLocalFile) o; - return Objects.equals( - this.errorMessage, tableResultV2DataAttributesFileMetadataLocalFile.errorMessage) - && Objects.equals( - this.errorRowCount, tableResultV2DataAttributesFileMetadataLocalFile.errorRowCount); - } - - @Override - public int hashCode() { - return Objects.hash(errorMessage, errorRowCount); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TableResultV2DataAttributesFileMetadataLocalFile {\n"); - sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); - sb.append(" errorRowCount: ").append(toIndentedString(errorRowCount)).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/reference_tables.feature b/src/test/resources/com/datadog/api/client/v2/api/reference_tables.feature index 6d4bc4b97f5..fa3ea42360a 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/reference_tables.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/reference_tables.feature @@ -10,21 +10,21 @@ Feature: Reference Tables @generated @skip @team:DataDog/redapl-experiences Scenario: Create reference table returns "Bad Request" response Given new "CreateReferenceTable" request - And body with value {"data": {"attributes": {"description": "this is a cloud table generated via a cloud bucket sync", "file_metadata": {"access_details": {"aws_detail": {"aws_account_id": "test-account-id", "aws_bucket_name": "test-bucket", "file_path": "test_rt.csv"}}, "sync_enabled": true}, "schema": {"fields": [{"name": "name", "type": "STRING"}, {"name": "account_id", "type": "STRING"}], "primary_keys": ["account_id"]}, "source": "S3", "table_name": "test_reference_table", "tags": ["test_tag"]}, "type": "reference_table"}} + And body with value {"data": {"attributes": {"file_metadata": {"access_details": {"aws_detail": {"aws_account_id": "123456789000", "aws_bucket_name": "example-data-bucket", "file_path": "reference-tables/users.csv"}, "azure_detail": {"azure_client_id": "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb", "azure_container_name": "reference-data", "azure_storage_account_name": "examplestorageaccount", "azure_tenant_id": "cccccccc-4444-5555-6666-dddddddddddd", "file_path": "tables/users.csv"}, "gcp_detail": {"file_path": "data/reference_tables/users.csv", "gcp_bucket_name": "example-data-bucket", "gcp_project_id": "example-gcp-project-12345", "gcp_service_account_email": "example-service@example-gcp-project-12345.iam.gserviceaccount.com"}}, "sync_enabled": false}, "schema": {"fields": [{"name": "field_1", "type": "STRING"}], "primary_keys": ["field_1"]}, "source": "LOCAL_FILE", "table_name": "table_1", "tags": ["tag_1", "tag_2"]}, "type": "reference_table"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/redapl-experiences Scenario: Create reference table returns "Created" response Given new "CreateReferenceTable" request - And body with value {"data": {"attributes": {"description": "this is a cloud table generated via a cloud bucket sync", "file_metadata": {"access_details": {"aws_detail": {"aws_account_id": "test-account-id", "aws_bucket_name": "test-bucket", "file_path": "test_rt.csv"}}, "sync_enabled": true}, "schema": {"fields": [{"name": "name", "type": "STRING"}, {"name": "account_id", "type": "STRING"}], "primary_keys": ["account_id"]}, "source": "S3", "table_name": "test_reference_table", "tags": ["test_tag"]}, "type": "reference_table"}} + And body with value {"data": {"attributes": {"file_metadata": {"access_details": {"aws_detail": {"aws_account_id": "123456789000", "aws_bucket_name": "example-data-bucket", "file_path": "reference-tables/users.csv"}, "azure_detail": {"azure_client_id": "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb", "azure_container_name": "reference-data", "azure_storage_account_name": "examplestorageaccount", "azure_tenant_id": "cccccccc-4444-5555-6666-dddddddddddd", "file_path": "tables/users.csv"}, "gcp_detail": {"file_path": "data/reference_tables/users.csv", "gcp_bucket_name": "example-data-bucket", "gcp_project_id": "example-gcp-project-12345", "gcp_service_account_email": "example-service@example-gcp-project-12345.iam.gserviceaccount.com"}}, "sync_enabled": false}, "schema": {"fields": [{"name": "field_1", "type": "STRING"}], "primary_keys": ["field_1"]}, "source": "LOCAL_FILE", "table_name": "table_1", "tags": ["tag_1", "tag_2"]}, "type": "reference_table"}} When the request is sent Then the response status is 201 Created @generated @skip @team:DataDog/redapl-experiences Scenario: Create reference table upload returns "Bad Request" response Given new "CreateReferenceTableUpload" request - And body with value {"data": {"attributes": {"headers": ["field_1", "field_2"], "part_count": 3, "part_size": 10000000, "table_name": ""}, "type": "upload"}} + And body with value {"data": {"attributes": {"headers": ["product_id", "product_name", "price"], "part_count": 3, "part_size": 10000000, "table_name": "my_products_table"}, "type": "upload"}} When the request is sent Then the response status is 400 Bad Request