Interface BucketAttributes

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
BucketAttributes.Jsii$Proxy

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:37.492Z") @Stability(Stable) public interface BucketAttributes extends software.amazon.jsii.JsiiSerializable
A reference to a bucket outside this stack.

Example:

 Function myLambda;
 IBucket bucket = Bucket.fromBucketAttributes(this, "ImportedBucket", BucketAttributes.builder()
         .bucketArn("arn:aws:s3:::my-bucket")
         .build());
 // now you can just call methods on the bucket
 bucket.addEventNotification(EventType.OBJECT_CREATED, new LambdaDestination(myLambda), NotificationKeyFilter.builder().prefix("home/myusername/*").build());
 
  • Method Details

    • getAccount

      @Stability(Stable) @Nullable default String getAccount()
      The account this existing bucket belongs to.

      Default: - it's assumed the bucket belongs to the same account as the scope it's being imported into

    • getBucketArn

      @Stability(Stable) @Nullable default String getBucketArn()
      The ARN of the bucket.

      At least one of bucketArn or bucketName must be defined in order to initialize a bucket ref.

    • getBucketDomainName

      @Stability(Stable) @Nullable default String getBucketDomainName()
      The domain name of the bucket.

      Default: Inferred from bucket name

    • getBucketDualStackDomainName

      @Stability(Stable) @Nullable default String getBucketDualStackDomainName()
      The IPv6 DNS name of the specified bucket.
    • getBucketName

      @Stability(Stable) @Nullable default String getBucketName()
      The name of the bucket.

      If the underlying value of ARN is a string, the name will be parsed from the ARN. Otherwise, the name is optional, but some features that require the bucket name such as auto-creating a bucket policy, won't work.

    • getBucketRegionalDomainName

      @Stability(Stable) @Nullable default String getBucketRegionalDomainName()
      The regional domain name of the specified bucket.
    • getBucketWebsiteNewUrlFormat

      @Stability(Stable) @Nullable default Boolean getBucketWebsiteNewUrlFormat()
      The format of the website URL of the bucket.

      This should be true for regions launched since 2014.

      Default: false

    • getBucketWebsiteUrl

      @Stability(Stable) @Nullable default String getBucketWebsiteUrl()
      The website URL of the bucket (if static web hosting is enabled).

      Default: Inferred from bucket name

    • getEncryptionKey

      @Stability(Stable) @Nullable default IKey getEncryptionKey()
    • getIsWebsite

      @Stability(Stable) @Nullable default Boolean getIsWebsite()
      If this bucket has been configured for static website hosting.

      Default: false

    • getNotificationsHandlerRole

      @Stability(Stable) @Nullable default IRole getNotificationsHandlerRole()
      The role to be used by the notifications handler.

      Default: - a new role will be created.

    • getRegion

      @Stability(Stable) @Nullable default String getRegion()
      The region this existing bucket is in.

      Default: - it's assumed the bucket is in the same region as the scope it's being imported into

    • builder

      @Stability(Stable) static BucketAttributes.Builder builder()
      Returns:
      a BucketAttributes.Builder of BucketAttributes