# Buggy code
def get_resources(self, resource_ids):
    client = local_session(self.manager.session_factory).client("es")
    return client.describe_elasticsearch_domains(DomainNames=resource_ids)[
        "DomainStatusList"
    ]


# Traceback (botocore.exceptions.ParamValidationError)
2020-06-30T07:11:16.082-07:00
	
START RequestId: <sorry> Version: $LATEST
	
2020-06-30T07:11:16.731-07:00
	
[INFO]	2020-06-30T14:11:16.730Z	<sorry>	Processing event
 
{
    "version": "0",
    "id": "<sorry>",
    "detail-type": "AWS API Call via CloudTrail",
    "source": "aws.es",
    "account": "<sorry>",
    "time": "2020-06-30T14:10:46Z",
    "region": "us-east-1",
    "resources": [],
    "detail": {
        "eventVersion": "1.05",
        "userIdentity": {
            "type": "AssumedRole",
            "principalId": "<sorry>",
            "arn": "arn:aws:sts::<sorry>",
            "accountId": "<sorry>",
            "accessKeyId": "<sorry>",
            "sessionContext": {
                "sessionIssuer": {
                    "type": "Role",
                    "principalId": "<sorry>",
                    "arn": "arn:aws:iam::<sorry>",
                    "accountId": "<sorry>",
                    "userName": "<sorry>"
                },
                "webIdFederationData": {},
                "attributes": {
                    "mfaAuthenticated": "false",
                    "creationDate": "2020-06-30T13:59:53Z"
                }
            }
        },
        "eventTime": "2020-06-30T14:10:46Z",
        "eventSource": "es.amazonaws.com",
        "eventName": "CreateElasticsearchDomain",
        "awsRegion": "us-east-1",
        "sourceIPAddress": "<sorry>",
        "userAgent": "aws-internal/3 aws-sdk-java/1.11.753 Linux/4.9.217-0.1.ac.205.84.332.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.242-b08 java/1.8.0_242 vendor/Oracle_Corporation",
        "requestParameters": {
            "elasticsearchVersion": "7.4",
            "vPCOptions": {
                "subnetIds": [
                    "subnet-<sorry>"
                ],
                "securityGroupIds": [
                    "sg-<sorry>"
                ]
            },
            "nodeToNodeEncryptionOptions": {
                "enabled": true
            },
            "snapshotOptions": {},
            "domainEndpointOptions": {
                "enforceHTTPS": true
            },
            "encryptionAtRestOptions": {
                "enabled": false
            },
            "eBSOptions": {
                "eBSEnabled": true,
                "volumeSize": 10,
                "volumeType": "gp2"
            },
            "advancedOptions": {
                "rest.action.multi.allow_explicit_index": "true"
            },
            "elasticsearchClusterConfig": {
                "zoneAwarenessEnabled": false,
                "instanceType": "r5.large.elasticsearch",
                "dedicatedMasterEnabled": false,
                "instanceCount": 1
            },
            "domainName": "not-rest-encrypted",
            "accessPolicies": "<sorry>"
        },
        "responseElements": {
            "domainStatus": {
                "created": true,
                "serviceSoftwareOptions": {
                    "description": "There is no software update available for this domain.",
                    "optionalDeployment": true,
                    "currentVersion": "",
                    "newVersion": "",
                    "updateAvailable": false,
                    "automatedUpdateDate": "Dec 31, 1969 4:00:00 PM",
                    "updateStatus": "COMPLETED",
                    "cancellable": false
                },
                "domainEndpointOptions": {
                    "enforceHTTPS": true,
                    "tLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07"
                },
                "elasticsearchClusterConfig": {
                    "zoneAwarenessEnabled": false,
                    "instanceType": "r5.large.elasticsearch",
                    "dedicatedMasterEnabled": false,
                    "instanceCount": 1,
                    "warmEnabled": false
                },
                "cognitoOptions": {
                    "enabled": false
                },
                "encryptionAtRestOptions": {
                    "enabled": false
                },
                "advancedOptions": {
                    "rest.action.multi.allow_explicit_index": "true"
                },
                "upgradeProcessing": false,
                "snapshotOptions": {},
                "eBSOptions": {
                    "eBSEnabled": true,
                    "volumeSize": 10,
                    "volumeType": "gp2"
                },
                "elasticsearchVersion": "7.4",
                "vPCOptions": {
                    "vPCId": "vpc-<sorry>",
                    "availabilityZones": [
                        "us-east-1a"
                    ],
                    "securityGroupIds": [
                        "sg-<sorry>"
                    ],
                    "subnetIds": [
                        "subnet-<sorry>"
                    ]
                },
                "nodeToNodeEncryptionOptions": {
                    "enabled": true
                },
                "processing": true,
                "aRN": "arn:aws:es:us-east-1:<sorry>:domain/not-rest-encrypted",
                "domainId": "<sorry>/not-rest-encrypted",
                "deleted": false,
                "domainName": "not-rest-encrypted",
                "accessPolicies": "<sorry>",
                "advancedSecurityOptions": {
                    "internalUserDatabaseEnabled": false,
                    "enabled": false
                }
            }
        },
        "requestID": "<sorry>",
        "eventID": "<sorry>",
        "eventType": "AwsApiCall"
    },
    "debug": true
}

	
2020-06-30T07:11:16.731-07:00
	
[DEBUG]	2020-06-30T14:11:16.731Z	6f9ce181-bead-4ae0-a0d3-27b1c55c01e4	Disabling cache
	
2020-06-30T07:11:16.731-07:00
	
[WARNING]	2020-06-30T14:11:16.731Z	6f9ce181-bead-4ae0-a0d3-27b1c55c01e4	Custodian reserves policy lambda tags starting with custodian - policy specifies custodian-info
	
2020-06-30T07:11:16.731-07:00
	
[INFO]	2020-06-30T14:11:16.731Z	6f9ce181-bead-4ae0-a0d3-27b1c55c01e4	Found resource ids:['not-rest-encrypted']
	
2020-06-30T07:11:17.066-07:00
	
[ERROR]	2020-06-30T14:11:17.60Z	6f9ce181-bead-4ae0-a0d3-27b1c55c01e4	error during policy execution
Traceback (most recent call last):
  File "/var/task/c7n/handler.py", line 176, in dispatch_event
    p.push(event, context)
  File "/var/task/c7n/policy.py", line 1135, in push
    return mode.run(event, lambda_ctx)
  File "/var/task/c7n/policy.py", line 444, in run
    resources = self.resolve_resources(event)
  File "/var/task/c7n/policy.py", line 639, in resolve_resources
    return super().resolve_resources(event)
  File "/var/task/c7n/policy.py", line 426, in resolve_resources
    resources = self.policy.resource_manager.get_resources(resource_ids)
  File "/var/task/c7n/query.py", line 545, in get_resources
    resources = self.augment(resources)
  File "/var/task/c7n/query.py", line 557, in augment
    return self.source.augment(resources)
  File "/var/task/c7n/resources/elasticsearch.py", line 50, in augment
    results.extend(_augment(resource_set))
  File "/var/task/c7n/resources/elasticsearch.py", line 40, in _augment
    resources = self.manager.retry(
  File "/var/task/c7n/utils.py", line 373, in _retry
    return func(*args, **kw)
  File "/var/runtime/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/var/runtime/botocore/client.py", line 598, in _make_api_call
    request_dict = self._convert_to_request_dict(
  File "/var/runtime/botocore/client.py", line 646, in _convert_to_request_dict
    request_dict = self._serializer.serialize_to_request(
  File "/var/runtime/botocore/validate.py", line 297, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter DomainNames[0], value: {'DomainId': '<sorry>/not-rest-encrypted', 'DomainName': 'not-rest-encrypted', 'ARN': 'arn:aws:es:us-east-1:<sorry>:domain/not-rest-encrypted', 'Created': True, 'Deleted': False, 'Processing': True, 'UpgradeProcessing': False, 'ElasticsearchVersion': '7.4', 'ElasticsearchClusterConfig': {'InstanceType': 'r5.large.elasticsearch', 'InstanceCount': 1, 'DedicatedMasterEnabled': False, 'ZoneAwarenessEnabled': False, 'WarmEnabled': False}, 'EBSOptions': {'EBSEnabled': True, 'VolumeType': 'gp2', 'VolumeSize': 10}, 'AccessPolicies': '{"Version":"2012-10-17","Statement":[{<sorry>"}]}', 'SnapshotOptions': {}, 'VPCOptions': {'VPCId': 'vpc-<sorry>', 'SubnetIds': ['subnet-<sorry>'], 'AvailabilityZones': ['us-east-1a'], 'SecurityGroupIds': ['sg-<sorry>']}, 'CognitoOptions': {'Enabled': False}, 'EncryptionAtRestOptions': {'Enabled': False}, 'NodeToNodeEncryptionOptions': {'Enabled': True}, 'AdvancedOptions': {'rest.action.multi.allow_explicit_index': 'true'}, 'ServiceSoftwareOptions': {'CurrentVersion': '', 'NewVersion': '', 'UpdateAvailable': False, 'Cancellable': False, 'UpdateStatus': 'COMPLETED', 'Description': 'There is no software update available for this domain.', 'AutomatedUpdateDate': datetime.datetime(1970, 1, 1, 0, 0, tzinfo=tzlocal()), 'OptionalDeployment': True}, 'DomainEndpointOptions': {'EnforceHTTPS': True, 'TLSSecurityPolicy': 'Policy-Min-TLS-1-0-2019-07'}, 'AdvancedSecurityOptions': {'Enabled': False, 'InternalUserDatabaseEnabled': False}}, type: <class 'dict'>, valid types: <class 'str'>
	
2020-06-30T07:11:17.067-07:00
	
[ERROR] ParamValidationError: Parameter validation failed:
Invalid type for parameter DomainNames[0], value: {'DomainId': '<sorry>/not-rest-encrypted', 'DomainName': 'not-rest-encrypted', 'ARN': 'arn:aws:es:us-east-1:<sorry>:domain/not-rest-encrypted', 'Created': True, 'Deleted': False, 'Processing': True, 'UpgradeProcessing': False, 'ElasticsearchVersion': '7.4', 'ElasticsearchClusterConfig': {'InstanceType': 'r5.large.elasticsearch', 'InstanceCount': 1, 'DedicatedMasterEnabled': False, 'ZoneAwarenessEnabled': False, 'WarmEnabled': False}, 'EBSOptions': {'EBSEnabled': True, 'VolumeType': 'gp2', 'VolumeSize': 10}, 'AccessPolicies': '{"Version":"2012-10-17","Statement":[{<sorry>}]}', 'SnapshotOptions': {}, 'VPCOptions': {'VPCId': 'vpc-<sorry>', 'SubnetIds': ['subnet-<sorry>'], 'AvailabilityZones': ['us-east-1a'], 'SecurityGroupIds': ['sg-<sorry>']}, 'CognitoOptions': {'Enabled': False}, 'EncryptionAtRestOptions': {'Enabled': False}, 'NodeToNodeEncryptionOptions': {'Enabled': True}, 'AdvancedOptions': {'rest.action.multi.allow_explicit_index': 'true'}, 'ServiceSoftwareOptions': {'CurrentVersion': '', 'NewVersion': '', 'UpdateAvailable': False, 'Cancellable': False, 'UpdateStatus': 'COMPLETED', 'Description': 'There is no software update available for this domain.', 'AutomatedUpdateDate': datetime.datetime(1970, 1, 1, 0, 0, tzinfo=tzlocal()), 'OptionalDeployment': True}, 'DomainEndpointOptions': {'EnforceHTTPS': True, 'TLSSecurityPolicy': 'Policy-Min-TLS-1-0-2019-07'}, 'AdvancedSecurityOptions': {'Enabled': False, 'InternalUserDatabaseEnabled': False}}, type: <class 'dict'>, valid types: <class 'str'>
Traceback (most recent call last):
  File "/var/task/custodian_policy.py", line 4, in run
    return handler.dispatch_event(event, context)
  File "/var/task/c7n/handler.py", line 176, in dispatch_event
    p.push(event, context)
  File "/var/task/c7n/policy.py", line 1135, in push
    return mode.run(event, lambda_ctx)
  File "/var/task/c7n/policy.py", line 444, in run
    resources = self.resolve_resources(event)
  File "/var/task/c7n/policy.py", line 639, in resolve_resources
    return super().resolve_resources(event)
  File "/var/task/c7n/policy.py", line 426, in resolve_resources
    resources = self.policy.resource_manager.get_resources(resource_ids)
  File "/var/task/c7n/query.py", line 545, in get_resources
    resources = self.augment(resources)
  File "/var/task/c7n/query.py", line 557, in augment
    return self.source.augment(resources)
  File "/var/task/c7n/resources/elasticsearch.py", line 50, in augment
    results.extend(_augment(resource_set))
  File "/var/task/c7n/resources/elasticsearch.py", line 40, in _augment
    resources = self.manager.retry(
  File "/var/task/c7n/utils.py", line 373, in _retry
    return func(*args, **kw)
  File "/var/runtime/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/var/runtime/botocore/client.py", line 598, in _make_api_call
    request_dict = self._convert_to_request_dict(
  File "/var/runtime/botocore/client.py", line 646, in _convert_to_request_dict
    request_dict = self._serializer.serialize_to_request(
  File "/var/runtime/botocore/validate.py", line 297, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
	
2020-06-30T07:11:17.069-07:00
	
END RequestId: <sorry>
	
2020-06-30T07:11:17.069-07:00
	
REPORT RequestId: <sorry>	Duration: 986.45 ms	Billed Duration: 1000 ms	Memory Size: 512 MB	Max Memory Used: 81 MB	Init Duration: 414.96 ms	

# Fixed code
def get_resources(self, resource_ids):
    # augment will turn these into resource dictionaries
    return resource_ids