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