We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Support for EFS Lifecycles
According to this, it's not an available action: https://cloudcustodian.io/docs/aws/resources/efs.html

Console and CLI instructions from AWS are here: https://docs.aws.amazon.com/efs/latest/ug/enable-lifecycle-management.html

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `c7n/resources/efs.py`
Content:
```
1 # Copyright 2015-2017 Capital One Services, LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from __future__ import absolute_import, division, print_function, unicode_literals
15 
16 from c7n.actions import Action
17 from c7n.filters.kms import KmsRelatedFilter
18 from c7n.manager import resources
19 from c7n.filters.vpc import SecurityGroupFilter, SubnetFilter
20 from c7n.query import QueryResourceManager, ChildResourceManager, TypeInfo
21 from c7n.tags import universal_augment
22 from c7n.utils import local_session, type_schema, get_retry
23 
24 
25 @resources.register('efs')
26 class ElasticFileSystem(QueryResourceManager):
27 
28     class resource_type(TypeInfo):
29         service = 'efs'
30         enum_spec = ('describe_file_systems', 'FileSystems', None)
31         id = 'FileSystemId'
32         name = 'Name'
33         date = 'CreationTime'
34         dimension = 'FileSystemId'
35         arn_type = 'file-system'
36         permission_prefix = arn_service = 'elasticfilesystem'
37         filter_name = 'FileSystemId'
38         filter_type = 'scalar'
39         universal_taggable = True
40 
41     augment = universal_augment
42 
43 
44 @resources.register('efs-mount-target')
45 class ElasticFileSystemMountTarget(ChildResourceManager):
46 
47     class resource_type(TypeInfo):
48         service = 'efs'
49         parent_spec = ('efs', 'FileSystemId', None)
50         enum_spec = ('describe_mount_targets', 'MountTargets', None)
51         permission_prefix = 'elasticfilesystem'
52         name = id = 'MountTargetId'
53         filter_name = 'MountTargetId'
54         filter_type = 'scalar'
55         arn = False
56 
57 
58 @ElasticFileSystemMountTarget.filter_registry.register('subnet')
59 class Subnet(SubnetFilter):
60 
61     RelatedIdsExpression = "SubnetId"
62 
63 
64 @ElasticFileSystemMountTarget.filter_registry.register('security-group')
65 class SecurityGroup(SecurityGroupFilter):
66 
67     efs_group_cache = None
68 
69     RelatedIdsExpression = ""
70 
71     def get_related_ids(self, resources):
72 
73         if self.efs_group_cache:
74             group_ids = set()
75             for r in resources:
76                 group_ids.update(
77                     self.efs_group_cache.get(r['MountTargetId'], ()))
78             return list(group_ids)
79 
80         client = local_session(self.manager.session_factory).client('efs')
81         groups = {}
82         group_ids = set()
83         retry = get_retry(('Throttled',), 12)
84 
85         for r in resources:
86             groups[r['MountTargetId']] = retry(
87                 client.describe_mount_target_security_groups,
88                 MountTargetId=r['MountTargetId'])['SecurityGroups']
89             group_ids.update(groups[r['MountTargetId']])
90 
91         self.efs_group_cache = groups
92         return list(group_ids)
93 
94 
95 @ElasticFileSystem.filter_registry.register('kms-key')
96 class KmsFilter(KmsRelatedFilter):
97     """
98     Filter a resource by its associcated kms key and optionally the aliasname
99     of the kms key by using 'c7n:AliasName'
100 
101     :example:
102 
103         .. code-block:: yaml
104 
105             policies:
106                 - name: efs-kms-key-filters
107                   resource: efs
108                   filters:
109                     - type: kms-key
110                       key: c7n:AliasName
111                       value: "^(alias/aws/)"
112                       op: regex
113     """
114     RelatedIdsExpression = 'KmsKeyId'
115 
116 
117 @ElasticFileSystem.action_registry.register('delete')
118 class Delete(Action):
119 
120     schema = type_schema('delete')
121     permissions = ('elasticfilesystem:DescribeMountTargets',
122                    'elasticfilesystem:DeleteMountTarget',
123                    'elasticfilesystem:DeleteFileSystem')
124 
125     def process(self, resources):
126         client = local_session(self.manager.session_factory).client('efs')
127         self.unmount_filesystems(resources)
128         retry = get_retry(('FileSystemInUse',), 12)
129         for r in resources:
130             retry(client.delete_file_system, FileSystemId=r['FileSystemId'])
131 
132     def unmount_filesystems(self, resources):
133         client = local_session(self.manager.session_factory).client('efs')
134         for r in resources:
135             if not r['NumberOfMountTargets']:
136                 continue
137             for t in client.describe_mount_targets(
138                     FileSystemId=r['FileSystemId'])['MountTargets']:
139                 client.delete_mount_target(MountTargetId=t['MountTargetId'])
140
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/c7n/resources/efs.py b/c7n/resources/efs.py
--- a/c7n/resources/efs.py
+++ b/c7n/resources/efs.py
@@ -13,13 +13,15 @@
 # limitations under the License.
 from __future__ import absolute_import, division, print_function, unicode_literals
 
-from c7n.actions import Action
+from c7n.actions import Action, BaseAction
+from c7n.exceptions import PolicyValidationError
 from c7n.filters.kms import KmsRelatedFilter
 from c7n.manager import resources
 from c7n.filters.vpc import SecurityGroupFilter, SubnetFilter
 from c7n.query import QueryResourceManager, ChildResourceManager, TypeInfo
 from c7n.tags import universal_augment
 from c7n.utils import local_session, type_schema, get_retry
+from .aws import shape_validate
 
 
 @resources.register('efs')
@@ -137,3 +139,57 @@
             for t in client.describe_mount_targets(
                     FileSystemId=r['FileSystemId'])['MountTargets']:
                 client.delete_mount_target(MountTargetId=t['MountTargetId'])
+
+
+@ElasticFileSystem.action_registry.register('configure-lifecycle-policy')
+class ConfigureLifecycle(BaseAction):
+    """Enable/disable lifecycle policy for efs.
+
+    :example:
+
+      .. code-block:: yaml
+
+            policies:
+              - name: efs-apply-lifecycle
+                resource: efs
+                actions:
+                  - type: configure-lifecycle-policy
+                    state: enable
+                    rules:
+                      - 'TransitionToIA': 'AFTER_7_DAYS'
+
+    """
+    schema = type_schema(
+        'configure-lifecycle-policy',
+        state={'enum': ['enable', 'disable']},
+        rules={
+            'type': 'array',
+            'items': {'type': 'object'}},
+        required=['state'])
+
+    permissions = ('elasticfilesystem:PutLifecycleConfiguration',)
+    shape = 'PutLifecycleConfigurationRequest'
+
+    def validate(self):
+        if self.data.get('state') == 'enable' and 'rules' not in self.data:
+            raise PolicyValidationError(
+                'rules are required to enable lifecycle configuration %s' % (self.manager.data))
+        if self.data.get('state') == 'disable' and 'rules' in self.data:
+            raise PolicyValidationError(
+                'rules not required to disable lifecycle configuration %s' % (self.manager.data))
+        if self.data.get('rules'):
+            attrs = {}
+            attrs['LifecyclePolicies'] = self.data['rules']
+            attrs['FileSystemId'] = 'PolicyValidator'
+            return shape_validate(attrs, self.shape, 'efs')
+
+    def process(self, resources):
+        client = local_session(self.manager.session_factory).client('efs')
+        op_map = {'enable': self.data.get('rules'), 'disable': []}
+        for r in resources:
+            try:
+                client.put_lifecycle_configuration(
+                    FileSystemId=r['FileSystemId'],
+                    LifecyclePolicies=op_map.get(self.data.get('state')))
+            except client.exceptions.FileSystemNotFound:
+                continue

{"golden_diff": "diff --git a/c7n/resources/efs.py b/c7n/resources/efs.py\n--- a/c7n/resources/efs.py\n+++ b/c7n/resources/efs.py\n@@ -13,13 +13,15 @@\n # limitations under the License.\n from __future__ import absolute_import, division, print_function, unicode_literals\n \n-from c7n.actions import Action\n+from c7n.actions import Action, BaseAction\n+from c7n.exceptions import PolicyValidationError\n from c7n.filters.kms import KmsRelatedFilter\n from c7n.manager import resources\n from c7n.filters.vpc import SecurityGroupFilter, SubnetFilter\n from c7n.query import QueryResourceManager, ChildResourceManager, TypeInfo\n from c7n.tags import universal_augment\n from c7n.utils import local_session, type_schema, get_retry\n+from .aws import shape_validate\n \n \n @resources.register('efs')\n@@ -137,3 +139,57 @@\n             for t in client.describe_mount_targets(\n                     FileSystemId=r['FileSystemId'])['MountTargets']:\n                 client.delete_mount_target(MountTargetId=t['MountTargetId'])\n+\n+\n+@ElasticFileSystem.action_registry.register('configure-lifecycle-policy')\n+class ConfigureLifecycle(BaseAction):\n+    \"\"\"Enable/disable lifecycle policy for efs.\n+\n+    :example:\n+\n+      .. code-block:: yaml\n+\n+            policies:\n+              - name: efs-apply-lifecycle\n+                resource: efs\n+                actions:\n+                  - type: configure-lifecycle-policy\n+                    state: enable\n+                    rules:\n+                      - 'TransitionToIA': 'AFTER_7_DAYS'\n+\n+    \"\"\"\n+    schema = type_schema(\n+        'configure-lifecycle-policy',\n+        state={'enum': ['enable', 'disable']},\n+        rules={\n+            'type': 'array',\n+            'items': {'type': 'object'}},\n+        required=['state'])\n+\n+    permissions = ('elasticfilesystem:PutLifecycleConfiguration',)\n+    shape = 'PutLifecycleConfigurationRequest'\n+\n+    def validate(self):\n+        if self.data.get('state') == 'enable' and 'rules' not in self.data:\n+            raise PolicyValidationError(\n+                'rules are required to enable lifecycle configuration %s' % (self.manager.data))\n+        if self.data.get('state') == 'disable' and 'rules' in self.data:\n+            raise PolicyValidationError(\n+                'rules not required to disable lifecycle configuration %s' % (self.manager.data))\n+        if self.data.get('rules'):\n+            attrs = {}\n+            attrs['LifecyclePolicies'] = self.data['rules']\n+            attrs['FileSystemId'] = 'PolicyValidator'\n+            return shape_validate(attrs, self.shape, 'efs')\n+\n+    def process(self, resources):\n+        client = local_session(self.manager.session_factory).client('efs')\n+        op_map = {'enable': self.data.get('rules'), 'disable': []}\n+        for r in resources:\n+            try:\n+                client.put_lifecycle_configuration(\n+                    FileSystemId=r['FileSystemId'],\n+                    LifecyclePolicies=op_map.get(self.data.get('state')))\n+            except client.exceptions.FileSystemNotFound:\n+                continue\n", "issue": "Support for EFS Lifecycles\nAccording to this, it's not an available action: https://cloudcustodian.io/docs/aws/resources/efs.html\r\n\r\nConsole and CLI instructions from AWS are here: https://docs.aws.amazon.com/efs/latest/ug/enable-lifecycle-management.html\n", "before_files": [{"content": "# Copyright 2015-2017 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom c7n.actions import Action\nfrom c7n.filters.kms import KmsRelatedFilter\nfrom c7n.manager import resources\nfrom c7n.filters.vpc import SecurityGroupFilter, SubnetFilter\nfrom c7n.query import QueryResourceManager, ChildResourceManager, TypeInfo\nfrom c7n.tags import universal_augment\nfrom c7n.utils import local_session, type_schema, get_retry\n\n\n@resources.register('efs')\nclass ElasticFileSystem(QueryResourceManager):\n\n    class resource_type(TypeInfo):\n        service = 'efs'\n        enum_spec = ('describe_file_systems', 'FileSystems', None)\n        id = 'FileSystemId'\n        name = 'Name'\n        date = 'CreationTime'\n        dimension = 'FileSystemId'\n        arn_type = 'file-system'\n        permission_prefix = arn_service = 'elasticfilesystem'\n        filter_name = 'FileSystemId'\n        filter_type = 'scalar'\n        universal_taggable = True\n\n    augment = universal_augment\n\n\n@resources.register('efs-mount-target')\nclass ElasticFileSystemMountTarget(ChildResourceManager):\n\n    class resource_type(TypeInfo):\n        service = 'efs'\n        parent_spec = ('efs', 'FileSystemId', None)\n        enum_spec = ('describe_mount_targets', 'MountTargets', None)\n        permission_prefix = 'elasticfilesystem'\n        name = id = 'MountTargetId'\n        filter_name = 'MountTargetId'\n        filter_type = 'scalar'\n        arn = False\n\n\n@ElasticFileSystemMountTarget.filter_registry.register('subnet')\nclass Subnet(SubnetFilter):\n\n    RelatedIdsExpression = \"SubnetId\"\n\n\n@ElasticFileSystemMountTarget.filter_registry.register('security-group')\nclass SecurityGroup(SecurityGroupFilter):\n\n    efs_group_cache = None\n\n    RelatedIdsExpression = \"\"\n\n    def get_related_ids(self, resources):\n\n        if self.efs_group_cache:\n            group_ids = set()\n            for r in resources:\n                group_ids.update(\n                    self.efs_group_cache.get(r['MountTargetId'], ()))\n            return list(group_ids)\n\n        client = local_session(self.manager.session_factory).client('efs')\n        groups = {}\n        group_ids = set()\n        retry = get_retry(('Throttled',), 12)\n\n        for r in resources:\n            groups[r['MountTargetId']] = retry(\n                client.describe_mount_target_security_groups,\n                MountTargetId=r['MountTargetId'])['SecurityGroups']\n            group_ids.update(groups[r['MountTargetId']])\n\n        self.efs_group_cache = groups\n        return list(group_ids)\n\n\n@ElasticFileSystem.filter_registry.register('kms-key')\nclass KmsFilter(KmsRelatedFilter):\n    \"\"\"\n    Filter a resource by its associcated kms key and optionally the aliasname\n    of the kms key by using 'c7n:AliasName'\n\n    :example:\n\n        .. code-block:: yaml\n\n            policies:\n                - name: efs-kms-key-filters\n                  resource: efs\n                  filters:\n                    - type: kms-key\n                      key: c7n:AliasName\n                      value: \"^(alias/aws/)\"\n                      op: regex\n    \"\"\"\n    RelatedIdsExpression = 'KmsKeyId'\n\n\n@ElasticFileSystem.action_registry.register('delete')\nclass Delete(Action):\n\n    schema = type_schema('delete')\n    permissions = ('elasticfilesystem:DescribeMountTargets',\n                   'elasticfilesystem:DeleteMountTarget',\n                   'elasticfilesystem:DeleteFileSystem')\n\n    def process(self, resources):\n        client = local_session(self.manager.session_factory).client('efs')\n        self.unmount_filesystems(resources)\n        retry = get_retry(('FileSystemInUse',), 12)\n        for r in resources:\n            retry(client.delete_file_system, FileSystemId=r['FileSystemId'])\n\n    def unmount_filesystems(self, resources):\n        client = local_session(self.manager.session_factory).client('efs')\n        for r in resources:\n            if not r['NumberOfMountTargets']:\n                continue\n            for t in client.describe_mount_targets(\n                    FileSystemId=r['FileSystemId'])['MountTargets']:\n                client.delete_mount_target(MountTargetId=t['MountTargetId'])\n", "path": "c7n/resources/efs.py"}], "after_files": [{"content": "# Copyright 2015-2017 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom c7n.actions import Action, BaseAction\nfrom c7n.exceptions import PolicyValidationError\nfrom c7n.filters.kms import KmsRelatedFilter\nfrom c7n.manager import resources\nfrom c7n.filters.vpc import SecurityGroupFilter, SubnetFilter\nfrom c7n.query import QueryResourceManager, ChildResourceManager, TypeInfo\nfrom c7n.tags import universal_augment\nfrom c7n.utils import local_session, type_schema, get_retry\nfrom .aws import shape_validate\n\n\n@resources.register('efs')\nclass ElasticFileSystem(QueryResourceManager):\n\n    class resource_type(TypeInfo):\n        service = 'efs'\n        enum_spec = ('describe_file_systems', 'FileSystems', None)\n        id = 'FileSystemId'\n        name = 'Name'\n        date = 'CreationTime'\n        dimension = 'FileSystemId'\n        arn_type = 'file-system'\n        permission_prefix = arn_service = 'elasticfilesystem'\n        filter_name = 'FileSystemId'\n        filter_type = 'scalar'\n        universal_taggable = True\n\n    augment = universal_augment\n\n\n@resources.register('efs-mount-target')\nclass ElasticFileSystemMountTarget(ChildResourceManager):\n\n    class resource_type(TypeInfo):\n        service = 'efs'\n        parent_spec = ('efs', 'FileSystemId', None)\n        enum_spec = ('describe_mount_targets', 'MountTargets', None)\n        permission_prefix = 'elasticfilesystem'\n        name = id = 'MountTargetId'\n        filter_name = 'MountTargetId'\n        filter_type = 'scalar'\n        arn = False\n\n\n@ElasticFileSystemMountTarget.filter_registry.register('subnet')\nclass Subnet(SubnetFilter):\n\n    RelatedIdsExpression = \"SubnetId\"\n\n\n@ElasticFileSystemMountTarget.filter_registry.register('security-group')\nclass SecurityGroup(SecurityGroupFilter):\n\n    efs_group_cache = None\n\n    RelatedIdsExpression = \"\"\n\n    def get_related_ids(self, resources):\n\n        if self.efs_group_cache:\n            group_ids = set()\n            for r in resources:\n                group_ids.update(\n                    self.efs_group_cache.get(r['MountTargetId'], ()))\n            return list(group_ids)\n\n        client = local_session(self.manager.session_factory).client('efs')\n        groups = {}\n        group_ids = set()\n        retry = get_retry(('Throttled',), 12)\n\n        for r in resources:\n            groups[r['MountTargetId']] = retry(\n                client.describe_mount_target_security_groups,\n                MountTargetId=r['MountTargetId'])['SecurityGroups']\n            group_ids.update(groups[r['MountTargetId']])\n\n        self.efs_group_cache = groups\n        return list(group_ids)\n\n\n@ElasticFileSystem.filter_registry.register('kms-key')\nclass KmsFilter(KmsRelatedFilter):\n    \"\"\"\n    Filter a resource by its associcated kms key and optionally the aliasname\n    of the kms key by using 'c7n:AliasName'\n\n    :example:\n\n        .. code-block:: yaml\n\n            policies:\n                - name: efs-kms-key-filters\n                  resource: efs\n                  filters:\n                    - type: kms-key\n                      key: c7n:AliasName\n                      value: \"^(alias/aws/)\"\n                      op: regex\n    \"\"\"\n    RelatedIdsExpression = 'KmsKeyId'\n\n\n@ElasticFileSystem.action_registry.register('delete')\nclass Delete(Action):\n\n    schema = type_schema('delete')\n    permissions = ('elasticfilesystem:DescribeMountTargets',\n                   'elasticfilesystem:DeleteMountTarget',\n                   'elasticfilesystem:DeleteFileSystem')\n\n    def process(self, resources):\n        client = local_session(self.manager.session_factory).client('efs')\n        self.unmount_filesystems(resources)\n        retry = get_retry(('FileSystemInUse',), 12)\n        for r in resources:\n            retry(client.delete_file_system, FileSystemId=r['FileSystemId'])\n\n    def unmount_filesystems(self, resources):\n        client = local_session(self.manager.session_factory).client('efs')\n        for r in resources:\n            if not r['NumberOfMountTargets']:\n                continue\n            for t in client.describe_mount_targets(\n                    FileSystemId=r['FileSystemId'])['MountTargets']:\n                client.delete_mount_target(MountTargetId=t['MountTargetId'])\n\n\n@ElasticFileSystem.action_registry.register('configure-lifecycle-policy')\nclass ConfigureLifecycle(BaseAction):\n    \"\"\"Enable/disable lifecycle policy for efs.\n\n    :example:\n\n      .. code-block:: yaml\n\n            policies:\n              - name: efs-apply-lifecycle\n                resource: efs\n                actions:\n                  - type: configure-lifecycle-policy\n                    state: enable\n                    rules:\n                      - 'TransitionToIA': 'AFTER_7_DAYS'\n\n    \"\"\"\n    schema = type_schema(\n        'configure-lifecycle-policy',\n        state={'enum': ['enable', 'disable']},\n        rules={\n            'type': 'array',\n            'items': {'type': 'object'}},\n        required=['state'])\n\n    permissions = ('elasticfilesystem:PutLifecycleConfiguration',)\n    shape = 'PutLifecycleConfigurationRequest'\n\n    def validate(self):\n        if self.data.get('state') == 'enable' and 'rules' not in self.data:\n            raise PolicyValidationError(\n                'rules are required to enable lifecycle configuration %s' % (self.manager.data))\n        if self.data.get('state') == 'disable' and 'rules' in self.data:\n            raise PolicyValidationError(\n                'rules not required to disable lifecycle configuration %s' % (self.manager.data))\n        if self.data.get('rules'):\n            attrs = {}\n            attrs['LifecyclePolicies'] = self.data['rules']\n            attrs['FileSystemId'] = 'PolicyValidator'\n            return shape_validate(attrs, self.shape, 'efs')\n\n    def process(self, resources):\n        client = local_session(self.manager.session_factory).client('efs')\n        op_map = {'enable': self.data.get('rules'), 'disable': []}\n        for r in resources:\n            try:\n                client.put_lifecycle_configuration(\n                    FileSystemId=r['FileSystemId'],\n                    LifecyclePolicies=op_map.get(self.data.get('state')))\n            except client.exceptions.FileSystemNotFound:\n                continue\n", "path": "c7n/resources/efs.py"}]}