Added Filtering support for S3 lifecycle (#1535)
* Added Filtering support for S3 lifecycle Also added `ExpiredObjectDeleteMarker`. closes #1533 closes #1479 * Result set no longer contains "Prefix" if "Filter" is set.
This commit is contained in:
parent
0a4d2037df
commit
4184acc0d2
4 changed files with 253 additions and 7 deletions
|
|
@ -1176,7 +1176,30 @@ S3_BUCKET_LIFECYCLE_CONFIGURATION = """<?xml version="1.0" encoding="UTF-8"?>
|
|||
{% for rule in rules %}
|
||||
<Rule>
|
||||
<ID>{{ rule.id }}</ID>
|
||||
{% if rule.filter %}
|
||||
<Filter>
|
||||
<Prefix>{{ rule.filter.prefix }}</Prefix>
|
||||
{% if rule.filter.tag %}
|
||||
<Tag>
|
||||
<Key>{{ rule.filter.tag.key }}</Key>
|
||||
<Value>{{ rule.filter.tag.value }}</Value>
|
||||
</Tag>
|
||||
{% endif %}
|
||||
{% if rule.filter.and_filter %}
|
||||
<And>
|
||||
<Prefix>{{ rule.filter.and_filter.prefix }}</Prefix>
|
||||
{% for tag in rule.filter.and_filter.tags %}
|
||||
<Tag>
|
||||
<Key>{{ tag.key }}</Key>
|
||||
<Value>{{ tag.value }}</Value>
|
||||
</Tag>
|
||||
{% endfor %}
|
||||
</And>
|
||||
{% endif %}
|
||||
</Filter>
|
||||
{% else %}
|
||||
<Prefix>{{ rule.prefix if rule.prefix != None }}</Prefix>
|
||||
{% endif %}
|
||||
<Status>{{ rule.status }}</Status>
|
||||
{% if rule.storage_class %}
|
||||
<Transition>
|
||||
|
|
@ -1189,7 +1212,7 @@ S3_BUCKET_LIFECYCLE_CONFIGURATION = """<?xml version="1.0" encoding="UTF-8"?>
|
|||
<StorageClass>{{ rule.storage_class }}</StorageClass>
|
||||
</Transition>
|
||||
{% endif %}
|
||||
{% if rule.expiration_days or rule.expiration_date %}
|
||||
{% if rule.expiration_days or rule.expiration_date or rule.expired_object_delete_marker %}
|
||||
<Expiration>
|
||||
{% if rule.expiration_days %}
|
||||
<Days>{{ rule.expiration_days }}</Days>
|
||||
|
|
@ -1197,6 +1220,9 @@ S3_BUCKET_LIFECYCLE_CONFIGURATION = """<?xml version="1.0" encoding="UTF-8"?>
|
|||
{% if rule.expiration_date %}
|
||||
<Date>{{ rule.expiration_date }}</Date>
|
||||
{% endif %}
|
||||
{% if rule.expired_object_delete_marker %}
|
||||
<ExpiredObjectDeleteMarker>{{ rule.expired_object_delete_marker }}</ExpiredObjectDeleteMarker>
|
||||
{% endif %}
|
||||
</Expiration>
|
||||
{% endif %}
|
||||
</Rule>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue