Skip to content

Commit

Permalink
Merge pull request #43 from newscorp-ghfb/story/PE-7241_enable_truste…
Browse files Browse the repository at this point in the history
…d_advisor_integration

PE-7340: Enable trusted advisor integration
  • Loading branch information
iamgeef authored Oct 16, 2024
2 parents e645d96 + 0d5ad0e commit ec077b9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
6 changes: 4 additions & 2 deletions c7n/resources/resource_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"aws.acm-certificate": "c7n.resources.acm.Certificate",
"aws.airflow": "c7n.resources.airflow.ApacheAirflow",
"aws.alarm": "c7n.resources.cw.Alarm",
"aws.advisor-check": "c7n.resources.support.AdvisorCheck",
"aws.ami": "c7n.resources.ami.AMI",
"aws.apigwv2": "c7n.resources.apigw.ApiGwV2",
"aws.apigw-domain-name": "c7n.resources.apigw.CustomDomainName",
Expand Down Expand Up @@ -71,7 +72,8 @@
"aws.eks-nodegroup": "c7n.resources.eks.NodeGroup",
"aws.elasticbeanstalk": "c7n.resources.elasticbeanstalk.ElasticBeanstalk",
"aws.elasticbeanstalk-environment": (
"c7n.resources.elasticbeanstalk.ElasticBeanstalkEnvironment"),
"c7n.resources.elasticbeanstalk.ElasticBeanstalkEnvironment"
),
"aws.elasticache-group": "c7n.resources.elasticache.ElastiCacheReplicationGroup",
"aws.elasticsearch": "c7n.resources.elasticsearch.ElasticSearchDomain",
"aws.elasticsearch-reserved": "c7n.resources.elasticsearch.ReservedInstances",
Expand Down Expand Up @@ -225,5 +227,5 @@
"aws.waf-regional": "c7n.resources.waf.RegionalWAF",
"aws.workspaces": "c7n.resources.workspaces.Workspace",
"aws.workspaces-directory": "c7n.resources.workspaces.WorkspaceDirectory",
"aws.workspaces-image": "c7n.resources.workspaces.WorkspaceImage"
"aws.workspaces-image": "c7n.resources.workspaces.WorkspaceImage",
}
31 changes: 30 additions & 1 deletion c7n/resources/support.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n.manager import resources
from c7n.query import QueryResourceManager, TypeInfo
from c7n.query import QueryResourceManager, TypeInfo, DescribeSource
from c7n.utils import local_session, get_support_region


Expand All @@ -22,3 +22,32 @@ class resource_type(TypeInfo):
def get_client(self):
region = get_support_region(self)
return local_session(self.session_factory).client('support', region_name=region)


class DescribeAdvisorCheck(DescribeSource):
def resources(self, query):
if not query:
query = {'language': 'en'}
return super().resources(query)


@resources.register("advisor-check")
class AdvisorCheck(QueryResourceManager):

class resource_type(TypeInfo):
service = "support"
enum_spec = ('describe_trusted_advisor_checks', 'checks', None)
detail_spec = (
'describe_trusted_advisor_check_result',
'checkId',
'id',
'result',
)
arn_type = "checks"
arn_service = "trustedadvisor"
name = id = "checkId"
universal_taggable = object()

source_mapping = {
"describe": DescribeAdvisorCheck,
}

0 comments on commit ec077b9

Please sign in to comment.