Class IBucket.Jsii$Proxy
- All Implemented Interfaces:
IEnvironmentAware,IEnvironmentAware.Jsii$Default,IBucketRef,IBucketRef.Jsii$Default,IResource,IResource.Jsii$Default,IBucket,IBucket.Jsii$Default,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IConstruct.Jsii$Default,software.constructs.IDependable,software.constructs.IDependable.Jsii$Default
- Enclosing interface:
IBucket
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.s3.IBucket
IBucket.Jsii$Default, IBucket.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.s3.IBucketRef
IBucketRef.Jsii$Default, IBucketRef.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IDependable
software.constructs.IDependable.Jsii$Default, software.constructs.IDependable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
IEnvironmentAware.Jsii$Default, IEnvironmentAware.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default, IResource.Jsii$Proxy -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddEventNotification(EventType event, IBucketNotificationDestination dest, NotificationKeyFilter... filters) Adds a bucket notification event destination.final voidaddObjectCreatedNotification(IBucketNotificationDestination dest, NotificationKeyFilter... filters) Subscribes a destination to receive notifications when an object is created in the bucket.final voidaddObjectRemovedNotification(IBucketNotificationDestination dest, NotificationKeyFilter... filters) Subscribes a destination to receive notifications when an object is removed from the bucket.final voidaddReplicationPolicy(String roleArn) Function to add required permissions to the destination bucket for cross account replication.final voidaddReplicationPolicy(String roleArn, Boolean accessControlTransition) Function to add required permissions to the destination bucket for cross account replication.final voidaddReplicationPolicy(String roleArn, Boolean accessControlTransition, String account) Function to add required permissions to the destination bucket for cross account replication.addToResourcePolicy(PolicyStatement permission) Adds a statement to the resource policy for a principal (i.e.final voidapplyRemovalPolicy(RemovalPolicy policy) Apply the given removal policy to this resource.final StringarnForObjects(String keyPattern) Returns an ARN that represents all objects within the bucket that match the key pattern specified.final voidEnables event bridge notification, causing all events below to be sent to EventBridge:.final StringThe ARN of the bucket.final StringThe IPv4 DNS name of the specified bucket.final StringThe IPv6 DNS name of the specified bucket.final StringThe name of the bucket.final BucketReference(experimental) A reference to a Bucket resource.final StringThe regional domain name of the specified bucket.final StringThe Domain name of the static website.final StringThe URL of the static website.final IKeyOptional KMS encryption key associated with this bucket.final ResourceEnvironmentgetEnv()The environment this resource belongs to.final BooleanIf this bucket has been configured for static website hosting.final software.constructs.NodegetNode()The tree node.final BucketPolicyThe resource policy associated with this bucket.final StringRole used to set up permissions on this bucket for replication.final StackgetStack()The stack in which this resource is defined.final GrantgrantDelete(IGrantable identity) Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket.final GrantgrantDelete(IGrantable identity, Object objectsKeyPattern) Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket.final GrantgrantPublicAccess(String keyPrefix, String... allowedActions) Allows unrestricted access to objects from this bucket.final GrantgrantPut(IGrantable identity) Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.final GrantgrantPut(IGrantable identity, Object objectsKeyPattern) Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.final GrantgrantPutAcl(IGrantable identity) Grant the given IAM identity permissions to modify the ACLs of objects in the given Bucket.final GrantgrantPutAcl(IGrantable identity, String objectsKeyPattern) Grant the given IAM identity permissions to modify the ACLs of objects in the given Bucket.final GrantgrantRead(IGrantable identity) Grant read permissions for this bucket and it's contents to an IAM principal (Role/Group/User).final GrantgrantRead(IGrantable identity, Object objectsKeyPattern) Grant read permissions for this bucket and it's contents to an IAM principal (Role/Group/User).final GrantgrantReadWrite(IGrantable identity) Grants read/write permissions for this bucket and it's contents to an IAM principal (Role/Group/User).final GrantgrantReadWrite(IGrantable identity, Object objectsKeyPattern) Grants read/write permissions for this bucket and it's contents to an IAM principal (Role/Group/User).final GrantgrantReplicationPermission(IGrantable identity, GrantReplicationPermissionProps props) Allows permissions for replication operation to bucket replication role.final GrantgrantWrite(IGrantable identity) Grant write permissions to this bucket to an IAM principal.final GrantgrantWrite(IGrantable identity, Object objectsKeyPattern) Grant write permissions to this bucket to an IAM principal.final GrantgrantWrite(IGrantable identity, Object objectsKeyPattern, List<String> allowedActionPatterns) Grant write permissions to this bucket to an IAM principal.final RuleDefines a CloudWatch event that triggers when something happens to this bucket.final RuleonCloudTrailEvent(String id, OnCloudTrailBucketEventOptions options) Defines a CloudWatch event that triggers when something happens to this bucket.final RuleDefines an AWS CloudWatch event that triggers when an object is uploaded to the specified paths (keys) in this bucket using the PutObject API call.final RuleonCloudTrailPutObject(String id, OnCloudTrailBucketEventOptions options) Defines an AWS CloudWatch event that triggers when an object is uploaded to the specified paths (keys) in this bucket using the PutObject API call.final RuleDefines an AWS CloudWatch event that triggers when an object at the specified paths (keys) in this bucket are written to.final RuleonCloudTrailWriteObject(String id, OnCloudTrailBucketEventOptions options) Defines an AWS CloudWatch event that triggers when an object at the specified paths (keys) in this bucket are written to.final StringThe S3 URL of an S3 object.final Strings3UrlForObject(String key) The S3 URL of an S3 object.final voidsetPolicy(BucketPolicy value) The resource policy associated with this bucket.final voidsetReplicationRoleArn(String value) Role used to set up permissions on this bucket for replication.final StringThe https Transfer Acceleration URL of an S3 object.final StringThe https Transfer Acceleration URL of an S3 object.final StringThe https Transfer Acceleration URL of an S3 object.final StringThe https URL of an S3 object.final StringurlForObject(String key) The https URL of an S3 object.final StringThe virtual hosted-style URL of an S3 object.final StringThe virtual hosted-style URL of an S3 object.final StringvirtualHostedUrlForObject(String key, VirtualHostedStyleUrlOptions options) The virtual hosted-style URL of an S3 object.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Jsii$Proxy
protected Jsii$Proxy(software.amazon.jsii.JsiiObjectRef objRef)
-
-
Method Details
-
getNode
@Stability(Stable) @NotNull public final software.constructs.Node getNode()The tree node.- Specified by:
getNodein interfaceIBucket- Specified by:
getNodein interfaceIBucket.Jsii$Default- Specified by:
getNodein interfaceIBucketRef.Jsii$Default- Specified by:
getNodein interfacesoftware.constructs.IConstruct- Specified by:
getNodein interfacesoftware.constructs.IConstruct.Jsii$Default- Specified by:
getNodein interfaceIResource.Jsii$Default
-
getEnv
The environment this resource belongs to.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.- Specified by:
getEnvin interfaceIBucket- Specified by:
getEnvin interfaceIBucket.Jsii$Default- Specified by:
getEnvin interfaceIBucketRef.Jsii$Default- Specified by:
getEnvin interfaceIEnvironmentAware- Specified by:
getEnvin interfaceIEnvironmentAware.Jsii$Default- Specified by:
getEnvin interfaceIResource.Jsii$Default
-
getStack
The stack in which this resource is defined.- Specified by:
getStackin interfaceIBucket.Jsii$Default- Specified by:
getStackin interfaceIResource- Specified by:
getStackin interfaceIResource.Jsii$Default
-
getBucketRef
(experimental) A reference to a Bucket resource.- Specified by:
getBucketRefin interfaceIBucket.Jsii$Default- Specified by:
getBucketRefin interfaceIBucketRef- Specified by:
getBucketRefin interfaceIBucketRef.Jsii$Default
-
getBucketArn
The ARN of the bucket.- Specified by:
getBucketArnin interfaceIBucket- Specified by:
getBucketArnin interfaceIBucket.Jsii$Default
-
getBucketDomainName
The IPv4 DNS name of the specified bucket.- Specified by:
getBucketDomainNamein interfaceIBucket- Specified by:
getBucketDomainNamein interfaceIBucket.Jsii$Default
-
getBucketDualStackDomainName
The IPv6 DNS name of the specified bucket.- Specified by:
getBucketDualStackDomainNamein interfaceIBucket- Specified by:
getBucketDualStackDomainNamein interfaceIBucket.Jsii$Default
-
getBucketName
The name of the bucket.- Specified by:
getBucketNamein interfaceIBucket- Specified by:
getBucketNamein interfaceIBucket.Jsii$Default
-
getBucketRegionalDomainName
The regional domain name of the specified bucket.- Specified by:
getBucketRegionalDomainNamein interfaceIBucket- Specified by:
getBucketRegionalDomainNamein interfaceIBucket.Jsii$Default
-
getBucketWebsiteDomainName
The Domain name of the static website.- Specified by:
getBucketWebsiteDomainNamein interfaceIBucket- Specified by:
getBucketWebsiteDomainNamein interfaceIBucket.Jsii$Default
-
getBucketWebsiteUrl
The URL of the static website.- Specified by:
getBucketWebsiteUrlin interfaceIBucket- Specified by:
getBucketWebsiteUrlin interfaceIBucket.Jsii$Default
-
getEncryptionKey
Optional KMS encryption key associated with this bucket.- Specified by:
getEncryptionKeyin interfaceIBucket- Specified by:
getEncryptionKeyin interfaceIBucket.Jsii$Default
-
getIsWebsite
If this bucket has been configured for static website hosting.- Specified by:
getIsWebsitein interfaceIBucket- Specified by:
getIsWebsitein interfaceIBucket.Jsii$Default
-
getPolicy
The resource policy associated with this bucket.If
autoCreatePolicyis true, aBucketPolicywill be created upon the first call to addToResourcePolicy(s).- Specified by:
getPolicyin interfaceIBucket- Specified by:
getPolicyin interfaceIBucket.Jsii$Default
-
setPolicy
The resource policy associated with this bucket.If
autoCreatePolicyis true, aBucketPolicywill be created upon the first call to addToResourcePolicy(s).- Specified by:
setPolicyin interfaceIBucket- Specified by:
setPolicyin interfaceIBucket.Jsii$Default
-
getReplicationRoleArn
Role used to set up permissions on this bucket for replication.- Specified by:
getReplicationRoleArnin interfaceIBucket- Specified by:
getReplicationRoleArnin interfaceIBucket.Jsii$Default
-
setReplicationRoleArn
Role used to set up permissions on this bucket for replication.- Specified by:
setReplicationRoleArnin interfaceIBucket- Specified by:
setReplicationRoleArnin interfaceIBucket.Jsii$Default
-
applyRemovalPolicy
Apply the given removal policy to this resource.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).- Specified by:
applyRemovalPolicyin interfaceIBucket.Jsii$Default- Specified by:
applyRemovalPolicyin interfaceIResource- Specified by:
applyRemovalPolicyin interfaceIResource.Jsii$Default- Parameters:
policy- This parameter is required.
-
addEventNotification
@Stability(Stable) public final void addEventNotification(@NotNull EventType event, @NotNull IBucketNotificationDestination dest, @NotNull NotificationKeyFilter... filters) Adds a bucket notification event destination.Example:
Function myLambda; Bucket bucket = new Bucket(this, "MyBucket"); bucket.addEventNotification(EventType.OBJECT_CREATED, new LambdaDestination(myLambda), NotificationKeyFilter.builder().prefix("home/myusername/*").build());- Specified by:
addEventNotificationin interfaceIBucket- Specified by:
addEventNotificationin interfaceIBucket.Jsii$Default- Parameters:
event- The event to trigger the notification. This parameter is required.dest- The notification destination (Lambda, SNS Topic or SQS Queue). This parameter is required.filters- S3 object key filter rules to determine which objects trigger this event. This parameter is required.- See Also:
-
addObjectCreatedNotification
@Stability(Stable) public final void addObjectCreatedNotification(@NotNull IBucketNotificationDestination dest, @NotNull NotificationKeyFilter... filters) Subscribes a destination to receive notifications when an object is created in the bucket.This is identical to calling
onEvent(s3.EventType.OBJECT_CREATED).- Specified by:
addObjectCreatedNotificationin interfaceIBucket- Specified by:
addObjectCreatedNotificationin interfaceIBucket.Jsii$Default- Parameters:
dest- The notification destination (see onEvent). This parameter is required.filters- Filters (see onEvent). This parameter is required.
-
addObjectRemovedNotification
@Stability(Stable) public final void addObjectRemovedNotification(@NotNull IBucketNotificationDestination dest, @NotNull NotificationKeyFilter... filters) Subscribes a destination to receive notifications when an object is removed from the bucket.This is identical to calling
onEvent(EventType.OBJECT_REMOVED).- Specified by:
addObjectRemovedNotificationin interfaceIBucket- Specified by:
addObjectRemovedNotificationin interfaceIBucket.Jsii$Default- Parameters:
dest- The notification destination (see onEvent). This parameter is required.filters- Filters (see onEvent). This parameter is required.
-
addReplicationPolicy
@Stability(Stable) public final void addReplicationPolicy(@NotNull String roleArn, @Nullable Boolean accessControlTransition, @Nullable String account) Function to add required permissions to the destination bucket for cross account replication.These permissions will be added as a resource based policy on the bucket.
- Specified by:
addReplicationPolicyin interfaceIBucket- Specified by:
addReplicationPolicyin interfaceIBucket.Jsii$Default- Parameters:
roleArn- This parameter is required.accessControlTransition-account-- See Also:
-
addReplicationPolicy
@Stability(Stable) public final void addReplicationPolicy(@NotNull String roleArn, @Nullable Boolean accessControlTransition) Function to add required permissions to the destination bucket for cross account replication.These permissions will be added as a resource based policy on the bucket.
- Specified by:
addReplicationPolicyin interfaceIBucket- Parameters:
roleArn- This parameter is required.accessControlTransition-- See Also:
-
addReplicationPolicy
Function to add required permissions to the destination bucket for cross account replication.These permissions will be added as a resource based policy on the bucket.
- Specified by:
addReplicationPolicyin interfaceIBucket- Parameters:
roleArn- This parameter is required.- See Also:
-
addToResourcePolicy
@Stability(Stable) @NotNull public final AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement permission) Adds a statement to the resource policy for a principal (i.e. account/role/service) to perform actions on this bucket and/or its contents. UsebucketArnandarnForObjects(keys)to obtain ARNs for this bucket or objects.Note that the policy statement may or may not be added to the policy. For example, when an
IBucketis created from an existing 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.- Specified by:
addToResourcePolicyin interfaceIBucket- Specified by:
addToResourcePolicyin interfaceIBucket.Jsii$Default- Parameters:
permission- the policy statement to be added to the bucket's policy. This parameter is required.- Returns:
- metadata about the execution of this method. If the policy
was not added, the value of
statementAddedwill befalse. 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.
-
arnForObjects
Returns an ARN that represents all objects within the bucket that match the key pattern specified.To represent all keys, specify
"*".- Specified by:
arnForObjectsin interfaceIBucket- Specified by:
arnForObjectsin interfaceIBucket.Jsii$Default- Parameters:
keyPattern- This parameter is required.
-
enableEventBridgeNotification
@Stability(Stable) public final void enableEventBridgeNotification()Enables event bridge notification, causing all events below to be sent to EventBridge:.- Object Deleted (DeleteObject)
- Object Deleted (Lifecycle expiration)
- Object Restore Initiated
- Object Restore Completed
- Object Restore Expired
- Object Storage Class Changed
- Object Access Tier Changed
- Object ACL Updated
- Object Tags Added
- Object Tags Deleted
- Specified by:
enableEventBridgeNotificationin interfaceIBucket- Specified by:
enableEventBridgeNotificationin interfaceIBucket.Jsii$Default
-
grantDelete
@Stability(Stable) @NotNull public final Grant grantDelete(@NotNull IGrantable identity, @Nullable Object objectsKeyPattern) Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket.- Specified by:
grantDeletein interfaceIBucket- Specified by:
grantDeletein interfaceIBucket.Jsii$Default- Parameters:
identity- The principal. This parameter is required.objectsKeyPattern- Restrict the permission to a certain key pattern (default '*').
-
grantDelete
Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket.- Specified by:
grantDeletein interfaceIBucket- Parameters:
identity- The principal. This parameter is required.
-
grantPublicAccess
@Stability(Stable) @NotNull public final Grant grantPublicAccess(@Nullable String keyPrefix, @NotNull String... allowedActions) Allows unrestricted access to objects from this bucket.IMPORTANT: This permission allows anyone to perform actions on S3 objects in this bucket, which is useful for when you configure your bucket as a website and want everyone to be able to read objects in the bucket without needing to authenticate.
Without arguments, this method will grant read ("s3:GetObject") access to all objects ("*") in the bucket.
The method returns the
iam.Grantobject, which can then be modified as needed. For example, you can add a condition that will restrict access only to an IPv4 range like this:const grant = bucket.grantPublicAccess(); grant.resourceStatement!.addCondition(‘IpAddress’, { “aws:SourceIp”: “54.240.143.0/24” });- Specified by:
grantPublicAccessin interfaceIBucket- Specified by:
grantPublicAccessin interfaceIBucket.Jsii$Default- Parameters:
keyPrefix- the prefix of S3 object keys (e.g.home/*). Default is "*".allowedActions- the set of S3 actions to allow. This parameter is required.- Returns:
- The
iam.PolicyStatementobject, which can be used to apply e.g. conditions.
-
grantPut
@Stability(Stable) @NotNull public final Grant grantPut(@NotNull IGrantable identity, @Nullable Object objectsKeyPattern) Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.If encryption is used, permission to use the key to encrypt the contents of written files will also be granted to the same principal.
- Specified by:
grantPutin interfaceIBucket- Specified by:
grantPutin interfaceIBucket.Jsii$Default- Parameters:
identity- The principal. This parameter is required.objectsKeyPattern- Restrict the permission to a certain key pattern (default '*').
-
grantPut
Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.If encryption is used, permission to use the key to encrypt the contents of written files will also be granted to the same principal.
-
grantPutAcl
@Stability(Stable) @NotNull public final Grant grantPutAcl(@NotNull IGrantable identity, @Nullable String objectsKeyPattern) Grant the given IAM identity permissions to modify the ACLs of objects in the given Bucket.If your application has the '@aws-cdk/aws-s3:grantWriteWithoutAcl' feature flag set, calling
grantWriteorgrantReadWriteno longer grants permissions to modify the ACLs of the objects; in this case, if you need to modify object ACLs, call this method explicitly.- Specified by:
grantPutAclin interfaceIBucket- Specified by:
grantPutAclin interfaceIBucket.Jsii$Default- Parameters:
identity- The principal. This parameter is required.objectsKeyPattern- Restrict the permission to a certain key pattern (default '*').
-
grantPutAcl
Grant the given IAM identity permissions to modify the ACLs of objects in the given Bucket.If your application has the '@aws-cdk/aws-s3:grantWriteWithoutAcl' feature flag set, calling
grantWriteorgrantReadWriteno longer grants permissions to modify the ACLs of the objects; in this case, if you need to modify object ACLs, call this method explicitly.- Specified by:
grantPutAclin interfaceIBucket- Parameters:
identity- The principal. This parameter is required.
-
grantRead
@Stability(Stable) @NotNull public final Grant grantRead(@NotNull IGrantable identity, @Nullable Object objectsKeyPattern) Grant read permissions for this bucket and it's contents to an IAM principal (Role/Group/User).If encryption is used, permission to use the key to decrypt the contents of the bucket will also be granted to the same principal.
- Specified by:
grantReadin interfaceIBucket- Specified by:
grantReadin interfaceIBucket.Jsii$Default- Parameters:
identity- The principal. This parameter is required.objectsKeyPattern- Restrict the permission to a certain key pattern (default '*').
-
grantRead
Grant read permissions for this bucket and it's contents to an IAM principal (Role/Group/User).If encryption is used, permission to use the key to decrypt the contents of the bucket will also be granted to the same principal.
-
grantReadWrite
@Stability(Stable) @NotNull public final Grant grantReadWrite(@NotNull IGrantable identity, @Nullable Object objectsKeyPattern) Grants read/write permissions for this bucket and it's contents to an IAM principal (Role/Group/User).If an encryption key is used, permission to use the key for encrypt/decrypt will also be granted.
Before CDK version 1.85.0, this method granted the
s3:PutObject*permission that includeds3:PutObjectAcl, which could be used to grant read/write object access to IAM principals in other accounts. If you want to get rid of that behavior, update your CDK version to 1.85.0 or later, and make sure the@aws-cdk/aws-s3:grantWriteWithoutAclfeature flag is set totruein thecontextkey of your cdk.json file. If you've already updated, but still need the principal to have permissions to modify the ACLs, use thegrantPutAclmethod.- Specified by:
grantReadWritein interfaceIBucket- Specified by:
grantReadWritein interfaceIBucket.Jsii$Default- Parameters:
identity- The principal. This parameter is required.objectsKeyPattern- Restrict the permission to a certain key pattern (default '*').
-
grantReadWrite
Grants read/write permissions for this bucket and it's contents to an IAM principal (Role/Group/User).If an encryption key is used, permission to use the key for encrypt/decrypt will also be granted.
Before CDK version 1.85.0, this method granted the
s3:PutObject*permission that includeds3:PutObjectAcl, which could be used to grant read/write object access to IAM principals in other accounts. If you want to get rid of that behavior, update your CDK version to 1.85.0 or later, and make sure the@aws-cdk/aws-s3:grantWriteWithoutAclfeature flag is set totruein thecontextkey of your cdk.json file. If you've already updated, but still need the principal to have permissions to modify the ACLs, use thegrantPutAclmethod.- Specified by:
grantReadWritein interfaceIBucket- Parameters:
identity- The principal. This parameter is required.
-
grantReplicationPermission
@Stability(Stable) @NotNull public final Grant grantReplicationPermission(@NotNull IGrantable identity, @NotNull GrantReplicationPermissionProps props) Allows permissions for replication operation to bucket replication role.If an encryption key is used, permission to use the key for encrypt/decrypt will also be granted.
- Specified by:
grantReplicationPermissionin interfaceIBucket- Specified by:
grantReplicationPermissionin interfaceIBucket.Jsii$Default- Parameters:
identity- The principal. This parameter is required.props- The properties of the replication source and destination buckets. This parameter is required.- Returns:
- The
iam.Grantobject, which represents the grant of permissions.
-
grantWrite
@Stability(Stable) @NotNull public final Grant grantWrite(@NotNull IGrantable identity, @Nullable Object objectsKeyPattern, @Nullable List<String> allowedActionPatterns) Grant write permissions to this bucket to an IAM principal.If encryption is used, permission to use the key to encrypt the contents of written files will also be granted to the same principal.
Before CDK version 1.85.0, this method granted the
s3:PutObject*permission that includeds3:PutObjectAcl, which could be used to grant read/write object access to IAM principals in other accounts. If you want to get rid of that behavior, update your CDK version to 1.85.0 or later, and make sure the@aws-cdk/aws-s3:grantWriteWithoutAclfeature flag is set totruein thecontextkey of your cdk.json file. If you've already updated, but still need the principal to have permissions to modify the ACLs, use thegrantPutAclmethod.- Specified by:
grantWritein interfaceIBucket- Specified by:
grantWritein interfaceIBucket.Jsii$Default- Parameters:
identity- The principal. This parameter is required.objectsKeyPattern- Restrict the permission to a certain key pattern (default '*').allowedActionPatterns- Restrict the permissions to certain list of action patterns.
-
grantWrite
@Stability(Stable) @NotNull public final Grant grantWrite(@NotNull IGrantable identity, @Nullable Object objectsKeyPattern) Grant write permissions to this bucket to an IAM principal.If encryption is used, permission to use the key to encrypt the contents of written files will also be granted to the same principal.
Before CDK version 1.85.0, this method granted the
s3:PutObject*permission that includeds3:PutObjectAcl, which could be used to grant read/write object access to IAM principals in other accounts. If you want to get rid of that behavior, update your CDK version to 1.85.0 or later, and make sure the@aws-cdk/aws-s3:grantWriteWithoutAclfeature flag is set totruein thecontextkey of your cdk.json file. If you've already updated, but still need the principal to have permissions to modify the ACLs, use thegrantPutAclmethod.- Specified by:
grantWritein interfaceIBucket- Parameters:
identity- The principal. This parameter is required.objectsKeyPattern- Restrict the permission to a certain key pattern (default '*').
-
grantWrite
Grant write permissions to this bucket to an IAM principal.If encryption is used, permission to use the key to encrypt the contents of written files will also be granted to the same principal.
Before CDK version 1.85.0, this method granted the
s3:PutObject*permission that includeds3:PutObjectAcl, which could be used to grant read/write object access to IAM principals in other accounts. If you want to get rid of that behavior, update your CDK version to 1.85.0 or later, and make sure the@aws-cdk/aws-s3:grantWriteWithoutAclfeature flag is set totruein thecontextkey of your cdk.json file. If you've already updated, but still need the principal to have permissions to modify the ACLs, use thegrantPutAclmethod.- Specified by:
grantWritein interfaceIBucket- Parameters:
identity- The principal. This parameter is required.
-
onCloudTrailEvent
@Stability(Stable) @NotNull public final Rule onCloudTrailEvent(@NotNull String id, @Nullable OnCloudTrailBucketEventOptions options) Defines a CloudWatch event that triggers when something happens to this bucket.Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.
- Specified by:
onCloudTrailEventin interfaceIBucket- Specified by:
onCloudTrailEventin interfaceIBucket.Jsii$Default- Parameters:
id- The id of the rule. This parameter is required.options- Options for adding the rule.
-
onCloudTrailEvent
Defines a CloudWatch event that triggers when something happens to this bucket.Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.
- Specified by:
onCloudTrailEventin interfaceIBucket- Parameters:
id- The id of the rule. This parameter is required.
-
onCloudTrailPutObject
@Stability(Stable) @NotNull public final Rule onCloudTrailPutObject(@NotNull String id, @Nullable OnCloudTrailBucketEventOptions options) Defines an AWS CloudWatch event that triggers when an object is uploaded to the specified paths (keys) in this bucket using the PutObject API call.Note that some tools like
aws s3 cpwill automatically use either PutObject or the multipart upload API depending on the file size, so usingonCloudTrailWriteObjectmay be preferable.Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.
- Specified by:
onCloudTrailPutObjectin interfaceIBucket- Specified by:
onCloudTrailPutObjectin interfaceIBucket.Jsii$Default- Parameters:
id- The id of the rule. This parameter is required.options- Options for adding the rule.
-
onCloudTrailPutObject
Defines an AWS CloudWatch event that triggers when an object is uploaded to the specified paths (keys) in this bucket using the PutObject API call.Note that some tools like
aws s3 cpwill automatically use either PutObject or the multipart upload API depending on the file size, so usingonCloudTrailWriteObjectmay be preferable.Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.
- Specified by:
onCloudTrailPutObjectin interfaceIBucket- Parameters:
id- The id of the rule. This parameter is required.
-
onCloudTrailWriteObject
@Stability(Stable) @NotNull public final Rule onCloudTrailWriteObject(@NotNull String id, @Nullable OnCloudTrailBucketEventOptions options) Defines an AWS CloudWatch event that triggers when an object at the specified paths (keys) in this bucket are written to.This includes the events PutObject, CopyObject, and CompleteMultipartUpload.
Note that some tools like
aws s3 cpwill automatically use either PutObject or the multipart upload API depending on the file size, so using this method may be preferable toonCloudTrailPutObject.Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.
- Specified by:
onCloudTrailWriteObjectin interfaceIBucket- Specified by:
onCloudTrailWriteObjectin interfaceIBucket.Jsii$Default- Parameters:
id- The id of the rule. This parameter is required.options- Options for adding the rule.
-
onCloudTrailWriteObject
Defines an AWS CloudWatch event that triggers when an object at the specified paths (keys) in this bucket are written to.This includes the events PutObject, CopyObject, and CompleteMultipartUpload.
Note that some tools like
aws s3 cpwill automatically use either PutObject or the multipart upload API depending on the file size, so using this method may be preferable toonCloudTrailPutObject.Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.
- Specified by:
onCloudTrailWriteObjectin interfaceIBucket- Parameters:
id- The id of the rule. This parameter is required.
-
s3UrlForObject
The S3 URL of an S3 object.For example:
s3://onlybuckets3://bucket/key
- Specified by:
s3UrlForObjectin interfaceIBucket- Specified by:
s3UrlForObjectin interfaceIBucket.Jsii$Default- Parameters:
key- The S3 key of the object.- Returns:
- an ObjectS3Url token
-
s3UrlForObject
The S3 URL of an S3 object.For example:
s3://onlybuckets3://bucket/key
- Specified by:
s3UrlForObjectin interfaceIBucket- Returns:
- an ObjectS3Url token
-
transferAccelerationUrlForObject
@Stability(Stable) @NotNull public final String transferAccelerationUrlForObject(@Nullable String key, @Nullable TransferAccelerationUrlOptions options) The https Transfer Acceleration URL of an S3 object.Specify
dualStack: trueat the options for dual-stack endpoint (connect to the bucket over IPv6). For example:https://bucket---s3-accelerate.amazonaws.com.rproxy.govskope.cahttps://bucket.s3-accelerate.amazonaws.com/key
- Specified by:
transferAccelerationUrlForObjectin interfaceIBucket- Specified by:
transferAccelerationUrlForObjectin interfaceIBucket.Jsii$Default- Parameters:
key- The S3 key of the object.options- Options for generating URL.- Returns:
- an TransferAccelerationUrl token
-
transferAccelerationUrlForObject
@Stability(Stable) @NotNull public final String transferAccelerationUrlForObject(@Nullable String key) The https Transfer Acceleration URL of an S3 object.Specify
dualStack: trueat the options for dual-stack endpoint (connect to the bucket over IPv6). For example:https://bucket---s3-accelerate.amazonaws.com.rproxy.govskope.cahttps://bucket.s3-accelerate.amazonaws.com/key
- Specified by:
transferAccelerationUrlForObjectin interfaceIBucket- Parameters:
key- The S3 key of the object.- Returns:
- an TransferAccelerationUrl token
-
transferAccelerationUrlForObject
The https Transfer Acceleration URL of an S3 object.Specify
dualStack: trueat the options for dual-stack endpoint (connect to the bucket over IPv6). For example:https://bucket---s3-accelerate.amazonaws.com.rproxy.govskope.cahttps://bucket.s3-accelerate.amazonaws.com/key
- Specified by:
transferAccelerationUrlForObjectin interfaceIBucket- Returns:
- an TransferAccelerationUrl token
-
urlForObject
The https URL of an S3 object. For example:.https://s3.us-west-1.amazonaws.com/onlybuckethttps://s3.us-west-1.amazonaws.com/bucket/keyhttps://s3---cn-north-1.amazonaws.com.rproxy.govskope.ca.cn/china-bucket/mykey
- Specified by:
urlForObjectin interfaceIBucket- Specified by:
urlForObjectin interfaceIBucket.Jsii$Default- Parameters:
key- The S3 key of the object.- Returns:
- an ObjectS3Url token
-
urlForObject
The https URL of an S3 object. For example:.https://s3.us-west-1.amazonaws.com/onlybuckethttps://s3.us-west-1.amazonaws.com/bucket/keyhttps://s3---cn-north-1.amazonaws.com.rproxy.govskope.ca.cn/china-bucket/mykey
- Specified by:
urlForObjectin interfaceIBucket- Returns:
- an ObjectS3Url token
-
virtualHostedUrlForObject
@Stability(Stable) @NotNull public final String virtualHostedUrlForObject(@Nullable String key, @Nullable VirtualHostedStyleUrlOptions options) The virtual hosted-style URL of an S3 object. Specifyregional: falseat the options for non-regional URL. For example:.https://only-bucket---s3---us-west-1.amazonaws.com.rproxy.govskope.cahttps://bucket.s3.us-west-1.amazonaws.com/keyhttps://bucket.s3.amazonaws.com/keyhttps://china-bucket---s3---cn-north-1.amazonaws.com.rproxy.govskope.ca.cn/mykey
- Specified by:
virtualHostedUrlForObjectin interfaceIBucket- Specified by:
virtualHostedUrlForObjectin interfaceIBucket.Jsii$Default- Parameters:
key- The S3 key of the object.options- Options for generating URL.- Returns:
- an ObjectS3Url token
-
virtualHostedUrlForObject
The virtual hosted-style URL of an S3 object. Specifyregional: falseat the options for non-regional URL. For example:.https://only-bucket---s3---us-west-1.amazonaws.com.rproxy.govskope.cahttps://bucket.s3.us-west-1.amazonaws.com/keyhttps://bucket.s3.amazonaws.com/keyhttps://china-bucket---s3---cn-north-1.amazonaws.com.rproxy.govskope.ca.cn/mykey
- Specified by:
virtualHostedUrlForObjectin interfaceIBucket- Parameters:
key- The S3 key of the object.- Returns:
- an ObjectS3Url token
-
virtualHostedUrlForObject
The virtual hosted-style URL of an S3 object. Specifyregional: falseat the options for non-regional URL. For example:.https://only-bucket---s3---us-west-1.amazonaws.com.rproxy.govskope.cahttps://bucket.s3.us-west-1.amazonaws.com/keyhttps://bucket.s3.amazonaws.com/keyhttps://china-bucket---s3---cn-north-1.amazonaws.com.rproxy.govskope.ca.cn/mykey
- Specified by:
virtualHostedUrlForObjectin interfaceIBucket- Returns:
- an ObjectS3Url token
-