Show / Hide Table of Contents

Class Filter

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

Inheritance
object
Filter
Implements
IFilter
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.S3
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Filter : IFilter
Syntax (vb)
Public Class Filter Implements IFilter
Remarks

ExampleMetadata: infused

Examples
IBucket destinationBucket1;
            IBucket destinationBucket2;
            IRole replicationRole;
            IKey encryptionKey;
            IKey destinationEncryptionKey;


            var sourceBucket = new Bucket(this, "SourceBucket", new BucketProps {
                // Versioning must be enabled on both the source and destination bucket
                Versioned = true,
                // Optional. Specify the KMS key to use for encrypts objects in the source bucket.
                EncryptionKey = encryptionKey,
                // Optional. If not specified, a new role will be created.
                ReplicationRole = replicationRole,
                ReplicationRules = new [] { new ReplicationRule {
                    // The destination bucket for the replication rule.
                    Destination = destinationBucket1,
                    // The priority of the rule.
                    // 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.
                    Priority = 1
                }, new ReplicationRule {
                    Destination = destinationBucket2,
                    Priority = 2,
                    // Whether to specify S3 Replication Time Control (S3 RTC).
                    // S3 RTC replicates most objects that you upload to Amazon S3 in seconds,
                    // and 99.99 percent of those objects within specified time.
                    ReplicationTimeControl = ReplicationTimeValue.FIFTEEN_MINUTES,
                    // Whether to enable replication metrics about S3 RTC.
                    // If set, metrics will be output to indicate whether replication by S3 RTC took longer than the configured time.
                    Metrics = ReplicationTimeValue.FIFTEEN_MINUTES,
                    // The kms key to use for the destination bucket.
                    KmsKey = destinationEncryptionKey,
                    // The storage class to use for the destination bucket.
                    StorageClass = StorageClass.INFREQUENT_ACCESS,
                    // Whether to replicate objects with SSE-KMS encryption.
                    SseKmsEncryptedObjects = false,
                    // Whether to replicate modifications on replicas.
                    ReplicaModifications = true,
                    // Whether to replicate delete markers.
                    // This property cannot be enabled if the replication rule has a tag filter.
                    DeleteMarkerReplication = false,
                    // The ID of the rule.
                    Id = "full-settings-rule",
                    // The object filter for the rule.
                    Filter = new Filter {
                        // The prefix filter for the rule.
                        Prefix = "prefix",
                        // The tag filter for the rule.
                        Tags = new [] { new Tag {
                            Key = "tagKey",
                            Value = "tagValue"
                        } }
                    }
                } }
            });

            // Grant permissions to the replication role.
            // This method is not required if you choose to use an auto-generated replication role or manually grant permissions.
            sourceBucket.GrantReplicationPermission(replicationRole, new GrantReplicationPermissionProps {
                // Optional. Specify the KMS key to use for decrypting objects in the source bucket.
                SourceDecryptionKey = encryptionKey,
                Destinations = new [] { new GrantReplicationPermissionDestinationProps { Bucket = destinationBucket1 }, new GrantReplicationPermissionDestinationProps { Bucket = destinationBucket2, EncryptionKey = destinationEncryptionKey } }
            });

Synopsis

Constructors

Filter()

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

Properties

Prefix

An object key name prefix that identifies the object or objects to which the rule applies.

Tags

The tag array used for tag filters.

Constructors

Filter()

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

public Filter()
Remarks

ExampleMetadata: infused

Examples
IBucket destinationBucket1;
            IBucket destinationBucket2;
            IRole replicationRole;
            IKey encryptionKey;
            IKey destinationEncryptionKey;


            var sourceBucket = new Bucket(this, "SourceBucket", new BucketProps {
                // Versioning must be enabled on both the source and destination bucket
                Versioned = true,
                // Optional. Specify the KMS key to use for encrypts objects in the source bucket.
                EncryptionKey = encryptionKey,
                // Optional. If not specified, a new role will be created.
                ReplicationRole = replicationRole,
                ReplicationRules = new [] { new ReplicationRule {
                    // The destination bucket for the replication rule.
                    Destination = destinationBucket1,
                    // The priority of the rule.
                    // 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.
                    Priority = 1
                }, new ReplicationRule {
                    Destination = destinationBucket2,
                    Priority = 2,
                    // Whether to specify S3 Replication Time Control (S3 RTC).
                    // S3 RTC replicates most objects that you upload to Amazon S3 in seconds,
                    // and 99.99 percent of those objects within specified time.
                    ReplicationTimeControl = ReplicationTimeValue.FIFTEEN_MINUTES,
                    // Whether to enable replication metrics about S3 RTC.
                    // If set, metrics will be output to indicate whether replication by S3 RTC took longer than the configured time.
                    Metrics = ReplicationTimeValue.FIFTEEN_MINUTES,
                    // The kms key to use for the destination bucket.
                    KmsKey = destinationEncryptionKey,
                    // The storage class to use for the destination bucket.
                    StorageClass = StorageClass.INFREQUENT_ACCESS,
                    // Whether to replicate objects with SSE-KMS encryption.
                    SseKmsEncryptedObjects = false,
                    // Whether to replicate modifications on replicas.
                    ReplicaModifications = true,
                    // Whether to replicate delete markers.
                    // This property cannot be enabled if the replication rule has a tag filter.
                    DeleteMarkerReplication = false,
                    // The ID of the rule.
                    Id = "full-settings-rule",
                    // The object filter for the rule.
                    Filter = new Filter {
                        // The prefix filter for the rule.
                        Prefix = "prefix",
                        // The tag filter for the rule.
                        Tags = new [] { new Tag {
                            Key = "tagKey",
                            Value = "tagValue"
                        } }
                    }
                } }
            });

            // Grant permissions to the replication role.
            // This method is not required if you choose to use an auto-generated replication role or manually grant permissions.
            sourceBucket.GrantReplicationPermission(replicationRole, new GrantReplicationPermissionProps {
                // Optional. Specify the KMS key to use for decrypting objects in the source bucket.
                SourceDecryptionKey = encryptionKey,
                Destinations = new [] { new GrantReplicationPermissionDestinationProps { Bucket = destinationBucket1 }, new GrantReplicationPermissionDestinationProps { Bucket = destinationBucket2, EncryptionKey = destinationEncryptionKey } }
            });

Properties

Prefix

An object key name prefix that identifies the object or objects to which the rule applies.

public string? Prefix { get; set; }
Property Value

string

Remarks

Default: - applies to all objects

Tags

The tag array used for tag filters.

public ITag[]? Tags { get; set; }
Property Value

ITag[]

Remarks

The rule applies only to objects that have the tag in this set.

Default: - applies to all objects

Implements

IFilter
Back to top Generated by DocFX