Wrapper for Cloud Billing API client.
CloudBillingClient
(global_configs, **kwargs)[source]¶Bases: object
Cloud Billing Client.
get_billing_accounts
(master_account_id=None)[source]¶Gets all billing accounts the authenticated user has access to.
If no master account is specified, then all billing accounts the caller has visibility to are returned. Otherwise retuns all subaccounts of the specified master billing account.
Parameters: | master_account_id (str) – If set, only return subaccounts under this master billing account. |
---|---|
Returns: | A list of BillingAccount resources.
https://cloud.google.com/billing/reference/rest/v1/billingAccounts
} |
Return type: | list |
Raises: | ApiExecutionError – ApiExecutionError is raised if the call to the
GCP API fails. |
get_billing_acct_iam_policies
(account_id)[source]¶Gets the IAM policies for the given billing account.
Parameters: | account_id (str) – The billing account id. |
---|---|
Returns: | An IAM Policy resource.
https://cloud.google.com/billing/reference/rest/v1/Policy
} |
Return type: | dict |
Raises: | ApiExecutionError – ApiExecutionError is raised if the call to the
GCP API fails. |
get_billing_info
(project_id)[source]¶Gets the billing information for a project.
Parameters: | project_id (int) – The project id for a GCP project. |
---|---|
Returns: | A ProjectBillingInfo resource.
https://cloud.google.com/billing/reference/rest/v1/ProjectBillingInfo
} |
Return type: | dict |
Raises: | ApiExecutionError – ApiExecutionError is raised if the call to the
GCP API fails. |
CloudBillingRepositoryClient
(quota_max_calls=None, quota_period=60.0, use_rate_limiter=True)[source]¶Bases: google.cloud.forseti.common.gcp_api._base_repository.BaseRepositoryClient
Cloud Billing API Respository.
billing_accounts
¶Returns a _CloudBillingBillingAccountsRepository instance.
projects
¶Returns a _CloudBillingProjectsRepository instance.
_CloudBillingBillingAccountsRepository
(**kwargs)[source]¶Bases: google.cloud.forseti.common.gcp_api.repository_mixins.GetIamPolicyQueryMixin
, google.cloud.forseti.common.gcp_api.repository_mixins.ListQueryMixin
, google.cloud.forseti.common.gcp_api._base_repository.GCPRepository
Implementation of Cloud Billing BillingAccounts repository.
_CloudBillingProjectsRepository
(**kwargs)[source]¶Bases: google.cloud.forseti.common.gcp_api._base_repository.GCPRepository
Implementation of Cloud Billing Projects repository.