createDataLakeDataset

Enables you to programmatically create an Amazon Web Services Supply Chain data lake dataset. Developers can create the datasets using their pre-defined or custom schema for a given instance ID, namespace, and dataset name.

Samples

import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPartitionField
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPartitionFieldTransform
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPartitionSpec
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPartitionTransformType
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPrimaryKeyField
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetSchema
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetSchemaField
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetSchemaFieldType

fun main() { 
   //sampleStart 
   // Create an AWS Supply Chain inbound order dataset
val resp = supplyChainClient.createDataLakeDataset {
    instanceId = "1877dd20-dee9-4639-8e99-cb67acf21fe5"
    namespace = "asc"
    name = "inbound_order"
    description = "This is an AWS Supply Chain inbound order dataset"
    tags = mapOf<String, String>(
        "tagKey1" to "tagValue1",
        "tagKey2" to "tagValue2"
    )
} 
   //sampleEnd
}
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPartitionField
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPartitionFieldTransform
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPartitionSpec
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPartitionTransformType
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetPrimaryKeyField
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetSchema
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetSchemaField
import aws.sdk.kotlin.services.supplychain.model.DataLakeDatasetSchemaFieldType

fun main() { 
   //sampleStart 
   // Create a custom dataset
val resp = supplyChainClient.createDataLakeDataset {
    instanceId = "1877dd20-dee9-4639-8e99-cb67acf21fe5"
    namespace = "default"
    name = "my_dataset"
    description = "This is a custom dataset"
    schema = DataLakeDatasetSchema {
        name = "MyDataset"
        fields = listOf<DataLakeDatasetSchemaField>(
            DataLakeDatasetSchemaField {
                name = "id"
                type = DataLakeDatasetSchemaFieldType.fromValue("INT")
                isRequired = true
            },
            DataLakeDatasetSchemaField {
                name = "description"
                type = DataLakeDatasetSchemaFieldType.fromValue("STRING")
                isRequired = true
            },
            DataLakeDatasetSchemaField {
                name = "price"
                type = DataLakeDatasetSchemaFieldType.fromValue("DOUBLE")
                isRequired = false
            },
            DataLakeDatasetSchemaField {
                name = "creation_time"
                type = DataLakeDatasetSchemaFieldType.fromValue("TIMESTAMP")
                isRequired = false
            },
            DataLakeDatasetSchemaField {
                name = "quantity"
                type = DataLakeDatasetSchemaFieldType.fromValue("LONG")
                isRequired = false
            }                
        )
        primaryKeys = listOf<DataLakeDatasetPrimaryKeyField>(
            DataLakeDatasetPrimaryKeyField {
                name = "id"
            }                
        )
    }
    partitionSpec = DataLakeDatasetPartitionSpec {
        fields = listOf<DataLakeDatasetPartitionField>(
            DataLakeDatasetPartitionField {
                name = "creation_time"
                transform = DataLakeDatasetPartitionFieldTransform {
                    type = DataLakeDatasetPartitionTransformType.fromValue("DAY")
                }
            },
            DataLakeDatasetPartitionField {
                name = "description"
                transform = DataLakeDatasetPartitionFieldTransform {
                    type = DataLakeDatasetPartitionTransformType.fromValue("IDENTITY")
                }
            }                
        )
    }
    tags = mapOf<String, String>(
        "tagKey1" to "tagValue1",
        "tagKey2" to "tagValue2"
    )
} 
   //sampleEnd
}