Class: AWSCDK::S3::ReplicationRule

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

Overview

Specifies which Amazon S3 objects to replicate and where to store the replicas.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(destination:, access_control_transition: nil, delete_marker_replication: nil, filter: nil, id: nil, kms_key: nil, metrics: nil, priority: nil, replica_modifications: nil, replication_time_control: nil, sse_kms_encrypted_objects: nil, storage_class: nil) ⇒ ReplicationRule

Returns a new instance of ReplicationRule.

Parameters:

  • destination (AWSCDK::S3::IBucket)

    The destination bucket for the replicated objects.

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

    Whether to want to change replica ownership to the AWS account that owns the destination bucket.

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

    Specifies whether Amazon S3 replicates delete markers.

  • filter (AWSCDK::S3::Filter, nil) (defaults to: nil)

    A filter that identifies the subset of objects to which the replication rule applies.

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

    A unique identifier for the rule.

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

    The customer managed AWS KMS key stored in AWS Key Management Service (KMS) for the destination bucket.

  • metrics (AWSCDK::S3::ReplicationTimeValue, nil) (defaults to: nil)

    A container specifying replication metrics-related settings enabling replication metrics and events.

  • priority (Numeric, nil) (defaults to: nil)

    The priority indicates which rule has precedence whenever two or more replication rules conflict.

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

    Specifies whether Amazon S3 replicates modifications on replicas.

  • replication_time_control (AWSCDK::S3::ReplicationTimeValue, nil) (defaults to: nil)

    Specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated.

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

    Specifies whether Amazon S3 replicates objects created with server-side encryption using an AWS KMS key stored in AWS Key Management Service.

  • storage_class (AWSCDK::S3::StorageClass, nil) (defaults to: nil)

    The storage class to use when replicating objects, such as S3 Standard or reduced redundancy.



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/replication_rule.rb', line 19

def initialize(destination:, access_control_transition: nil, delete_marker_replication: nil, filter: nil, id: nil, kms_key: nil, metrics: nil, priority: nil, replica_modifications: nil, replication_time_control: nil, sse_kms_encrypted_objects: nil, storage_class: nil)
  @destination = destination
  Jsii::Type.check_type(@destination, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldCJ9")), "destination")
  @access_control_transition = access_control_transition
  Jsii::Type.check_type(@access_control_transition, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "accessControlTransition") unless @access_control_transition.nil?
  @delete_marker_replication = delete_marker_replication
  Jsii::Type.check_type(@delete_marker_replication, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "deleteMarkerReplication") unless @delete_marker_replication.nil?
  @filter = filter.is_a?(Hash) ? ::AWSCDK::S3::Filter.new(**filter.transform_keys(&:to_sym)) : filter
  Jsii::Type.check_type(@filter, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuRmlsdGVyIn0=")), "filter") unless @filter.nil?
  @id = id
  Jsii::Type.check_type(@id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") unless @id.nil?
  @kms_key = kms_key
  Jsii::Type.check_type(@kms_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "kmsKey") unless @kms_key.nil?
  @metrics = metrics
  Jsii::Type.check_type(@metrics, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuUmVwbGljYXRpb25UaW1lVmFsdWUifQ==")), "metrics") unless @metrics.nil?
  @priority = priority
  Jsii::Type.check_type(@priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "priority") unless @priority.nil?
  @replica_modifications = replica_modifications
  Jsii::Type.check_type(@replica_modifications, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "replicaModifications") unless @replica_modifications.nil?
  @replication_time_control = replication_time_control
  Jsii::Type.check_type(@replication_time_control, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuUmVwbGljYXRpb25UaW1lVmFsdWUifQ==")), "replicationTimeControl") unless @replication_time_control.nil?
  @sse_kms_encrypted_objects = sse_kms_encrypted_objects
  Jsii::Type.check_type(@sse_kms_encrypted_objects, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "sseKmsEncryptedObjects") unless @sse_kms_encrypted_objects.nil?
  @storage_class = storage_class
  Jsii::Type.check_type(@storage_class, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuU3RvcmFnZUNsYXNzIn0=")), "storageClass") unless @storage_class.nil?
end

Instance Attribute Details

#access_control_transitionBoolean? (readonly)

Note:

Default: - The replicas are owned by same AWS account that owns the source object

Whether to want to change replica ownership to the AWS account that owns the destination bucket.

This can only be specified if the source bucket and the destination bucket are not in the same AWS account.

Returns:

  • (Boolean, nil)


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

def access_control_transition
  @access_control_transition
end

#delete_marker_replicationBoolean? (readonly)

Note:

Default: - delete markers in source bucket is not replicated to destination bucket

Specifies whether Amazon S3 replicates delete markers.



68
69
70
# File 's3/replication_rule.rb', line 68

def delete_marker_replication
  @delete_marker_replication
end

#destinationAWSCDK::S3::IBucket (readonly)

The destination bucket for the replicated objects.

The destination can be either in the same AWS account or a cross account.

If you want to configure cross-account replication, the destination bucket must have a policy that allows the source bucket to replicate objects to it.



55
56
57
# File 's3/replication_rule.rb', line 55

def destination
  @destination
end

#filterAWSCDK::S3::Filter? (readonly)

Note:

Default: - applies to all objects

A filter that identifies the subset of objects to which the replication rule applies.

Returns:



73
74
75
# File 's3/replication_rule.rb', line 73

def filter
  @filter
end

#idString? (readonly)

Note:

Default: - auto generated random ID

A unique identifier for the rule.

The maximum value is 255 characters.

Returns:

  • (String, nil)


80
81
82
# File 's3/replication_rule.rb', line 80

def id
  @id
end

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

Note:

Default: - Amazon S3 uses the AWS managed KMS key for encryption

The customer managed AWS KMS key stored in AWS Key Management Service (KMS) for the destination bucket.

Amazon S3 uses this key to encrypt replica objects.

Amazon S3 only supports symmetric encryption KMS keys.



90
91
92
# File 's3/replication_rule.rb', line 90

def kms_key
  @kms_key
end

#metricsAWSCDK::S3::ReplicationTimeValue? (readonly)

Note:

Default: - Replication metrics are not enabled

A container specifying replication metrics-related settings enabling replication metrics and events.

When a value is set, metrics will be output to indicate whether the replication took longer than the specified time.



97
98
99
# File 's3/replication_rule.rb', line 97

def metrics
  @metrics
end

#priorityNumeric? (readonly)

Note:

Default: 0

The priority indicates which rule has precedence whenever two or more replication rules conflict.

Amazon S3 will attempt to replicate objects according to all replication rules. However, if there are two or more rules with the same destination bucket, then objects will be replicated according to the rule with the highest priority.

The higher the number, the higher the priority.

It is essential to specify priority explicitly when the replication configuration has multiple rules.

Returns:

  • (Numeric, nil)


110
111
112
# File 's3/replication_rule.rb', line 110

def priority
  @priority
end

#replica_modificationsBoolean? (readonly)

Note:

Default: false

Specifies whether Amazon S3 replicates modifications on replicas.

Returns:

  • (Boolean, nil)


115
116
117
# File 's3/replication_rule.rb', line 115

def replica_modifications
  @replica_modifications
end

#replication_time_controlAWSCDK::S3::ReplicationTimeValue? (readonly)

Note:

Default: - S3 Replication Time Control is not enabled

Specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated.



120
121
122
# File 's3/replication_rule.rb', line 120

def replication_time_control
  @replication_time_control
end

#sse_kms_encrypted_objectsBoolean? (readonly)

Note:

Default: false

Specifies whether Amazon S3 replicates objects created with server-side encryption using an AWS KMS key stored in AWS Key Management Service.

Returns:

  • (Boolean, nil)


125
126
127
# File 's3/replication_rule.rb', line 125

def sse_kms_encrypted_objects
  @sse_kms_encrypted_objects
end

#storage_classAWSCDK::S3::StorageClass? (readonly)

Note:

Default: - The storage class of the source object

The storage class to use when replicating objects, such as S3 Standard or reduced redundancy.

Returns:



130
131
132
# File 's3/replication_rule.rb', line 130

def storage_class
  @storage_class
end

Class Method Details

.jsii_propertiesObject



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 's3/replication_rule.rb', line 132

def self.jsii_properties
  {
    :destination => "destination",
    :access_control_transition => "accessControlTransition",
    :delete_marker_replication => "deleteMarkerReplication",
    :filter => "filter",
    :id => "id",
    :kms_key => "kmsKey",
    :metrics => "metrics",
    :priority => "priority",
    :replica_modifications => "replicaModifications",
    :replication_time_control => "replicationTimeControl",
    :sse_kms_encrypted_objects => "sseKmsEncryptedObjects",
    :storage_class => "storageClass",
  }
end

Instance Method Details

#to_jsiiObject



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 's3/replication_rule.rb', line 149

def to_jsii
  result = {}
  result.merge!({
    "destination" => @destination,
    "accessControlTransition" => @access_control_transition,
    "deleteMarkerReplication" => @delete_marker_replication,
    "filter" => @filter,
    "id" => @id,
    "kmsKey" => @kms_key,
    "metrics" => @metrics,
    "priority" => @priority,
    "replicaModifications" => @replica_modifications,
    "replicationTimeControl" => @replication_time_control,
    "sseKmsEncryptedObjects" => @sse_kms_encrypted_objects,
    "storageClass" => @storage_class,
  })
  result.compact
end