Interface BucketAttributes

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

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:13.132Z") @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(Deprecated) @Deprecated @Nullable default Boolean getBucketWebsiteNewUrlFormat()
      Deprecated.
      The correct website url format can be inferred automatically from the bucket region. Always provide the bucket region if the bucketWebsiteUrl will be used. Alternatively provide the full bucketWebsiteUrl manually.
      (deprecated) Force the format of the website URL of the bucket.

      This should be true for regions launched since 2014.

      Default: - inferred from available region information, `false` otherwise

    • getBucketWebsiteUrl

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

      Default: - Inferred from bucket name and region

    • getEncryptionKey

      @Stability(Stable) @Nullable default IKey getEncryptionKey()
      KMS encryption key associated with this bucket.

      Default: - no encryption key

    • 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.

      Features that require the region (e.g. bucketWebsiteUrl) won't fully work if the region cannot be correctly inferred.

      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