software.amazon.awscdk.services.glue.alpha.Table Maven / Gradle / Ivy
Show all versions of glue-alpha Show documentation
package software.amazon.awscdk.services.glue.alpha;
/**
* (experimental) A Glue table.
*
* Example:
*
*
* Database myDatabase;
* Table.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)
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.78.1 (build 878761e)", date = "2023-04-05T23:24:21.834Z")
@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.Table")
public class Table extends software.amazon.awscdk.Resource implements software.amazon.awscdk.services.glue.alpha.ITable {
protected Table(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Table(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 Table(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.TableProps 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") });
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param tableArn This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.glue.alpha.ITable fromTableArn(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull java.lang.String tableArn) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.glue.alpha.Table.class, "fromTableArn", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.alpha.ITable.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(tableArn, "tableArn is required") });
}
/**
* (experimental) Creates a Table construct that represents an external table.
*
* @param scope The scope creating construct (usually `this`). This parameter is required.
* @param id The construct's id. This parameter is required.
* @param attrs Import attributes. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.glue.alpha.ITable fromTableAttributes(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.TableAttributes attrs) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.glue.alpha.Table.class, "fromTableAttributes", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.alpha.ITable.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(attrs, "attrs is required") });
}
/**
* (experimental) Add a partition index to the table.
*
* You can have a maximum of 3 partition
* indexes to a table. Partition index keys must be a subset of the table's
* partition keys.
*
* @see https://docs.aws.amazon.com/glue/latest/dg/partition-indexes.html
* @param index This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addPartitionIndex(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.glue.alpha.PartitionIndex index) {
software.amazon.jsii.Kernel.call(this, "addPartitionIndex", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(index, "index is required") });
}
/**
* (experimental) Grant the given identity custom permissions.
*
* @param grantee This parameter is required.
* @param actions This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.Grant grant(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IGrantable grantee, final @org.jetbrains.annotations.NotNull java.util.List actions) {
return software.amazon.jsii.Kernel.call(this, "grant", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.Grant.class), new Object[] { java.util.Objects.requireNonNull(grantee, "grantee is required"), java.util.Objects.requireNonNull(actions, "actions is required") });
}
/**
* (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)
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)
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 the given identity custom permissions to ALL underlying resources of the table.
*
* Permissions will be granted to the catalog, the database, and the table.
*
* @param grantee This parameter is required.
* @param actions This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.Grant grantToUnderlyingResources(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IGrantable grantee, final @org.jetbrains.annotations.NotNull java.util.List actions) {
return software.amazon.jsii.Kernel.call(this, "grantToUnderlyingResources", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.Grant.class), new Object[] { java.util.Objects.requireNonNull(grantee, "grantee is required"), java.util.Objects.requireNonNull(actions, "actions 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)
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) This table's columns.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.List getColumns() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "columns", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.alpha.Column.class))));
}
/**
* (experimental) Indicates whether the table's data is compressed or not.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.Boolean getCompressed() {
return software.amazon.jsii.Kernel.get(this, "compressed", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
* (experimental) Database this table belongs to.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.glue.alpha.IDatabase getDatabase() {
return software.amazon.jsii.Kernel.get(this, "database", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.alpha.IDatabase.class));
}
/**
* (experimental) Format of this table's data files.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.glue.alpha.DataFormat getDataFormat() {
return software.amazon.jsii.Kernel.get(this, "dataFormat", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.alpha.DataFormat.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));
}
/**
* (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.
*/
@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) This table's partition keys if the table is partitioned.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable java.util.List getPartitionKeys() {
return java.util.Optional.ofNullable((java.util.List)(software.amazon.jsii.Kernel.get(this, "partitionKeys", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.glue.alpha.Column.class))))).map(java.util.Collections::unmodifiableList).orElse(null);
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.glue.alpha.Table}.
*/
@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.TableProps.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.TableProps.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) 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) 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 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: Unencrypted
*
* @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) 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) 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;
}
/**
* (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;
}
/**
* @returns a newly built instance of {@link software.amazon.awscdk.services.glue.alpha.Table}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.glue.alpha.Table build() {
return new software.amazon.awscdk.services.glue.alpha.Table(
this.scope,
this.id,
this.props.build()
);
}
}
}