vendor_connectors.google.billing
Google Cloud Billing operations.
This module provides operations for managing Google Cloud billing accounts and project billing associations.
Module Contents
Section titled “Module Contents”Classes
Section titled “Classes”GoogleBillingMixin | Mixin providing Google Cloud Billing operations. |
|---|
class vendor_connectors.google.billing.GoogleBillingMixin
Section titled “class vendor_connectors.google.billing.GoogleBillingMixin”Mixin providing Google Cloud Billing operations.
This mixin requires the base GoogleConnector class to provide:
- get_billing_service()
- logger
list_billing_accounts(filter_query: str | None = None, unhump_accounts: bool = False) → list[dict[str, Any]]
Section titled “list_billing_accounts(filter_query: str | None = None, unhump_accounts: bool = False) → list[dict[str, Any]]”List Google Cloud billing accounts.
Args: filter_query: Optional filter query string. unhump_accounts: Convert keys to snake_case. Defaults to False.
Returns: List of billing account dictionaries.
get_billing_account(billing_account_id: str) → dict[str, Any] | None
Section titled “get_billing_account(billing_account_id: str) → dict[str, Any] | None”Get a specific billing account.
Args: billing_account_id: The billing account ID.
Returns: Billing account dictionary or None if not found.
get_project_billing_info(project_id: str) → dict[str, Any] | None
Section titled “get_project_billing_info(project_id: str) → dict[str, Any] | None”Get billing info for a project.
Args: project_id: The project ID.
Returns: Billing info dictionary or None if not set.
update_project_billing_info(project_id: str, billing_account_name: str) → dict[str, Any]
Section titled “update_project_billing_info(project_id: str, billing_account_name: str) → dict[str, Any]”Link a project to a billing account.
Args: project_id: The project ID. billing_account_name: Billing account name (billingAccounts/ACCOUNT_ID).
Returns: Updated billing info dictionary.
disable_project_billing(project_id: str) → dict[str, Any]
Section titled “disable_project_billing(project_id: str) → dict[str, Any]”Disable billing for a project.
Args: project_id: The project ID.
Returns: Updated billing info dictionary.
list_billing_account_projects(billing_account_id: str, unhump_projects: bool = False) → list[dict[str, Any]]
Section titled “list_billing_account_projects(billing_account_id: str, unhump_projects: bool = False) → list[dict[str, Any]]”List projects linked to a billing account.
Args: billing_account_id: The billing account ID. unhump_projects: Convert keys to snake_case. Defaults to False.
Returns: List of project billing info dictionaries.
get_billing_account_iam_policy(billing_account_id: str) → dict[str, Any]
Section titled “get_billing_account_iam_policy(billing_account_id: str) → dict[str, Any]”Get IAM policy for a billing account.
Args: billing_account_id: The billing account ID.
Returns: IAM policy dictionary.
set_billing_account_iam_policy(billing_account_id: str, policy: dict[str, Any]) → dict[str, Any]
Section titled “set_billing_account_iam_policy(billing_account_id: str, policy: dict[str, Any]) → dict[str, Any]”Set IAM policy for a billing account.
Args: billing_account_id: The billing account ID. policy: IAM policy dictionary.
Returns: Updated IAM policy dictionary.
get_bigquery_billing_dataset(project_id: str, dataset_id: str = ‘billing_export’) → dict[str, Any] | None
Section titled “get_bigquery_billing_dataset(project_id: str, dataset_id: str = ‘billing_export’) → dict[str, Any] | None”Get BigQuery billing export dataset configuration.
Args: project_id: The project ID containing the billing dataset. dataset_id: The dataset ID. Defaults to ‘billing_export’.
Returns: Dataset configuration dict or None if not found.
setup_billing_export(billing_account_id: str, project_id: str, dataset_id: str = ‘billing_export’, location: str = ‘US’) → dict[str, Any]
Section titled “setup_billing_export(billing_account_id: str, project_id: str, dataset_id: str = ‘billing_export’, location: str = ‘US’) → dict[str, Any]”Set up BigQuery billing export for a billing account.
Creates the dataset if it doesn’t exist and returns configuration.
Args: billing_account_id: The billing account ID. project_id: Project to create the export dataset in. dataset_id: Dataset ID to use. Defaults to ‘billing_export’. location: Dataset location. Defaults to ‘US’.
Returns: Configuration dict with dataset info.