Class: AWSCDK::S3::BucketAttributes

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
s3/bucket_attributes.rb

Overview

A reference to a bucket outside this stack.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account: nil, bucket_arn: nil, bucket_domain_name: nil, bucket_dual_stack_domain_name: nil, bucket_name: nil, bucket_regional_domain_name: nil, bucket_website_new_url_format: nil, bucket_website_url: nil, encryption_key: nil, is_website: nil, notifications_handler_role: nil, region: nil) ⇒ BucketAttributes

Returns a new instance of BucketAttributes.

Parameters:

  • account (String, nil) (defaults to: nil)

    The account this existing bucket belongs to.

  • bucket_arn (String, nil) (defaults to: nil)

    The ARN of the bucket.

  • bucket_domain_name (String, nil) (defaults to: nil)

    The domain name of the bucket.

  • bucket_dual_stack_domain_name (String, nil) (defaults to: nil)

    The IPv6 DNS name of the specified bucket.

  • bucket_name (String, nil) (defaults to: nil)

    The name of the bucket.

  • bucket_regional_domain_name (String, nil) (defaults to: nil)

    The regional domain name of the specified bucket.

  • bucket_website_new_url_format (Boolean, nil) (defaults to: nil)

    Force the format of the website URL of the bucket.

  • bucket_website_url (String, nil) (defaults to: nil)

    The website URL of the bucket (if static web hosting is enabled).

  • encryption_key (AWSCDK::KMS::IKey, nil) (defaults to: nil)

    KMS encryption key associated with this bucket.

  • is_website (Boolean, nil) (defaults to: nil)

    If this bucket has been configured for static website hosting.

  • notifications_handler_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The role to be used by the notifications handler.

  • region (String, nil) (defaults to: nil)

    The region this existing bucket is in.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 's3/bucket_attributes.rb', line 19

def initialize(account: nil, bucket_arn: nil, bucket_domain_name: nil, bucket_dual_stack_domain_name: nil, bucket_name: nil, bucket_regional_domain_name: nil, bucket_website_new_url_format: nil, bucket_website_url: nil, encryption_key: nil, is_website: nil, notifications_handler_role: nil, region: nil)
  @account = 
  Jsii::Type.check_type(@account, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "account") unless @account.nil?
  @bucket_arn = bucket_arn
  Jsii::Type.check_type(@bucket_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketArn") unless @bucket_arn.nil?
  @bucket_domain_name = bucket_domain_name
  Jsii::Type.check_type(@bucket_domain_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketDomainName") unless @bucket_domain_name.nil?
  @bucket_dual_stack_domain_name = bucket_dual_stack_domain_name
  Jsii::Type.check_type(@bucket_dual_stack_domain_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketDualStackDomainName") unless @bucket_dual_stack_domain_name.nil?
  @bucket_name = bucket_name
  Jsii::Type.check_type(@bucket_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketName") unless @bucket_name.nil?
  @bucket_regional_domain_name = bucket_regional_domain_name
  Jsii::Type.check_type(@bucket_regional_domain_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketRegionalDomainName") unless @bucket_regional_domain_name.nil?
  @bucket_website_new_url_format = bucket_website_new_url_format
  Jsii::Type.check_type(@bucket_website_new_url_format, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "bucketWebsiteNewUrlFormat") unless @bucket_website_new_url_format.nil?
  @bucket_website_url = bucket_website_url
  Jsii::Type.check_type(@bucket_website_url, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketWebsiteUrl") unless @bucket_website_url.nil?
  @encryption_key = encryption_key
  Jsii::Type.check_type(@encryption_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "encryptionKey") unless @encryption_key.nil?
  @is_website = is_website
  Jsii::Type.check_type(@is_website, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "isWebsite") unless @is_website.nil?
  @notifications_handler_role = notifications_handler_role
  Jsii::Type.check_type(@notifications_handler_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "notificationsHandlerRole") unless @notifications_handler_role.nil?
  @region = region
  Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil?
end

Instance Attribute Details

#accountString? (readonly)

Note:

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

The account this existing bucket belongs to.

Returns:

  • (String, nil)


50
51
52
# File 's3/bucket_attributes.rb', line 50

def 
  @account
end

#bucket_arnString? (readonly)

The ARN of the bucket.

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

Returns:

  • (String, nil)


57
58
59
# File 's3/bucket_attributes.rb', line 57

def bucket_arn
  @bucket_arn
end

#bucket_domain_nameString? (readonly)

Note:

Default: - Inferred from bucket name

The domain name of the bucket.

Returns:

  • (String, nil)


62
63
64
# File 's3/bucket_attributes.rb', line 62

def bucket_domain_name
  @bucket_domain_name
end

#bucket_dual_stack_domain_nameString? (readonly)

The IPv6 DNS name of the specified bucket.

Returns:

  • (String, nil)


66
67
68
# File 's3/bucket_attributes.rb', line 66

def bucket_dual_stack_domain_name
  @bucket_dual_stack_domain_name
end

#bucket_nameString? (readonly)

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.

Returns:

  • (String, nil)


75
76
77
# File 's3/bucket_attributes.rb', line 75

def bucket_name
  @bucket_name
end

#bucket_regional_domain_nameString? (readonly)

The regional domain name of the specified bucket.

Returns:

  • (String, nil)


79
80
81
# File 's3/bucket_attributes.rb', line 79

def bucket_regional_domain_name
  @bucket_regional_domain_name
end

#bucket_website_new_url_formatBoolean? (readonly)

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.

Note:

Default: - inferred from available region information, false otherwise

Force the format of the website URL of the bucket.

This should be true for regions launched since 2014.

Returns:

  • (Boolean, nil)


88
89
90
# File 's3/bucket_attributes.rb', line 88

def bucket_website_new_url_format
  @bucket_website_new_url_format
end

#bucket_website_urlString? (readonly)

Note:

Default: - Inferred from bucket name and region

The website URL of the bucket (if static web hosting is enabled).

Returns:

  • (String, nil)


93
94
95
# File 's3/bucket_attributes.rb', line 93

def bucket_website_url
  @bucket_website_url
end

#encryption_keyAWSCDK::KMS::IKey? (readonly)

Note:

Default: - no encryption key

KMS encryption key associated with this bucket.

Returns:



98
99
100
# File 's3/bucket_attributes.rb', line 98

def encryption_key
  @encryption_key
end

#is_websiteBoolean? (readonly)

Note:

Default: false

If this bucket has been configured for static website hosting.

Returns:

  • (Boolean, nil)


103
104
105
# File 's3/bucket_attributes.rb', line 103

def is_website
  @is_website
end

#notifications_handler_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - a new role will be created.

The role to be used by the notifications handler.

Returns:



108
109
110
# File 's3/bucket_attributes.rb', line 108

def notifications_handler_role
  @notifications_handler_role
end

#regionString? (readonly)

Note:

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

The region this existing bucket is in.

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

Returns:

  • (String, nil)


116
117
118
# File 's3/bucket_attributes.rb', line 116

def region
  @region
end

Class Method Details

.jsii_propertiesObject



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 's3/bucket_attributes.rb', line 118

def self.jsii_properties
  {
    :account => "account",
    :bucket_arn => "bucketArn",
    :bucket_domain_name => "bucketDomainName",
    :bucket_dual_stack_domain_name => "bucketDualStackDomainName",
    :bucket_name => "bucketName",
    :bucket_regional_domain_name => "bucketRegionalDomainName",
    :bucket_website_new_url_format => "bucketWebsiteNewUrlFormat",
    :bucket_website_url => "bucketWebsiteUrl",
    :encryption_key => "encryptionKey",
    :is_website => "isWebsite",
    :notifications_handler_role => "notificationsHandlerRole",
    :region => "region",
  }
end

Instance Method Details

#to_jsiiObject



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 's3/bucket_attributes.rb', line 135

def to_jsii
  result = {}
  result.merge!({
    "account" => @account,
    "bucketArn" => @bucket_arn,
    "bucketDomainName" => @bucket_domain_name,
    "bucketDualStackDomainName" => @bucket_dual_stack_domain_name,
    "bucketName" => @bucket_name,
    "bucketRegionalDomainName" => @bucket_regional_domain_name,
    "bucketWebsiteNewUrlFormat" => @bucket_website_new_url_format,
    "bucketWebsiteUrl" => @bucket_website_url,
    "encryptionKey" => @encryption_key,
    "isWebsite" => @is_website,
    "notificationsHandlerRole" => @notifications_handler_role,
    "region" => @region,
  })
  result.compact
end