# ReplicationRuleFilterProperty

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

A `Filter` must specify exactly one `Prefix` , `TagFilter` , or an `And` child element.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';
const replicationRuleFilterProperty: s3.CfnBucket.ReplicationRuleFilterProperty = {
  and: {
    prefix: 'prefix',
    tagFilters: [{
      key: 'key',
      value: 'value',
    }],
  },
  prefix: 'prefix',
  tagFilter: {
    key: 'key',
    value: 'value',
  },
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_s3 as s3

replication_rule_filter_property = s3.CfnBucket.ReplicationRuleFilterProperty(
    and=s3.CfnBucket.ReplicationRuleAndOperatorProperty(
        prefix="prefix",
        tag_filters=[s3.CfnBucket.TagFilterProperty(
            key="key",
            value="value"
        )]
    ),
    prefix="prefix",
    tag_filter=s3.CfnBucket.TagFilterProperty(
        key="key",
        value="value"
    )
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.s3.*;

ReplicationRuleFilterProperty replicationRuleFilterProperty = ReplicationRuleFilterProperty.builder()
        .and(ReplicationRuleAndOperatorProperty.builder()
                .prefix("prefix")
                .tagFilters(List.of(TagFilterProperty.builder()
                        .key("key")
                        .value("value")
                        .build()))
                .build())
        .prefix("prefix")
        .tagFilter(TagFilterProperty.builder()
                .key("key")
                .value("value")
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3;

var replicationRuleFilterProperty = new ReplicationRuleFilterProperty {
    And = new ReplicationRuleAndOperatorProperty {
        Prefix = "prefix",
        TagFilters = new [] { new TagFilterProperty {
            Key = "key",
            Value = "value"
        } }
    },
    Prefix = "prefix",
    TagFilter = new TagFilterProperty {
        Key = "key",
        Value = "value"
    }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

replicationRuleFilterProperty := &ReplicationRuleFilterProperty{
	And: &ReplicationRuleAndOperatorProperty{
		Prefix: jsii.String("prefix"),
		TagFilters: []interface{}{
			&TagFilterProperty{
				Key: jsii.String("key"),
				Value: jsii.String("value"),
			},
		},
	},
	Prefix: jsii.String("prefix"),
	TagFilter: &TagFilterProperty{
		Key: jsii.String("key"),
		Value: jsii.String("value"),
	},
}
```

## Properties

- `and`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnBucket.ReplicationRuleAndOperatorProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.CfnBucket.ReplicationRuleAndOperatorProperty.html) — A container for specifying rule filters.

  The filters determine the subset of objects to which the rule applies. This element is required only if you specify more than one filter. For example:

  - If you specify both a `Prefix` and a `TagFilter` , wrap these filters in an `And` tag.
  - If you specify a filter based on multiple tags, wrap the `TagFilter` elements in an `And` tag.

- `prefix`: string — An object key name prefix that identifies the subset of objects to which the rule applies.

  > Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see [XML related object key constraints](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) .

- `tagFilter`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnBucket.TagFilterProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.CfnBucket.TagFilterProperty.html) — A container for specifying a tag key and value.

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