Skip to content

vendor_connectors.google

Google Cloud and Workspace Connector using jbcom ecosystem packages.

GoogleConnectorGoogle Cloud and Workspace base connector.
GoogleConnectorFullFull Google connector with all operations.
DEFAULT_SCOPES

[‘https://www.googleapis.com/auth/cloud-platform’, ‘https://www.googleapis.com/auth/cloud-billing’, …

Bases: vendor_connectors.base.VendorConnectorBase

Google Cloud and Workspace base connector.

This is the base connector class providing:

  • Authentication via service account
  • Service client creation and caching
  • Subject impersonation for domain-wide delegation

Higher-level operations are provided via mixin classes from submodules.

Initialize the Google connector.

Args: service_account_info: Service account JSON as dict or string. If not provided, reads from GOOGLE_SERVICE_ACCOUNT input. scopes: OAuth scopes to request. Defaults to common scopes. subject: Email to impersonate via domain-wide delegation. logger: Optional Logging instance. **kwargs: Additional arguments passed to VendorConnectorBase.

property credentials : google.oauth2.service_account.Credentials

Section titled “property credentials : google.oauth2.service_account.Credentials”

Get or create Google credentials.

Returns: Authenticated service account credentials.

get_credentials_for_subject(subject: str) → google.oauth2.service_account.Credentials

Section titled “get_credentials_for_subject(subject: str) → google.oauth2.service_account.Credentials”

Get credentials impersonating a specific user.

Args: subject: Email address to impersonate.

Returns: Credentials with the specified subject.

Get a connector instance impersonating a specific user.

This is useful for terraform-style operations where you need to perform actions as a specific user rather than the service account.

Args: primary_email: Email address of the user to impersonate. scopes: Optional custom scopes. Defaults to current connector’s scopes.

Returns: A new GoogleConnector instance configured to impersonate the user.

Get a Google API service client.

Args: service_name: Google API service name (e.g., ‘admin’, ‘cloudresourcemanager’). version: API version (e.g., ‘v1’, ‘directory_v1’). subject: Optional subject to impersonate for this service.

Returns: Google API service client.

Get the Admin Directory API service.

Get the Cloud Resource Manager API service.

Get the IAM API service.

Get the Cloud Billing API service.

Get the Compute Engine API service.

Get the GKE API service.

Get the Cloud Storage API service.

Get the Cloud SQL Admin API service.

Get the Pub/Sub API service.

Get the Service Usage API service.

Get the Cloud KMS API service.

Resolve boolean options from parameters or directed inputs.

Resolve list-like options from parameters or directed inputs.

Normalize comma-delimited strings or sequences into clean string lists.

Normalize OrgUnit identifiers to leading-slash paths.

Normalize org unit inputs and discard empties.

Check whether an entry’s org unit is permitted by allow/deny lists.

Detect Google Workspace bot/service accounts.

Flatten the nested name structure for easier downstream consumption.

Convert a list of directory entries into a dictionary keyed by email.

Apply filtering and optional name flattening to directory results.

List users from Google Workspace with optional filtering.

Args: domain: Domain to list users from. max_results: Maximum results per page. ou_allow_list: Only include users from these OUs. ou_deny_list: Exclude users from these OUs. include_suspended: Include suspended users (default False). exclude_bots: Exclude service/bot accounts (default True). flatten_names: Flatten nested name structure (default False). key_by_email: Return dict keyed by email instead of list (default False).

Returns: List of user dicts, or dict keyed by email if key_by_email=True.

List groups from Google Workspace with optional filtering.

Args: domain: Domain to list groups from. max_results: Maximum results per page. ou_allow_list: Only include groups from these OUs. ou_deny_list: Exclude groups from these OUs. include_suspended: Include suspended groups (default False). exclude_bots: Exclude bot groups (default True). flatten_names: Flatten nested name structure (default False). key_by_email: Return dict keyed by email instead of list (default False).

Returns: List of group dicts, or dict keyed by email if key_by_email=True.

Bases: vendor_connectors.google.GoogleConnector, vendor_connectors.google.workspace.GoogleWorkspaceMixin, vendor_connectors.google.cloud.GoogleCloudMixin, vendor_connectors.google.billing.GoogleBillingMixin, vendor_connectors.google.services.GoogleServicesMixin

Full Google connector with all operations.

This class combines the base GoogleConnector with all operation mixins. Use this for full functionality, or use GoogleConnector directly and import specific mixins as needed.

Initialize the Google connector.

Args: service_account_info: Service account JSON as dict or string. If not provided, reads from GOOGLE_SERVICE_ACCOUNT input. scopes: OAuth scopes to request. Defaults to common scopes. subject: Email to impersonate via domain-wide delegation. logger: Optional Logging instance. **kwargs: Additional arguments passed to VendorConnectorBase.