Repository: cloud-custodian/cloud-custodian

Issue:
codedeploy-group policy failing when run after codedeploy-app and cache enabled
### Describe the bug

When `codedeploy-group`(check for tagging) policy is run after `codedeploy-app`, we're getting an error as mentioned below:
```
botocore.errorfactory.ApplicationDoesNotExistException: An error occurred (ApplicationDoesNotExistException) when calling the ListDeploymentGroups operation: No application found for name: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
```
When these policies are executed with caching disabled, they execute fine

### What did you expect to happen?

I expect the policies to run the same way irrespective of caching enabled or disabled

### Cloud Provider

Amazon Web Services (AWS)

### Cloud Custodian version and dependency information

```shell
c7n:0.9.13
```


### Policy

```shell
policies:
  - name: code-app
    resource: codedeploy-app
  - name: code-group
    resource: aws.codedeploy-group
    filters:
      - not:
        - or:
          - type: value
            key: tag:Owner
            op: regex
            value: xyz
            value_type: normalize
```


### Relevant log/traceback output

```shell
File "/usr/local/lib/python3.7/dist-packages/c7n/policy.py", line 290, in run
    resources = self.policy.resource_manager.resources()
  File "/usr/local/lib/python3.7/dist-packages/c7n/query.py", line 518, in resources
    resources = self.source.resources(query)
  File "/usr/local/lib/python3.7/dist-packages/c7n/query.py", line 223, in resources
    return self.query.filter(self.manager, **query)
  File "/usr/local/lib/python3.7/dist-packages/c7n/query.py", line 156, in filter
    client, enum_op, merged_params, path, retry=self.manager.retry)
  File "/usr/local/lib/python3.7/dist-packages/c7n/query.py", line 56, in _invoke_client_enum
    data = results.build_full_result()
  File "/usr/local/lib/python3.7/dist-packages/botocore/paginate.py", line 449, in build_full_result
    for response in self:
  File "/usr/local/lib/python3.7/dist-packages/botocore/paginate.py", line 255, in __iter__
    response = self._make_request(current_kwargs)
  File "/usr/local/lib/python3.7/dist-packages/c7n/query.py", line 748, in _make_request
    return self.retry(self._method, **current_kwargs)
  File "/usr/local/lib/python3.7/dist-packages/c7n/utils.py", line 446, in _retry
    return func(*args, **kw)
  File "/usr/local/lib/python3.7/dist-packages/botocore/client.py", line 386, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.7/dist-packages/botocore/client.py", line 705, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.ApplicationDoesNotExistException: An error occurred (ApplicationDoesNotExistException) when calling the ListDeploymentGroups operation: No application found for name: xxxxxxxx-1234-1234-xxxx-xxxxxxxxxxxx
```


### Extra information or context

When this is commented out: https://github.com/cloud-custodian/cloud-custodian/blob/master/c7n/resources/code.py#L281
and we do `id=name=applicationName`, policy seems to be working fine. It feels like instead of using `applicationName`, `applicationId` is referenced with list_deployment_groups api


Discussion:
@kapilt , do you mind taking a look whether it makes sense making the above mentioned changes? I can create a quick PR. Thanks
yeah a quick review on codedeploy apis shows that the id here should be applicationName. id is intended to be the common parameter for the resource identity to the api, ie what field does the api use to refer to the resource, not the intrinsic identity of the resource.
Got it, thanks!! PR coming shortly

Resolving patch:
diff --git a/c7n/resources/code.py b/c7n/resources/code.py
--- a/c7n/resources/code.py
+++ b/c7n/resources/code.py
@@ -278,8 +278,7 @@ class resource_type(TypeInfo):
         batch_detail_spec = (
             'batch_get_applications', 'applicationNames',
             None, 'applicationsInfo', None)
-        id = 'applicationId'
-        name = 'applicationName'
+        id = name = 'applicationName'
         date = 'createTime'
         arn_type = "application"
         arn_separator = ":"


Test patch: