Repository: cloud-custodian/cloud-custodian

Issue:
S3 life cycle policy based on objectsize
I want to apply a lifecycle policy based on object size to leverage real cost saving.

```
policies:
  - name: s3-apply-lifecycle-IntelligentTiering
    resource: s3
    filters:
      - Lifecycle: absent
    actions:
      - type: configure-lifecycle
        rules:
        - ID: "Move to Intelligent-Tiering"
          Status: Enabled
          Filter:
            And:
              Prefix: ""
              ObjectSizeGreaterThan: 1048576
          Transitions:
          - Days: 0
            StorageClass: INTELLIGENT_TIERING
          NoncurrentVersionTransitions:
          - NoncurrentDays: 0
            StorageClass: INTELLIGENT_TIERING
```


My output says the property is unexpected.

2023-05-03 14:25:33,670: custodian.commands:ERROR Configuration invalid: s3_life_cycle.yml
2023-05-03 14:25:33,670: custodian.commands:ERROR             Error on policy:s3-apply-lifecycle-IntelligentTiering resource:s3
Additional properties are not allowed ('ObjectSizeGreaterThan' was unexpected)

            Failed validating 'additionalProperties' in schema[2]['properties']['rules']['items']['properties']['Filter']['properties']['And']:
                {'additionalProperties': False,
                 'properties': {'Prefix': {'type': 'string'},
                                'Tags': {'items': {'additionalProperties': False,
                                                   'properties': {'Key': {'type': 'string'},
                                                                  'Value': {'type': 'string'}},
                                                   'required': ['Key', 'Value'],
                                                   'type': 'object'},
                                         'type': 'array'}},
                 'type': 'object'}

            On instance['rules'][0]['Filter']['And']:
                {'ObjectSizeGreaterThan': 1048576, 'Prefix': ''}
2023-05-03 14:25:33,678: custodian.commands:ERROR s3-apply-lifecycle-IntelligentTiering


Discussion:

Resolving patch:
diff --git a/c7n/resources/s3.py b/c7n/resources/s3.py
--- a/c7n/resources/s3.py
+++ b/c7n/resources/s3.py
@@ -2947,6 +2947,8 @@ class Lifecycle(BucketActionBase):
                             'additionalProperties': False,
                             'properties': {
                                 'Prefix': {'type': 'string'},
+                                'ObjectSizeGreaterThan': {'type': 'integer'},
+                                'ObjectSizeLessThan': {'type': 'integer'},
                                 'Tag': {
                                     'type': 'object',
                                     'required': ['Key', 'Value'],
@@ -2961,6 +2963,8 @@ class Lifecycle(BucketActionBase):
                                     'additionalProperties': False,
                                     'properties': {
                                         'Prefix': {'type': 'string'},
+                                        'ObjectSizeGreaterThan': {'type': 'integer'},
+                                        'ObjectSizeLessThan': {'type': 'integer'},
                                         'Tags': {
                                             'type': 'array',
                                             'items': {
@@ -2996,6 +3000,7 @@ class Lifecycle(BucketActionBase):
                                 'additionalProperties': False,
                                 'properties': {
                                     'NoncurrentDays': {'type': 'integer'},
+                                    'NewerNoncurrentVersions': {'type': 'integer'},
                                     'StorageClass': {'type': 'string'},
                                 },
                             },
@@ -3005,6 +3010,7 @@ class Lifecycle(BucketActionBase):
                             'additionalProperties': False,
                             'properties': {
                                 'NoncurrentDays': {'type': 'integer'},
+                                'NewerNoncurrentVersions': {'type': 'integer'}
                             },
                         },
                         'AbortIncompleteMultipartUpload': {


Test patch: