software.amazon.awscdk.services.glue.alpha.S3Table Maven / Gradle / Ivy
package software.amazon.awscdk.services.glue.alpha;
/**
* (experimental) A Glue table that targets a S3 dataset.
*
* Example:
*
*
* Database myDatabase;
* S3Table.Builder.create(this, "MyTable")
* .database(myDatabase)
* .columns(List.of(Column.builder()
* .name("col1")
* .type(Schema.STRING)
* .build()))
* .partitionKeys(List.of(Column.builder()
* .name("year")
* .type(Schema.SMALL_INT)
* .build(), Column.builder()
* .name("month")
* .type(Schema.SMALL_INT)
* .build()))
* .dataFormat(DataFormat.JSON)
* .enablePartitionFiltering(true)
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-11-15T10:25:09.354Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.glue.alpha.$Module.class, fqn = "@aws-cdk/aws-glue-alpha.S3Table")
public class S3Table extends software.amazon.awscdk.services.glue.alpha.TableBase {
protected S3Table(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected S3Table(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public S3Table(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.glue.alpha.S3TableProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull java.lang.String generateS3PrefixForGrant() {
return software.amazon.jsii.Kernel.call(this, "generateS3PrefixForGrant", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) Grant read permissions to the table and the underlying data stored in S3 to an IAM principal.
*
* @param grantee the principal. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.Grant grantRead(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IGrantable grantee) {
return software.amazon.jsii.Kernel.call(this, "grantRead", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.Grant.class), new Object[] { java.util.Objects.requireNonNull(grantee, "grantee is required") });
}
/**
* (experimental) Grant read and write permissions to the table and the underlying data stored in S3 to an IAM principal.
*
* @param grantee the principal. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.Grant grantReadWrite(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IGrantable grantee) {
return software.amazon.jsii.Kernel.call(this, "grantReadWrite", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.Grant.class), new Object[] { java.util.Objects.requireNonNull(grantee, "grantee is required") });
}
/**
* (experimental) Grant write permissions to the table and the underlying data stored in S3 to an IAM principal.
*
* @param grantee the principal. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.Grant grantWrite(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IGrantable grantee) {
return software.amazon.jsii.Kernel.call(this, "grantWrite", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.Grant.class), new Object[] { java.util.Objects.requireNonNull(grantee, "grantee is required") });
}
/**
* (experimental) S3 bucket in which the table's data resides.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.s3.IBucket getBucket() {
return software.amazon.jsii.Kernel.get(this, "bucket", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.s3.IBucket.class));
}
/**
* (experimental) The type of encryption enabled for the table.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.glue.alpha.TableEncryption getEncryption() {
return software.amazon.jsii.Kernel.get(this, "encryption", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.alpha.TableEncryption.class));
}
/**
* (experimental) S3 Key Prefix under which this table's files are stored in S3.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getS3Prefix() {
return software.amazon.jsii.Kernel.get(this, "s3Prefix", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) ARN of this table.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getTableArn() {
return software.amazon.jsii.Kernel.get(this, "tableArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) Name of this table.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getTableName() {
return software.amazon.jsii.Kernel.get(this, "tableName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.glue.CfnTable getTableResource() {
return software.amazon.jsii.Kernel.get(this, "tableResource", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.CfnTable.class));
}
/**
* (experimental) The KMS key used to secure the data if encryption
is set to CSE-KMS
or SSE-KMS
.
*
* Otherwise, undefined
.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.kms.IKey getEncryptionKey() {
return software.amazon.jsii.Kernel.get(this, "encryptionKey", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.kms.IKey.class));
}
/**
* (experimental) This table's partition indexes.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable java.util.List getPartitionIndexes() {
return java.util.Optional.ofNullable((java.util.List)(software.amazon.jsii.Kernel.get(this, "partitionIndexes", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.alpha.PartitionIndex.class))))).map(java.util.Collections::unmodifiableList).orElse(null);
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.glue.alpha.S3Table}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private final software.amazon.awscdk.services.glue.alpha.S3TableProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new software.amazon.awscdk.services.glue.alpha.S3TableProps.Builder();
}
/**
* (experimental) Columns of the table.
*
* @return {@code this}
* @param columns Columns of the table. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder columns(final java.util.List extends software.amazon.awscdk.services.glue.alpha.Column> columns) {
this.props.columns(columns);
return this;
}
/**
* (experimental) Database in which to store the table.
*
* @return {@code this}
* @param database Database in which to store the table. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder database(final software.amazon.awscdk.services.glue.alpha.IDatabase database) {
this.props.database(database);
return this;
}
/**
* (experimental) Storage type of the table's data.
*
* @return {@code this}
* @param dataFormat Storage type of the table's data. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder dataFormat(final software.amazon.awscdk.services.glue.alpha.DataFormat dataFormat) {
this.props.dataFormat(dataFormat);
return this;
}
/**
* (experimental) Indicates whether the table's data is compressed or not.
*
* Default: false
*
* @return {@code this}
* @param compressed Indicates whether the table's data is compressed or not. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder compressed(final java.lang.Boolean compressed) {
this.props.compressed(compressed);
return this;
}
/**
* (experimental) Description of the table.
*
* Default: generated
*
* @return {@code this}
* @param description Description of the table. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder description(final java.lang.String description) {
this.props.description(description);
return this;
}
/**
* (experimental) Enables partition filtering.
*
* Default: - The parameter is not defined
*
* @return {@code this}
* @see https://docs.aws.amazon.com/athena/latest/ug/glue-best-practices.html#glue-best-practices-partition-index
* @param enablePartitionFiltering Enables partition filtering. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enablePartitionFiltering(final java.lang.Boolean enablePartitionFiltering) {
this.props.enablePartitionFiltering(enablePartitionFiltering);
return this;
}
/**
* (experimental) The key/value pairs define properties associated with the table.
*
* The key/value pairs that are allowed to be submitted are not limited, however their functionality is not guaranteed.
*
* Default: - The parameter is not defined
*
* @return {@code this}
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-parameters
* @param parameters The key/value pairs define properties associated with the table. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder parameters(final java.util.Map parameters) {
this.props.parameters(parameters);
return this;
}
/**
* (experimental) Partition indexes on the table.
*
* A maximum of 3 indexes
* are allowed on a table. Keys in the index must be part
* of the table's partition keys.
*
* Default: table has no partition indexes
*
* @return {@code this}
* @param partitionIndexes Partition indexes on the table. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder partitionIndexes(final java.util.List extends software.amazon.awscdk.services.glue.alpha.PartitionIndex> partitionIndexes) {
this.props.partitionIndexes(partitionIndexes);
return this;
}
/**
* (experimental) Partition columns of the table.
*
* Default: table is not partitioned
*
* @return {@code this}
* @param partitionKeys Partition columns of the table. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder partitionKeys(final java.util.List extends software.amazon.awscdk.services.glue.alpha.Column> partitionKeys) {
this.props.partitionKeys(partitionKeys);
return this;
}
/**
* (experimental) The user-supplied properties for the description of the physical storage of this table.
*
* These properties help describe the format of the data that is stored within the crawled data sources.
*
* The key/value pairs that are allowed to be submitted are not limited, however their functionality is not guaranteed.
*
* Some keys will be auto-populated by glue crawlers, however, you can override them by specifying the key and value in this property.
*
* Default: - The parameter is not defined
*
* Example:
*
*
* IDatabase glueDatabase;
* Table table = Table.Builder.create(this, "Table")
* .storageParameters(List.of(StorageParameter.skipHeaderLineCount(1), StorageParameter.compressionType(CompressionType.GZIP), StorageParameter.custom("foo", "bar"), StorageParameter.custom("separatorChar", ","), StorageParameter.custom(StorageParameters.WRITE_PARALLEL, "off")))
* // ...
* .database(glueDatabase)
* .columns(List.of(Column.builder()
* .name("col1")
* .type(Schema.STRING)
* .build()))
* .dataFormat(DataFormat.CSV)
* .build();
*
*
* @return {@code this}
* @see https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_TABLE.html#r_CREATE_EXTERNAL_TABLE-parameters - under _"TABLE PROPERTIES"_
* @param storageParameters The user-supplied properties for the description of the physical storage of this table. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder storageParameters(final java.util.List extends software.amazon.awscdk.services.glue.alpha.StorageParameter> storageParameters) {
this.props.storageParameters(storageParameters);
return this;
}
/**
* (experimental) Indicates whether the table data is stored in subdirectories.
*
* Default: false
*
* @return {@code this}
* @param storedAsSubDirectories Indicates whether the table data is stored in subdirectories. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder storedAsSubDirectories(final java.lang.Boolean storedAsSubDirectories) {
this.props.storedAsSubDirectories(storedAsSubDirectories);
return this;
}
/**
* (experimental) Name of the table.
*
* Default: - generated by CDK.
*
* @return {@code this}
* @param tableName Name of the table. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder tableName(final java.lang.String tableName) {
this.props.tableName(tableName);
return this;
}
/**
* (experimental) S3 bucket in which to store data.
*
* Default: one is created for you
*
* @return {@code this}
* @param bucket S3 bucket in which to store data. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder bucket(final software.amazon.awscdk.services.s3.IBucket bucket) {
this.props.bucket(bucket);
return this;
}
/**
* (experimental) The kind of encryption to secure the data with.
*
* You can only provide this option if you are not explicitly passing in a bucket.
*
* If you choose SSE-KMS
, you can provide an un-managed KMS key with encryptionKey
.
* If you choose CSE-KMS
, you must provide an un-managed KMS key with encryptionKey
.
*
* Default: BucketEncryption.S3_MANAGED
*
* @return {@code this}
* @param encryption The kind of encryption to secure the data with. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder encryption(final software.amazon.awscdk.services.glue.alpha.TableEncryption encryption) {
this.props.encryption(encryption);
return this;
}
/**
* (experimental) External KMS key to use for bucket encryption.
*
* The encryption
property must be SSE-KMS
or CSE-KMS
.
*
* Default: key is managed by KMS.
*
* @return {@code this}
* @param encryptionKey External KMS key to use for bucket encryption. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder encryptionKey(final software.amazon.awscdk.services.kms.IKey encryptionKey) {
this.props.encryptionKey(encryptionKey);
return this;
}
/**
* (experimental) S3 prefix under which table objects are stored.
*
* Default: - No prefix. The data will be stored under the root of the bucket.
*
* @return {@code this}
* @param s3Prefix S3 prefix under which table objects are stored. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder s3Prefix(final java.lang.String s3Prefix) {
this.props.s3Prefix(s3Prefix);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.services.glue.alpha.S3Table}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.glue.alpha.S3Table build() {
return new software.amazon.awscdk.services.glue.alpha.S3Table(
this.scope,
this.id,
this.props.build()
);
}
}
}