Class: AWSCDK::S3::Bucket
- Inherits:
-
BucketBase
- Object
- BucketBase
- AWSCDK::S3::Bucket
- Defined in:
- s3/bucket.rb
Overview
An S3 bucket with associated policy objects.
This bucket does not yet have all features that exposed by the underlying BucketResource.
Class Method Summary collapse
- .from_bucket_arn(scope, id, bucket_arn) ⇒ AWSCDK::S3::IBucket
-
.from_bucket_attributes(scope, id, attrs) ⇒ AWSCDK::S3::IBucket
Creates a Bucket construct that represents an external bucket.
- .from_bucket_name(scope, id, bucket_name) ⇒ AWSCDK::S3::IBucket
-
.from_cfn_bucket(cfn_bucket) ⇒ AWSCDK::S3::IBucket
Create a mutable
IBucketbased on a low-levelCfnBucket. - .jsii_overridable_methods ⇒ Object
-
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
-
.validate_bucket_name(physical_name, allow_legacy_bucket_naming = nil) ⇒ void
Thrown an exception if the given bucket name is not valid.
Instance Method Summary collapse
-
#add_cors_rule(rule) ⇒ void
Adds a cross-origin access configuration for objects in an Amazon S3 bucket.
-
#add_event_notification(event, dest, *filters) ⇒ void
Adds a bucket notification event destination.
-
#add_inventory(inventory) ⇒ void
Add an inventory configuration.
-
#add_lifecycle_rule(rule) ⇒ void
Add a lifecycle rule to the bucket.
-
#add_metric(metric) ⇒ void
Adds a metrics configuration for the CloudWatch request metrics from the bucket.
-
#add_object_created_notification(dest, *filters) ⇒ void
Subscribes a destination to receive notifications when an object is created in the bucket.
-
#add_object_removed_notification(dest, *filters) ⇒ void
Subscribes a destination to receive notifications when an object is removed from the bucket.
-
#add_replication_policy(role_arn, access_control_transition = nil, account = nil) ⇒ void
Function to add required permissions to the destination bucket for cross account replication.
-
#add_to_resource_policy(permission) ⇒ AWSCDK::IAM::AddToResourcePolicyResult
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.
-
#apply_cross_stack_reference_strength(strength) ⇒ void
Override the cross-stack reference strength for this resource.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#arn_for_objects(key_pattern) ⇒ String
Returns an ARN that represents all objects within the bucket that match the key pattern specified.
-
#auto_create_policy ⇒ Boolean
Indicates if a bucket resource policy should automatically created upon the first call to
addToResourcePolicy. - #auto_create_policy=(value) ⇒ Object
-
#bucket_arn ⇒ String
The ARN of the bucket.
-
#bucket_domain_name ⇒ String
The IPv4 DNS name of the specified bucket.
-
#bucket_dual_stack_domain_name ⇒ String
The IPv6 DNS name of the specified bucket.
-
#bucket_name ⇒ String
The name of the bucket.
-
#bucket_ref ⇒ AWSCDK::Interfaces::AWSS3::BucketReference
A reference to a Bucket resource.
-
#bucket_regional_domain_name ⇒ String
The regional domain name of the specified bucket.
-
#bucket_website_domain_name ⇒ String
The Domain name of the static website.
-
#bucket_website_url ⇒ String
The URL of the static website.
-
#disallow_public_access ⇒ Boolean?
Whether to disallow public access.
- #disallow_public_access=(value) ⇒ Object
-
#enable_event_bridge_notification ⇒ void
Enables event bridge notification, causing all events below to be sent to EventBridge:.
-
#encryption_key ⇒ AWSCDK::KMS::IKey?
Optional KMS encryption key associated with this bucket.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
- #generate_physical_name ⇒ String
-
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g.
bucket.bucketArn). -
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g.
bucket.bucketName). -
#grant_delete(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket.
-
#grant_on_key(grantee, *actions) ⇒ AWSCDK::IAM::GrantOnKeyResult
Gives permissions to a grantable entity to perform actions on the encryption key.
-
#grant_public_access(key_prefix = nil, *allowed_actions) ⇒ AWSCDK::IAM::Grant
Allows unrestricted access to objects from this bucket.
-
#grant_put(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.
-
#grant_put_acl(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
The use of this method is discouraged.
-
#grant_read(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
Grant read permissions for this bucket and its contents to an IAM principal (Role/Group/User).
-
#grant_read_write(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
The use of this method is discouraged.
-
#grant_replication_permission(identity, props) ⇒ AWSCDK::IAM::Grant
Grant replication permission to a principal.
-
#grant_write(identity, objects_key_pattern = nil, allowed_action_patterns = nil) ⇒ AWSCDK::IAM::Grant
The use of this method is discouraged.
-
#grants ⇒ AWSCDK::S3::BucketGrants
Collection of grant methods for a Bucket.
-
#initialize(scope, id, props = nil) ⇒ Bucket
constructor
A new instance of Bucket.
-
#is_website ⇒ Boolean?
If this bucket has been configured for static website hosting.
-
#maybe_auto_create_policy ⇒ void
Ensures a bucket policy exists on the L2 if
autoCreatePolicyis set. -
#node ⇒ Constructs::Node
The tree node.
- #notifications_handler_role ⇒ AWSCDK::IAM::IRole?
- #notifications_handler_role=(value) ⇒ Object
- #notifications_skip_destination_validation ⇒ Boolean?
- #notifications_skip_destination_validation=(value) ⇒ Object
- #object_ownership ⇒ AWSCDK::S3::ObjectOwnership?
- #object_ownership=(value) ⇒ Object
-
#on_cloud_trail_event(id, options = nil) ⇒ AWSCDK::Events::Rule
Define a CloudWatch event that triggers when something happens to this repository.
-
#on_cloud_trail_put_object(id, options = nil) ⇒ AWSCDK::Events::Rule
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.
-
#on_cloud_trail_write_object(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines an AWS CloudWatch event that triggers when an object at the specified paths (keys) in this bucket are written to.
-
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
-
#policy ⇒ AWSCDK::S3::BucketPolicy?
The resource policy associated with this bucket.
- #policy=(value) ⇒ Object
-
#replication_role_arn ⇒ String?
Role used to set up permissions on this bucket for replication.
- #replication_role_arn=(value) ⇒ Object
-
#s3_url_for_object(key = nil) ⇒ String
The S3 URL of an S3 object.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#transfer_acceleration_url_for_object(key = nil, options = nil) ⇒ String
The https Transfer Acceleration URL of an S3 object.
-
#url_for_object(key = nil) ⇒ String
The https URL of an S3 object.
-
#virtual_hosted_url_for_object(key = nil, options = nil) ⇒ String
The virtual hosted-style URL of an S3 object.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props = nil) ⇒ Bucket
Returns a new instance of Bucket.
26 27 28 29 30 31 32 |
# File 's3/bucket.rb', line 26 def initialize(scope, id, props = nil) props = props.is_a?(Hash) ? ::AWSCDK::S3::BucketProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuQnVja2V0UHJvcHMifQ==")), "props") unless props.nil? Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.from_bucket_arn(scope, id, bucket_arn) ⇒ AWSCDK::S3::IBucket
100 101 102 103 104 105 |
# File 's3/bucket.rb', line 100 def self.from_bucket_arn(scope, id, bucket_arn) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(bucket_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketArn") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3.Bucket", "fromBucketArn", [scope, id, bucket_arn]) end |
.from_bucket_attributes(scope, id, attrs) ⇒ AWSCDK::S3::IBucket
Creates a Bucket construct that represents an external bucket.
113 114 115 116 117 118 119 |
# File 's3/bucket.rb', line 113 def self.from_bucket_attributes(scope, id, attrs) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") attrs = attrs.is_a?(Hash) ? ::AWSCDK::S3::BucketAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuQnVja2V0QXR0cmlidXRlcyJ9")), "attrs") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3.Bucket", "fromBucketAttributes", [scope, id, attrs]) end |
.from_bucket_name(scope, id, bucket_name) ⇒ AWSCDK::S3::IBucket
125 126 127 128 129 130 |
# File 's3/bucket.rb', line 125 def self.from_bucket_name(scope, id, bucket_name) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(bucket_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketName") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3.Bucket", "fromBucketName", [scope, id, bucket_name]) end |
.from_cfn_bucket(cfn_bucket) ⇒ AWSCDK::S3::IBucket
Create a mutable IBucket based on a low-level CfnBucket.
136 137 138 139 |
# File 's3/bucket.rb', line 136 def self.from_cfn_bucket(cfn_bucket) Jsii::Type.check_type(cfn_bucket, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuQ2ZuQnVja2V0In0=")), "cfnBucket") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3.Bucket", "fromCfnBucket", [cfn_bucket]) end |
.jsii_overridable_methods ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 's3/bucket.rb', line 34 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :physical_name => { kind: :property, name: "physicalName", is_optional: false }, :stack => { kind: :property, name: "stack", is_optional: false }, :bucket_arn => { kind: :property, name: "bucketArn", is_optional: false }, :bucket_domain_name => { kind: :property, name: "bucketDomainName", is_optional: false }, :bucket_dual_stack_domain_name => { kind: :property, name: "bucketDualStackDomainName", is_optional: false }, :bucket_name => { kind: :property, name: "bucketName", is_optional: false }, :bucket_ref => { kind: :property, name: "bucketRef", is_optional: false }, :bucket_regional_domain_name => { kind: :property, name: "bucketRegionalDomainName", is_optional: false }, :bucket_website_domain_name => { kind: :property, name: "bucketWebsiteDomainName", is_optional: false }, :bucket_website_url => { kind: :property, name: "bucketWebsiteUrl", is_optional: false }, :grants => { kind: :property, name: "grants", is_optional: false }, :encryption_key => { kind: :property, name: "encryptionKey", is_optional: true }, :is_website => { kind: :property, name: "isWebsite", is_optional: true }, :auto_create_policy => { kind: :property, name: "autoCreatePolicy", is_optional: false }, :disallow_public_access => { kind: :property, name: "disallowPublicAccess", is_optional: true }, :notifications_handler_role => { kind: :property, name: "notificationsHandlerRole", is_optional: true }, :notifications_skip_destination_validation => { kind: :property, name: "notificationsSkipDestinationValidation", is_optional: true }, :object_ownership => { kind: :property, name: "objectOwnership", is_optional: true }, :policy => { kind: :property, name: "policy", is_optional: true }, :replication_role_arn => { kind: :property, name: "replicationRoleArn", is_optional: true }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false }, :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false }, :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false }, :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false }, :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false }, :add_event_notification => { kind: :method, name: "addEventNotification", is_optional: false }, :add_object_created_notification => { kind: :method, name: "addObjectCreatedNotification", is_optional: false }, :add_object_removed_notification => { kind: :method, name: "addObjectRemovedNotification", is_optional: false }, :add_replication_policy => { kind: :method, name: "addReplicationPolicy", is_optional: false }, :add_to_resource_policy => { kind: :method, name: "addToResourcePolicy", is_optional: false }, :arn_for_objects => { kind: :method, name: "arnForObjects", is_optional: false }, :enable_event_bridge_notification => { kind: :method, name: "enableEventBridgeNotification", is_optional: false }, :grant_delete => { kind: :method, name: "grantDelete", is_optional: false }, :grant_on_key => { kind: :method, name: "grantOnKey", is_optional: false }, :grant_public_access => { kind: :method, name: "grantPublicAccess", is_optional: false }, :grant_put => { kind: :method, name: "grantPut", is_optional: false }, :grant_put_acl => { kind: :method, name: "grantPutAcl", is_optional: false }, :grant_read => { kind: :method, name: "grantRead", is_optional: false }, :grant_read_write => { kind: :method, name: "grantReadWrite", is_optional: false }, :grant_replication_permission => { kind: :method, name: "grantReplicationPermission", is_optional: false }, :grant_write => { kind: :method, name: "grantWrite", is_optional: false }, :maybe_auto_create_policy => { kind: :method, name: "maybeAutoCreatePolicy", is_optional: false }, :on_cloud_trail_event => { kind: :method, name: "onCloudTrailEvent", is_optional: false }, :on_cloud_trail_put_object => { kind: :method, name: "onCloudTrailPutObject", is_optional: false }, :on_cloud_trail_write_object => { kind: :method, name: "onCloudTrailWriteObject", is_optional: false }, :s3_url_for_object => { kind: :method, name: "s3UrlForObject", is_optional: false }, :transfer_acceleration_url_for_object => { kind: :method, name: "transferAccelerationUrlForObject", is_optional: false }, :url_for_object => { kind: :method, name: "urlForObject", is_optional: false }, :virtual_hosted_url_for_object => { kind: :method, name: "virtualHostedUrlForObject", is_optional: false }, :add_cors_rule => { kind: :method, name: "addCorsRule", is_optional: false }, :add_inventory => { kind: :method, name: "addInventory", is_optional: false }, :add_lifecycle_rule => { kind: :method, name: "addLifecycleRule", is_optional: false }, :add_metric => { kind: :method, name: "addMetric", is_optional: false }, } end |
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
356 357 358 |
# File 's3/bucket.rb', line 356 def self.PROPERTY_INJECTION_ID() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_s3.Bucket", "PROPERTY_INJECTION_ID") end |
.validate_bucket_name(physical_name, allow_legacy_bucket_naming = nil) ⇒ void
This method returns an undefined value.
Thrown an exception if the given bucket name is not valid.
146 147 148 149 150 |
# File 's3/bucket.rb', line 146 def self.validate_bucket_name(physical_name, allow_legacy_bucket_naming = nil) Jsii::Type.check_type(physical_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "physicalName") Jsii::Type.check_type(allow_legacy_bucket_naming, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowLegacyBucketNaming") unless allow_legacy_bucket_naming.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3.Bucket", "validateBucketName", [physical_name, allow_legacy_bucket_naming]) end |
Instance Method Details
#add_cors_rule(rule) ⇒ void
This method returns an undefined value.
Adds a cross-origin access configuration for objects in an Amazon S3 bucket.
860 861 862 863 864 |
# File 's3/bucket.rb', line 860 def add_cors_rule(rule) rule = rule.is_a?(Hash) ? ::AWSCDK::S3::CorsRule.new(**rule.transform_keys(&:to_sym)) : rule Jsii::Type.check_type(rule, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuQ29yc1J1bGUifQ==")), "rule") jsii_call_method("addCorsRule", [rule]) end |
#add_event_notification(event, dest, *filters) ⇒ void
This method returns an undefined value.
Adds a bucket notification event destination.
463 464 465 466 467 468 469 470 471 |
# File 's3/bucket.rb', line 463 def add_event_notification(event, dest, *filters) Jsii::Type.check_type(event, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuRXZlbnRUeXBlIn0=")), "event") Jsii::Type.check_type(dest, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldE5vdGlmaWNhdGlvbkRlc3RpbmF0aW9uIn0=")), "dest") filters.map! { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::S3::NotificationKeyFilter.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } filters.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuTm90aWZpY2F0aW9uS2V5RmlsdGVyIn0=")), "filters[#{index}]") end jsii_call_method("addEventNotification", [event, dest, *filters]) end |
#add_inventory(inventory) ⇒ void
This method returns an undefined value.
Add an inventory configuration.
870 871 872 873 874 |
# File 's3/bucket.rb', line 870 def add_inventory(inventory) inventory = inventory.is_a?(Hash) ? ::AWSCDK::S3::Inventory.new(**inventory.transform_keys(&:to_sym)) : inventory Jsii::Type.check_type(inventory, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSW52ZW50b3J5In0=")), "inventory") jsii_call_method("addInventory", [inventory]) end |
#add_lifecycle_rule(rule) ⇒ void
This method returns an undefined value.
Add a lifecycle rule to the bucket.
880 881 882 883 884 |
# File 's3/bucket.rb', line 880 def add_lifecycle_rule(rule) rule = rule.is_a?(Hash) ? ::AWSCDK::S3::LifecycleRule.new(**rule.transform_keys(&:to_sym)) : rule Jsii::Type.check_type(rule, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuTGlmZWN5Y2xlUnVsZSJ9")), "rule") jsii_call_method("addLifecycleRule", [rule]) end |
#add_metric(metric) ⇒ void
This method returns an undefined value.
Adds a metrics configuration for the CloudWatch request metrics from the bucket.
890 891 892 893 894 |
# File 's3/bucket.rb', line 890 def add_metric(metric) metric = metric.is_a?(Hash) ? ::AWSCDK::S3::BucketMetrics.new(**metric.transform_keys(&:to_sym)) : metric Jsii::Type.check_type(metric, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuQnVja2V0TWV0cmljcyJ9")), "metric") jsii_call_method("addMetric", [metric]) end |
#add_object_created_notification(dest, *filters) ⇒ void
This method returns an undefined value.
Subscribes a destination to receive notifications when an object is created in the bucket.
This is identical to calling
onEvent(EventType.OBJECT_CREATED).
481 482 483 484 485 486 487 488 |
# File 's3/bucket.rb', line 481 def add_object_created_notification(dest, *filters) Jsii::Type.check_type(dest, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldE5vdGlmaWNhdGlvbkRlc3RpbmF0aW9uIn0=")), "dest") filters.map! { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::S3::NotificationKeyFilter.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } filters.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuTm90aWZpY2F0aW9uS2V5RmlsdGVyIn0=")), "filters[#{index}]") end jsii_call_method("addObjectCreatedNotification", [dest, *filters]) end |
#add_object_removed_notification(dest, *filters) ⇒ void
This method returns an undefined value.
Subscribes a destination to receive notifications when an object is removed from the bucket.
This is identical to calling
onEvent(EventType.OBJECT_REMOVED).
498 499 500 501 502 503 504 505 |
# File 's3/bucket.rb', line 498 def add_object_removed_notification(dest, *filters) Jsii::Type.check_type(dest, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldE5vdGlmaWNhdGlvbkRlc3RpbmF0aW9uIn0=")), "dest") filters.map! { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::S3::NotificationKeyFilter.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } filters.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuTm90aWZpY2F0aW9uS2V5RmlsdGVyIn0=")), "filters[#{index}]") end jsii_call_method("addObjectRemovedNotification", [dest, *filters]) end |
#add_replication_policy(role_arn, access_control_transition = nil, account = nil) ⇒ void
This method returns an undefined value.
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
516 517 518 519 520 521 |
# File 's3/bucket.rb', line 516 def add_replication_policy(role_arn, access_control_transition = nil, account = nil) Jsii::Type.check_type(role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "roleArn") Jsii::Type.check_type(access_control_transition, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "accessControlTransition") unless access_control_transition.nil? Jsii::Type.check_type(account, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "account") unless account.nil? jsii_call_method("addReplicationPolicy", [role_arn, access_control_transition, account]) end |
#add_to_resource_policy(permission) ⇒ AWSCDK::IAM::AddToResourcePolicyResult
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. Use bucketArn and arnForObjects(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 IBucket is 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.
533 534 535 536 |
# File 's3/bucket.rb', line 533 def add_to_resource_policy() Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "permission") jsii_call_method("addToResourcePolicy", []) end |
#apply_cross_stack_reference_strength(strength) ⇒ void
This method returns an undefined value.
Override the cross-stack reference strength for this resource.
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.
393 394 395 396 |
# File 's3/bucket.rb', line 393 def apply_cross_stack_reference_strength(strength) Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength") jsii_call_method("applyCrossStackReferenceStrength", [strength]) end |
#apply_removal_policy(policy) ⇒ void
This method returns an undefined value.
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).
410 411 412 413 |
# File 's3/bucket.rb', line 410 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#arn_for_objects(key_pattern) ⇒ String
Returns an ARN that represents all objects within the bucket that match the key pattern specified.
To represent all keys, specify "*".
If you need to specify a keyPattern with multiple components, concatenate them into a single string, e.g.:
arnForObjects(home/${team}/${user}/*)
548 549 550 551 |
# File 's3/bucket.rb', line 548 def arn_for_objects(key_pattern) Jsii::Type.check_type(key_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyPattern") jsii_call_method("arnForObjects", [key_pattern]) end |
#auto_create_policy ⇒ Boolean
Indicates if a bucket resource policy should automatically created upon the first call to addToResourcePolicy.
275 276 277 |
# File 's3/bucket.rb', line 275 def auto_create_policy() jsii_get_property("autoCreatePolicy") end |
#auto_create_policy=(value) ⇒ Object
279 280 281 282 |
# File 's3/bucket.rb', line 279 def auto_create_policy=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "autoCreatePolicy") jsii_set_property("autoCreatePolicy", value) end |
#bucket_arn ⇒ String
The ARN of the bucket.
198 199 200 |
# File 's3/bucket.rb', line 198 def bucket_arn() jsii_get_property("bucketArn") end |
#bucket_domain_name ⇒ String
The IPv4 DNS name of the specified bucket.
205 206 207 |
# File 's3/bucket.rb', line 205 def bucket_domain_name() jsii_get_property("bucketDomainName") end |
#bucket_dual_stack_domain_name ⇒ String
The IPv6 DNS name of the specified bucket.
212 213 214 |
# File 's3/bucket.rb', line 212 def bucket_dual_stack_domain_name() jsii_get_property("bucketDualStackDomainName") end |
#bucket_name ⇒ String
The name of the bucket.
219 220 221 |
# File 's3/bucket.rb', line 219 def bucket_name() jsii_get_property("bucketName") end |
#bucket_ref ⇒ AWSCDK::Interfaces::AWSS3::BucketReference
A reference to a Bucket resource.
226 227 228 |
# File 's3/bucket.rb', line 226 def bucket_ref() jsii_get_property("bucketRef") end |
#bucket_regional_domain_name ⇒ String
The regional domain name of the specified bucket.
233 234 235 |
# File 's3/bucket.rb', line 233 def bucket_regional_domain_name() jsii_get_property("bucketRegionalDomainName") end |
#bucket_website_domain_name ⇒ String
The Domain name of the static website.
240 241 242 |
# File 's3/bucket.rb', line 240 def bucket_website_domain_name() jsii_get_property("bucketWebsiteDomainName") end |
#bucket_website_url ⇒ String
The URL of the static website.
247 248 249 |
# File 's3/bucket.rb', line 247 def bucket_website_url() jsii_get_property("bucketWebsiteUrl") end |
#disallow_public_access ⇒ Boolean?
Whether to disallow public access.
287 288 289 |
# File 's3/bucket.rb', line 287 def disallow_public_access() jsii_get_property("disallowPublicAccess") end |
#disallow_public_access=(value) ⇒ Object
291 292 293 294 |
# File 's3/bucket.rb', line 291 def disallow_public_access=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disallowPublicAccess") unless value.nil? jsii_set_property("disallowPublicAccess", value) end |
#enable_event_bridge_notification ⇒ void
This method returns an undefined value.
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
567 568 569 |
# File 's3/bucket.rb', line 567 def enable_event_bridge_notification() jsii_call_method("enableEventBridgeNotification", []) end |
#encryption_key ⇒ AWSCDK::KMS::IKey?
Optional KMS encryption key associated with this bucket.
261 262 263 |
# File 's3/bucket.rb', line 261 def encryption_key() jsii_get_property("encryptionKey") end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
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.
170 171 172 |
# File 's3/bucket.rb', line 170 def env() jsii_get_property("env") end |
#generate_physical_name ⇒ String
416 417 418 |
# File 's3/bucket.rb', line 416 def generate_physical_name() jsii_call_method("generatePhysicalName", []) end |
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).
Normally, this token will resolve to arn_attr, but if the resource is
referenced across environments, arn_components will be used to synthesize
a concrete ARN with the resource's physical name. Make sure to reference
this.physicalName in arn_components.
430 431 432 433 434 435 |
# File 's3/bucket.rb', line 430 def get_resource_arn_attribute(arn_attr, arn_components) Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr") arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents") jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components]) end |
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).
Normally, this token will resolve to name_attr, but if the resource is
referenced across environments, it will be resolved to this.physicalName,
which will be a concrete name.
445 446 447 448 |
# File 's3/bucket.rb', line 445 def get_resource_name_attribute(name_attr) Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr") jsii_call_method("getResourceNameAttribute", [name_attr]) end |
#grant_delete(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket.
The use of this method is discouraged. Please use grants.delete() instead.
[disable-awslint:no-grants]
580 581 582 583 584 |
# File 's3/bucket.rb', line 580 def grant_delete(identity, objects_key_pattern = nil) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") Jsii::Type.check_type(objects_key_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "objectsKeyPattern") unless objects_key_pattern.nil? jsii_call_method("grantDelete", [identity, objects_key_pattern]) end |
#grant_on_key(grantee, *actions) ⇒ AWSCDK::IAM::GrantOnKeyResult
Gives permissions to a grantable entity to perform actions on the encryption key.
591 592 593 594 595 596 597 |
# File 's3/bucket.rb', line 591 def grant_on_key(grantee, *actions) Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee") actions.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actions[#{index}]") end jsii_call_method("grantOnKey", [grantee, *actions]) end |
#grant_public_access(key_prefix = nil, *allowed_actions) ⇒ AWSCDK::IAM::Grant
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.Grant object, 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” });
Note that if this IBucket refers to an existing bucket, possibly not
managed by CloudFormation, this method will have no effect, since it's
impossible to modify the policy of an existing bucket.
The use of this method is discouraged. Please use grants.publicAccess() instead.
[disable-awslint:no-grants]
629 630 631 632 633 634 635 |
# File 's3/bucket.rb', line 629 def grant_public_access(key_prefix = nil, *allowed_actions) Jsii::Type.check_type(key_prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyPrefix") unless key_prefix.nil? allowed_actions.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "allowedActions[#{index}]") end jsii_call_method("grantPublicAccess", [key_prefix, *allowed_actions]) end |
#grant_put(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
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.
The use of this method is discouraged. Please use grants.put() instead.
[disable-awslint:no-grants]
649 650 651 652 653 |
# File 's3/bucket.rb', line 649 def grant_put(identity, objects_key_pattern = nil) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") Jsii::Type.check_type(objects_key_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "objectsKeyPattern") unless objects_key_pattern.nil? jsii_call_method("grantPut", [identity, objects_key_pattern]) end |
#grant_put_acl(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
The use of this method is discouraged. Please use grants.putAcl() instead.
[disable-awslint:no-grants]
662 663 664 665 666 |
# File 's3/bucket.rb', line 662 def grant_put_acl(identity, objects_key_pattern = nil) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") Jsii::Type.check_type(objects_key_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectsKeyPattern") unless objects_key_pattern.nil? jsii_call_method("grantPutAcl", [identity, objects_key_pattern]) end |
#grant_read(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
Grant read permissions for this bucket and its 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.
The use of this method is discouraged. Please use grants.read() instead.
[disable-awslint:no-grants]
680 681 682 683 684 |
# File 's3/bucket.rb', line 680 def grant_read(identity, objects_key_pattern = nil) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") Jsii::Type.check_type(objects_key_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "objectsKeyPattern") unless objects_key_pattern.nil? jsii_call_method("grantRead", [identity, objects_key_pattern]) end |
#grant_read_write(identity, objects_key_pattern = nil) ⇒ AWSCDK::IAM::Grant
The use of this method is discouraged. Please use grants.readWrite() instead.
[disable-awslint:no-grants]
693 694 695 696 697 |
# File 's3/bucket.rb', line 693 def grant_read_write(identity, objects_key_pattern = nil) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") Jsii::Type.check_type(objects_key_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "objectsKeyPattern") unless objects_key_pattern.nil? jsii_call_method("grantReadWrite", [identity, objects_key_pattern]) end |
#grant_replication_permission(identity, props) ⇒ AWSCDK::IAM::Grant
Grant replication permission to a principal. This method allows the principal to perform replication operations on this bucket.
Note that when calling this function for source or destination buckets that support KMS encryption, you need to specify the KMS key for encryption and the KMS key for decryption, respectively.
The use of this method is discouraged. Please use grants.replicationPermission() instead.
[disable-awslint:no-grants]
711 712 713 714 715 716 |
# File 's3/bucket.rb', line 711 def (identity, props) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") props = props.is_a?(Hash) ? ::AWSCDK::S3::GrantReplicationPermissionProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuR3JhbnRSZXBsaWNhdGlvblBlcm1pc3Npb25Qcm9wcyJ9")), "props") jsii_call_method("grantReplicationPermission", [identity, props]) end |
#grant_write(identity, objects_key_pattern = nil, allowed_action_patterns = nil) ⇒ AWSCDK::IAM::Grant
The use of this method is discouraged. Please use grants.write() instead.
[disable-awslint:no-grants]
726 727 728 729 730 731 |
# File 's3/bucket.rb', line 726 def grant_write(identity, objects_key_pattern = nil, allowed_action_patterns = nil) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") Jsii::Type.check_type(objects_key_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "objectsKeyPattern") unless objects_key_pattern.nil? Jsii::Type.check_type(allowed_action_patterns, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowedActionPatterns") unless allowed_action_patterns.nil? jsii_call_method("grantWrite", [identity, objects_key_pattern, allowed_action_patterns]) end |
#grants ⇒ AWSCDK::S3::BucketGrants
Collection of grant methods for a Bucket.
254 255 256 |
# File 's3/bucket.rb', line 254 def grants() jsii_get_property("grants") end |
#is_website ⇒ Boolean?
If this bucket has been configured for static website hosting.
268 269 270 |
# File 's3/bucket.rb', line 268 def is_website() jsii_get_property("isWebsite") end |
#maybe_auto_create_policy ⇒ void
This method returns an undefined value.
Ensures a bucket policy exists on the L2 if autoCreatePolicy is set.
736 737 738 |
# File 's3/bucket.rb', line 736 def maybe_auto_create_policy() jsii_call_method("maybeAutoCreatePolicy", []) end |
#node ⇒ Constructs::Node
The tree node.
155 156 157 |
# File 's3/bucket.rb', line 155 def node() jsii_get_property("node") end |
#notifications_handler_role ⇒ AWSCDK::IAM::IRole?
297 298 299 |
# File 's3/bucket.rb', line 297 def notifications_handler_role() jsii_get_property("notificationsHandlerRole") end |
#notifications_handler_role=(value) ⇒ Object
301 302 303 304 |
# File 's3/bucket.rb', line 301 def notifications_handler_role=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "notificationsHandlerRole") unless value.nil? jsii_set_property("notificationsHandlerRole", value) end |
#notifications_skip_destination_validation ⇒ Boolean?
307 308 309 |
# File 's3/bucket.rb', line 307 def notifications_skip_destination_validation() jsii_get_property("notificationsSkipDestinationValidation") end |
#notifications_skip_destination_validation=(value) ⇒ Object
311 312 313 314 |
# File 's3/bucket.rb', line 311 def notifications_skip_destination_validation=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "notificationsSkipDestinationValidation") unless value.nil? jsii_set_property("notificationsSkipDestinationValidation", value) end |
#object_ownership ⇒ AWSCDK::S3::ObjectOwnership?
317 318 319 |
# File 's3/bucket.rb', line 317 def object_ownership() jsii_get_property("objectOwnership") end |
#object_ownership=(value) ⇒ Object
321 322 323 324 |
# File 's3/bucket.rb', line 321 def object_ownership=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuT2JqZWN0T3duZXJzaGlwIn0=")), "objectOwnership") unless value.nil? jsii_set_property("objectOwnership", value) end |
#on_cloud_trail_event(id, options = nil) ⇒ AWSCDK::Events::Rule
Define a CloudWatch event that triggers when something happens to this repository.
Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.
748 749 750 751 752 753 |
# File 's3/bucket.rb', line 748 def on_cloud_trail_event(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::S3::OnCloudTrailBucketEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuT25DbG91ZFRyYWlsQnVja2V0RXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onCloudTrailEvent", [id, ]) end |
#on_cloud_trail_put_object(id, options = nil) ⇒ AWSCDK::Events::Rule
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 cp will automatically use either
PutObject or the multipart upload API depending on the file size,
so using on_cloud_trail_write_object may 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.
767 768 769 770 771 772 |
# File 's3/bucket.rb', line 767 def on_cloud_trail_put_object(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::S3::OnCloudTrailBucketEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuT25DbG91ZFRyYWlsQnVja2V0RXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onCloudTrailPutObject", [id, ]) end |
#on_cloud_trail_write_object(id, options = nil) ⇒ AWSCDK::Events::Rule
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 cp will automatically use either
PutObject or the multipart upload API depending on the file size,
so using this method may be preferable to on_cloud_trail_put_object.
Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.
789 790 791 792 793 794 |
# File 's3/bucket.rb', line 789 def on_cloud_trail_write_object(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::S3::OnCloudTrailBucketEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuT25DbG91ZFRyYWlsQnVja2V0RXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onCloudTrailWriteObject", [id, ]) end |
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
This value will resolve to one of the following:
- a concrete value (e.g.
"my-awesome-bucket") undefined, when a name should be generated by CloudFormation- a concrete name generated automatically during synthesis, in cross-environment scenarios.
184 185 186 |
# File 's3/bucket.rb', line 184 def physical_name() jsii_get_property("physicalName") end |
#policy ⇒ AWSCDK::S3::BucketPolicy?
The resource policy associated with this bucket.
If auto_create_policy is true, a BucketPolicy will be created upon the
first call to addToResourcePolicy(s).
332 333 334 |
# File 's3/bucket.rb', line 332 def policy() jsii_get_property("policy") end |
#policy=(value) ⇒ Object
336 337 338 339 |
# File 's3/bucket.rb', line 336 def policy=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuQnVja2V0UG9saWN5In0=")), "policy") unless value.nil? jsii_set_property("policy", value) end |
#replication_role_arn ⇒ String?
Role used to set up permissions on this bucket for replication.
344 345 346 |
# File 's3/bucket.rb', line 344 def replication_role_arn() jsii_get_property("replicationRoleArn") end |
#replication_role_arn=(value) ⇒ Object
348 349 350 351 |
# File 's3/bucket.rb', line 348 def replication_role_arn=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "replicationRoleArn") unless value.nil? jsii_set_property("replicationRoleArn", value) end |
#s3_url_for_object(key = nil) ⇒ String
The S3 URL of an S3 object. For example:.
s3://onlybuckets3://bucket/key
803 804 805 806 |
# File 's3/bucket.rb', line 803 def s3_url_for_object(key = nil) Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key") unless key.nil? jsii_call_method("s3UrlForObject", [key]) end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
191 192 193 |
# File 's3/bucket.rb', line 191 def stack() jsii_get_property("stack") end |
#to_string ⇒ String
Returns a string representation of this construct.
363 364 365 |
# File 's3/bucket.rb', line 363 def to_string() jsii_call_method("toString", []) end |
#transfer_acceleration_url_for_object(key = nil, options = nil) ⇒ String
The https Transfer Acceleration URL of an S3 object.
Specify dualStack: true at the options
for dual-stack endpoint (connect to the bucket over IPv6). For example:
https://bucket.s3-accelerate.amazonaws.comhttps://bucket.s3-accelerate.amazonaws.com/key
819 820 821 822 823 824 |
# File 's3/bucket.rb', line 819 def transfer_acceleration_url_for_object(key = nil, = nil) Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key") unless key.nil? = .is_a?(Hash) ? ::AWSCDK::S3::TransferAccelerationURLOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuVHJhbnNmZXJBY2NlbGVyYXRpb25VcmxPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("transferAccelerationUrlForObject", [key, ]) end |
#url_for_object(key = nil) ⇒ String
The https URL of an S3 object. Specify regional: false at the options for non-regional URLs. For example:.
https://s3.us-west-1.amazonaws.com/onlybuckethttps://s3.us-west-1.amazonaws.com/bucket/keyhttps://s3.cn-north-1.amazonaws.com.cn/china-bucket/mykey
834 835 836 837 |
# File 's3/bucket.rb', line 834 def url_for_object(key = nil) Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key") unless key.nil? jsii_call_method("urlForObject", [key]) end |
#virtual_hosted_url_for_object(key = nil, options = nil) ⇒ String
The virtual hosted-style URL of an S3 object. Specify regional: false at the options for non-regional URL. For example:.
https://only-bucket.s3.us-west-1.amazonaws.comhttps://bucket.s3.us-west-1.amazonaws.com/keyhttps://bucket.s3.amazonaws.com/keyhttps://china-bucket.s3.cn-north-1.amazonaws.com.cn/mykey
849 850 851 852 853 854 |
# File 's3/bucket.rb', line 849 def virtual_hosted_url_for_object(key = nil, = nil) Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key") unless key.nil? = .is_a?(Hash) ? ::AWSCDK::S3::VirtualHostedStyleURLOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuVmlydHVhbEhvc3RlZFN0eWxlVXJsT3B0aW9ucyJ9")), "options") unless .nil? jsii_call_method("virtualHostedUrlForObject", [key, ]) end |
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
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.
376 377 378 379 380 381 |
# File 's3/bucket.rb', line 376 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |