Repository: cloud-custodian/cloud-custodian

Issue:
ELB Logging - example doesn't work
policy from https://www.capitalone.io/docs/_modules/c7n/resources/elb.html:
```
policies:
  - name: elb-test
    resource: app-elb
    filters:
      - type: is-not-logging
    actions:
      - type: enable-s3-logging
        bucket: elblogtest
        prefix: dahlogs
        emit_interval: 5
```

output:
```
custodian run --dryrun -s . elb-log-test.yml 
Traceback (most recent call last):
  File "/usr/local/bin/custodian", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/c7n/cli.py", line 368, in main
    command(config)
  File "/usr/local/lib/python2.7/dist-packages/c7n/commands.py", line 64, in _load_policies
    collection = policy_load(options, fp, validate=validate, vars=vars)
  File "/usr/local/lib/python2.7/dist-packages/c7n/policy.py", line 66, in load
    errors[1], errors[0]))
Exception: Failed to validate on policy elb-test 
 {'type': 'enable-s3-logging', 'prefix': 'dahlogs', 'bucket': 'elblogtest', 'emit_interval': 5} is not valid under any of the given schemas

Failed validating u'anyOf' in schema[40][u'allOf'][1][u'properties'][u'actions'][u'items']:
    {u'anyOf': [{u'$ref': u'#/definitions/resources/aws.app-elb/actions/modify-listener'},
                {u'$ref': u'#/definitions/resources/aws.app-elb/actions/set-shield'},
                {u'$ref': u'#/definitions/resources/aws.app-elb/actions/set-s3-logging'},
                {u'$ref': u'#/definitions/resources/aws.app-elb/actions/remove-tag'},
                {u'$ref': u'#/definitions/resources/aws.app-elb/actions/set-waf'},
                {u'$ref': u'#/definitions/actions/tag'},
                {u'$ref': u'#/definitions/actions/notify'},
                {u'$ref': u'#/definitions/actions/invoke-lambda'},
                {u'$ref': u'#/definitions/actions/put-metric'},
                {u'$ref': u'#/definitions/actions/auto-tag-user'},
                {u'$ref': u'#/definitions/actions/mark-for-op'},
                {u'$ref': u'#/definitions/actions/post-finding'},
                {u'$ref': u'#/definitions/resources/aws.app-elb/actions/delete'},
                {u'enum': [u'modify-listener',
                           u'set-shield',
                           u'set-s3-logging',
                           u'remove-tag',
                           u'set-waf',
                           u'tag',
                           u'notify',
                           'invoke-lambda',
                           'put-metric',
                           'auto-tag-user',
                           u'mark-for-op',
                           'post-finding',
                           u'delete']}]}

On instance[u'actions'][0]:
    {'bucket': 'elblogtest',
     'emit_interval': 5,
     'prefix': 'dahlogs',
     'type': 'enable-s3-logging'}
```


Discussion:
solution:
resource: app-elb -> resource: elb
For app-elb, looks like the action type is: set-s3-logging. I have listed the schema below:
```
    schema = type_schema(
        'set-s3-logging',
        state={'enum': ['enabled', 'disabled']},
        bucket={'type': 'string'},
        prefix={'type': 'string'},
        required=('state',))
```
Try this:
```
policies:
  - name: elb-test
    resource: app-elb
    filters:
      - type: is-not-logging
    actions:
      - type: set-s3-logging
        state: enabled
        bucket: elblogtest
        prefix: dahlogs
```

Resolving patch:
diff --git a/c7n/resources/elb.py b/c7n/resources/elb.py
--- a/c7n/resources/elb.py
+++ b/c7n/resources/elb.py
@@ -347,7 +347,7 @@ class EnableS3Logging(BaseAction):
 
             policies:
               - name: elb-test
-                resource: app-elb
+                resource: elb
                 filters:
                   - type: is-not-logging
                 actions:
diff --git a/c7n/tags.py b/c7n/tags.py
--- a/c7n/tags.py
+++ b/c7n/tags.py
@@ -355,13 +355,12 @@ class TagCountFilter(Filter):
 
        - filters:
            - type: value
-             key: "[length(Tags)][0]"
              op: gte
-             value: 8
+             count: 8
 
        - filters:
            - type: tag-count
-             value: 8
+             count: 8
     """
     schema = utils.type_schema(
         'tag-count',


Test patch: