Registry / gcp / google-cloud-access-context-manager

google-cloud-access-context-manager

JSON →
library0.6.1pypypi✓ verified 21d ago

Google Cloud Access Context Manager is a Python client library for interacting with the Access Context Manager API. It enables Google Cloud organization administrators to programmatically define fine-grained, attribute-based access control policies, including access levels and service perimeters, for resources within Google Cloud. The library is currently at version 0.4.0 and receives regular updates to align with API evolution and bug fixes.

pip install google-cloud-access-context-manager
INSTALL
IMPORT
SIG · GOOGLE-CLOUD-ACCES
G
google-cloud-access-context-manager
gcppythonv0.6.1
Install
5.3s avg
Import
Disk
67MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 68.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.3s · import 0.000s · 67MB
67MB installed
● package 67MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AccessContextManagerClient
from google.cloud.access_context_manager_v1 import AccessContextManagerClient
from google.cloud import access_context_manager

This quickstart demonstrates how to initialize the `google-cloud-access-context-manager` client and list all Access Policies associated with a specified Google Cloud organization. Ensure the `GOOGLE_CLOUD_ORGANIZATION_ID` environment variable is set and your authentication is configured (e.g., `gcloud auth application-default login`).

import os from google.cloud import accesscontextmanager_v1 def list_access_policies(organization_id: str): """Lists all Access Policies for a given Google Cloud organization. Args: organization_id: The Google Cloud organization ID. """ # Create a client client = accesscontextmanager_v1.AccessContextManagerClient() # The parent format for listing access policies is 'organizations/{organization_id}' parent = f"organizations/{organization_id}" try: print(f"Listing Access Policies for organization: {organization_id}") # The list_access_policies method returns an iterable of policies. for policy in client.list_access_policies(parent=parent): print(f" Policy Name: {policy.name}, Title: {policy.title}") except Exception as e: print(f"An error occurred: {e}") if __name__ == "__main__": # Set your Google Cloud Organization ID as an environment variable # Example: export GOOGLE_CLOUD_ORGANIZATION_ID='1234567890' organization_id = os.environ.get("GOOGLE_CLOUD_ORGANIZATION_ID") if not organization_id: print("ERROR: Please set the 'GOOGLE_CLOUD_ORGANIZATION_ID' environment variable.") print("You can usually find this in the Google Cloud Console or via `gcloud organizations list`.") else: list_access_policies(organization_id)
Debug
Known issues
breakingFrequent and specific `protobuf` version requirements can lead to dependency conflicts, especially when combining with other Google Cloud libraries or third-party tools that pin `protobuf` versions. This library has required `protobuf < 5.0.0` and later `protobuf >=3.20.2, <6`.
fix
Carefully manage your `protobuf` version by checking the `google-cloud-access-context-manager` library's `install_requires` in its `setup.py` or `pyproject.toml` (if available on PyPI) and ensuring compatibility with other installed packages. Use virtual environments to isolate dependencies.
affects: All versions, particularly when upgrading or integrating with other Python packages.
gotchaThis library (and underlying API) is designed for Python 3.9 and higher. Earlier Python versions (e.g., 3.8 and below) are not supported by recent releases, which can cause installation or runtime failures.
fix
Ensure your development and deployment environments are using Python 3.9 or newer. Upgrade your Python interpreter if necessary.
affects: Versions >=0.1.13 officially require Python >=3.7, but current versions from PyPI (e.g., 0.4.0) now specify `>=3.9`.
gotchaThe Access Context Manager API is listed as 'preview' in some Google Cloud documentation contexts, implying that certain features or API surfaces might still be under active development and subject to change without standard deprecation periods.
fix
Be aware of the 'preview' status when building critical systems. Monitor Google Cloud release notes for Access Context Manager for potential changes to APIs you rely on. Implement robust error handling and resilience in your applications.
affects: All versions, as this relates to the underlying API stability.
gotchaManaging Access Policies (creating, updating, deleting) cannot be done directly through the Google Cloud Console. These operations must be performed using the `gcloud` command-line tool or through the Access Context Manager API via this client library.
fix
For administrative tasks on Access Policies, always plan to use either the `gcloud` CLI or programmatically interact via the `google-cloud-access-context-manager` library. Refer to the official Google Cloud documentation for Access Context Manager for management instructions.
affects: All versions.
deprecatedThe original GitHub repository `googleapis/python-access-context-manager` has been archived. Development now occurs within the larger `googleapis/google-cloud-python` monorepo.
fix
Refer to the monorepo at `https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-access-context-manager` for the latest source code, issues, and contributions.
affects: All versions; affects where to find source code and contribute.
Upgrade
Version history
0.6.1latest on PyPI · released Aug 6, 2026
Audit
Dependencies
protobufrequiredCore dependency for Google Cloud client libraries; specific versions often required for compatibility.
google-api-corerequiredProvides core functionalities for Google Cloud client libraries, including API abstractions.
google-authrequiredHandles authentication with Google Cloud services.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
google-cloud-access-context-manager — pip install google-cloud-access-context-manager · libregistry