TableBucket L2 construct
An S3 table bucket with helpers for associated resource policies.
This bucket may not yet have all features that exposed by the underlying CfnTableBucket.
Example
const sampleTableBucket = new TableBucket(scope, 'ExampleTableBucket', {
tableBucketName: 'example-bucket',
// Optional fields:
unreferencedFileRemoval: {
noncurrentDays: 123,
status: UnreferencedFileRemovalStatus.ENABLED,
unreferencedDays: 123,
},
});
from aws_cdk.aws_s3tables_alpha import UnreferencedFileRemoval
sample_table_bucket = TableBucket(scope, "ExampleTableBucket",
table_bucket_name="example-bucket",
# Optional fields:
unreferenced_file_removal=UnreferencedFileRemoval(
noncurrent_days=123,
status=UnreferencedFileRemovalStatus.ENABLED,
unreferenced_days=123
)
)
TableBucket sampleTableBucket = TableBucket.Builder.create(scope, "ExampleTableBucket")
.tableBucketName("example-bucket")
// Optional fields:
.unreferencedFileRemoval(UnreferencedFileRemoval.builder()
.noncurrentDays(123)
.status(UnreferencedFileRemovalStatus.ENABLED)
.unreferencedDays(123)
.build())
.build();
// Install: dotnet add package Amazon.CDK.AWS.S3Tables.Alpha
var sampleTableBucket = new TableBucket(scope, "ExampleTableBucket", new TableBucketProps {
TableBucketName = "example-bucket",
// Optional fields:
UnreferencedFileRemoval = new UnreferencedFileRemoval {
NoncurrentDays = 123,
Status = UnreferencedFileRemovalStatus.ENABLED,
UnreferencedDays = 123
}
});
sampleTableBucket := awscdkawss3tablesalpha.NewTableBucket(*scope, jsii.String("ExampleTableBucket"), &TableBucketProps{
TableBucketName: jsii.String("example-bucket"),
// Optional fields:
UnreferencedFileRemoval: &UnreferencedFileRemoval{
NoncurrentDays: jsii.Number(123),
Status: *awscdkawss3tablesalpha.UnreferencedFileRemovalStatus_ENABLED,
UnreferencedDays: jsii.Number(123),
},
})
Initializer
new TableBucket(scope: Construct, id: string, props?: TableBucketProps)
TableBucket(scope: Construct, id: str, props: typing.Optional[TableBucketProps] = None)
new TableBucket(Construct scope, String id, TableBucketProps props)
new TableBucket(Construct scope, string id, TableBucketProps? props = null)
NewTableBucket(Scope Construct, Id *string, Props TableBucketProps)
Construct Props
default
Default: it's assumed the bucket belongs to the same account as the scope it's being imported into
encryptionTableBucketEncryptionencryptionTableBucketEncryptionencryptionTableBucketEncryptionEncryptionTableBucketEncryptionEncryptionTableBucketEncryption= `KMS` if `encryptionKey` is spec…#If you choose KMS, you can specify a KMS key via encryptionKey. If encryption key is not specified, a key will automatically be created.
default
Default: KMS if encryptionKey is specified, or S3_MANAGED otherwise.
encryptionKeyIKeyencryption_keyIKeyencryptionKeyIKeyEncryptionKeyIKeyEncryptionKeyIKey= If `encryption` is set to `KMS` …#The encryption property must be either not specified or set to KMS. An error will be emitted if encryption is set to S3_MANAGED.
default
Default: If encryption is set to KMS and this property is undefined, a new KMS key will be created and associated with this bucket.
default
Default: it's assumed the bucket is in the same region as the scope it's being imported into
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RETAIN#requestMetricsStatusRequestMetricsStatusrequest_metrics_statusRequestMetricsStatusrequestMetricsStatusRequestMetricsStatusRequestMetricsStatusRequestMetricsStatusRequestMetricsStatusRequestMetricsStatus= Request metrics are disabled#When enabled, S3 Tables publishes CloudWatch request metrics for the table bucket. Request metrics provide insight into Amazon S3 Tables requests.
storageClassStorageClassstorage_classStorageClassstorageClassStorageClassStorageClassStorageClassStorageClassStorageClass= STANDARD storage class#Determines the storage tier used for table data, allowing optimization for different access patterns and cost profiles.
tableBucketNamestringtable_bucket_namestrtableBucketNameStringTableBucketNamestringTableBucketName*string= generated by CDK from the stack …#default
Default: generated by CDK from the stack and construct path.
unreferencedFileRemovalUnreferencedFileRemovalunreferenced_file_removalUnreferencedFileRemovalunreferencedFileRemovalUnreferencedFileRemovalUnreferencedFileRemovalUnreferencedFileRemovalUnreferencedFileRemovalUnreferencedFileRemoval= Enabled with default values#Properties
cdkTagManagerTagManagercdk_tag_managerTagManagercdkTagManagerTagManagerCdkTagManagerTagManagerCdkTagManagerTagManagerrequired#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#tableBucketArnstringtable_bucket_arnstrtableBucketArnStringTableBucketArnstringTableBucketArn*stringrequired#tableBucketNamestringtable_bucket_namestrtableBucketNameStringTableBucketNamestringTableBucketName*stringrequired#tableBucketPolicyTableBucketPolicytable_bucket_policyTableBucketPolicytableBucketPolicyTableBucketPolicyTableBucketPolicyTableBucketPolicyTableBucketPolicyTableBucketPolicy#Methods
addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResultdef add_to_resource_policy(self, statement: PolicyStatement) -> AddToResourcePolicyResultpublic AddToResourcePolicyResult addToResourcePolicy(PolicyStatement statement)public AddToResourcePolicyResult AddToResourcePolicy(PolicyStatement statement)func AddToResourcePolicy(Statement PolicyStatement) AddToResourcePolicyResult#notes · 1 parameter · returns
Note that the policy statement may or may not be added to the policy. For example, when an ITableBucket is created from an existing table bucket, it's not possible to tell whether the bucket already has a policy attached, let alone to re-use that policy to add more statements to it. So it's safest to do nothing in these cases.
Parameters
statementstatementstatementstatementStatement— the policy statement to be added to the bucket's policy.
Returns: metadata about the execution of this method. If the policy was not added, the value of statementAdded will be false. You should always check this value to make sure that the operation was actually carried out. Otherwise, synthesis and deploy will terminate silently, which may be confusing.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
fromTableBucketArn(scope: Construct, id: string, tableBucketArn: string): ITableBucket@staticmethod def from_table_bucket_arn(scope: Construct, id: str, table_bucket_arn: str) -> ITableBucketpublic static ITableBucket fromTableBucketArn(Construct scope, String id, String tableBucketArn)public static ITableBucket FromTableBucketArn(Construct scope, string id, string tableBucketArn)func FromTableBucketArn(Scope Construct, Id *string, TableBucketArn *string) ITableBucketstatic#3 parameters
Parameters
scopescopescopescopeScope— The parent creating construct (usuallythis).ididididId— The construct's name.tableBucketArntable_bucket_arntableBucketArntableBucketArnTableBucketArn— Amazon Resource Name (arn) of the table bucket.
fromTableBucketAttributes(scope: Construct, id: string, attrs: TableBucketAttributes): ITableBucket@staticmethod def from_table_bucket_attributes(scope: Construct, id: str, attrs: TableBucketAttributes) -> ITableBucketpublic static ITableBucket fromTableBucketAttributes(Construct scope, String id, TableBucketAttributes attrs)public static ITableBucket FromTableBucketAttributes(Construct scope, string id, TableBucketAttributes attrs)func FromTableBucketAttributes(Scope Construct, Id *string, Attrs TableBucketAttributes) ITableBucketstatic#3 parameters
Parameters
scopescopescopescopeScope— The parent creating construct (usuallythis).ididididId— The construct's name.attrsattrsattrsattrsAttrs— ATableBucketAttributesobject.
grantRead(identity: IGrantable, tableId: string): Grantdef grant_read(self, identity: IGrantable, table_id: str) -> Grantpublic Grant grantRead(IGrantable identity, String tableId)public Grant GrantRead(IGrantable identity, string tableId)func GrantRead(Identity IGrantable, TableId *string) Grant#grantReadWrite(identity: IGrantable, tableId: string): Grantdef grant_read_write(self, identity: IGrantable, table_id: str) -> Grantpublic Grant grantReadWrite(IGrantable identity, String tableId)public Grant GrantReadWrite(IGrantable identity, string tableId)func GrantReadWrite(Identity IGrantable, TableId *string) Grant#grantWrite(identity: IGrantable, tableId: string): Grantdef grant_write(self, identity: IGrantable, table_id: str) -> Grantpublic Grant grantWrite(IGrantable identity, String tableId)public Grant GrantWrite(IGrantable identity, string tableId)func GrantWrite(Identity IGrantable, TableId *string) Grant#isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#validateTableBucketName(bucketName?: string): void@staticmethod def validate_table_bucket_name(bucket_name: typing.Optional[str] = None) -> Nonepublic static void validateTableBucketName(String bucketName)public static void ValidateTableBucketName(string? bucketName = null)func ValidateTableBucketName(BucketName *string)static#1 parameter
Parameters
bucketNamebucket_namebucketNamebucketNameBucketName— name of the bucket.
validateUnreferencedFileRemoval(unreferencedFileRemoval?: UnreferencedFileRemoval): void@staticmethod def validate_unreferenced_file_removal(unreferenced_file_removal: typing.Optional[UnreferencedFileRemoval] = None) -> Nonepublic static void validateUnreferencedFileRemoval(UnreferencedFileRemoval unreferencedFileRemoval)public static void ValidateUnreferencedFileRemoval(UnreferencedFileRemoval? unreferencedFileRemoval = null)func ValidateUnreferencedFileRemoval(UnreferencedFileRemoval UnreferencedFileRemoval)static#1 parameter
Parameters
unreferencedFileRemovalunreferenced_file_removalunreferencedFileRemovalunreferencedFileRemovalUnreferencedFileRemoval— configuration for the table bucket.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.