Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/c7n_gcp/resources/cloudbilling.py: 95%
21 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
1# Copyright The Cloud Custodian Authors.
2# SPDX-License-Identifier: Apache-2.0
3from c7n_gcp.provider import resources
4from c7n_gcp.query import QueryResourceManager, TypeInfo
6from c7n.utils import jmespath_search
8@resources.register('cloudbilling-account')
9class CloudBillingAccount(QueryResourceManager):
11 class resource_type(TypeInfo):
12 service = 'cloudbilling'
13 version = 'v1'
14 component = 'billingAccounts'
15 enum_spec = ('list', 'billingAccounts[]', None)
16 get_requires_event = True
17 scope = None
18 name = id = 'name'
19 default_report_fields = ['name', 'displayName']
20 asset_type = "cloudbilling.googleapis.com/BillingAccount"
21 permissions = ('billing.accounts.list',)
22 urn_component = "account"
23 urn_id_segments = (-1,) # Just use the last segment of the id in the URN
25 @staticmethod
26 def get(client, event):
27 return client.execute_query(
28 'get', {'name': jmespath_search(
29 'protoPayload.response.billingAccountInfo.billingAccountName', event)})