vendor_fabric.google.billing

Google Cloud Billing operations.

This module provides operations for managing Google Cloud billing accounts and project billing associations.

Module Contents

Classes

GoogleBillingMixin

Mixin providing Google Cloud Billing operations.

API

class vendor_fabric.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) extended_data.containers.ExtendedList[extended_data.containers.ExtendedDict]

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) extended_data.containers.ExtendedDict | 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) extended_data.containers.ExtendedDict | 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) extended_data.containers.ExtendedDict

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) extended_data.containers.ExtendedDict

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) extended_data.containers.ExtendedList[extended_data.containers.ExtendedDict]

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) extended_data.containers.ExtendedDict

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]) extended_data.containers.ExtendedDict

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') extended_data.containers.ExtendedDict | 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') extended_data.containers.ExtendedDict

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.