or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

folders.mdindex.mdorganizations.mdprojects.mdtag-bindings.mdtag-holds.mdtag-keys.mdtag-values.md
tile.json

tessl/pypi-google-cloud-resource-manager

Google Cloud Resource Manager API client library for managing projects, folders, organizations, and tags in Google Cloud Platform

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/google-cloud-resource-manager@1.14.x

To install, run

npx @tessl/cli install tessl/pypi-google-cloud-resource-manager@1.14.0

index.mddocs/

Google Cloud Resource Manager

A comprehensive Python client library for the Google Cloud Resource Manager API, enabling developers to programmatically manage their Google Cloud Platform hierarchy. The library provides methods for creating, updating, and managing projects, folders, organizations, and tagging resources within the Google Cloud resource hierarchy, supporting both synchronous and asynchronous operations.

Package Information

  • Package Name: google-cloud-resource-manager
  • Language: Python
  • Installation: pip install google-cloud-resource-manager
  • Supported Python Versions: 3.7+

Core Imports

from google.cloud import resourcemanager

For specific service clients:

from google.cloud.resourcemanager import (
    ProjectsClient,
    FoldersClient,
    OrganizationsClient,
    TagKeysClient,
    TagValuesClient,
    TagBindingsClient,
    TagHoldsClient
)

For async clients:

from google.cloud.resourcemanager import (
    ProjectsAsyncClient,
    FoldersAsyncClient,
    OrganizationsAsyncClient,
    TagKeysAsyncClient,
    TagValuesAsyncClient,
    TagBindingsAsyncClient,
    TagHoldsAsyncClient
)

Basic Usage

from google.cloud.resourcemanager import ProjectsClient

# Initialize the client (uses default credentials)
client = ProjectsClient()

# Get a project
project = client.get_project(name="projects/my-project-id")
print(f"Project: {project.display_name}")

# List projects under an organization
for project in client.list_projects(parent="organizations/123456789"):
    print(f"Project: {project.project_id} - {project.display_name}")

# Create a new project
from google.cloud.resourcemanager_v3.types import Project

new_project = Project(
    project_id="my-new-project",
    display_name="My New Project",
    parent="organizations/123456789"
)

operation = client.create_project(project=new_project)
result = operation.result()  # Wait for completion
print(f"Created project: {result.project_id}")

Architecture

The Google Cloud Resource Manager API is organized around a hierarchical resource structure and tagging system:

Resource Hierarchy

  • Organizations: Root-level container for all Google Cloud resources
  • Folders: Intermediate grouping mechanism within organizations
  • Projects: Fundamental organizational unit containing Google Cloud resources

Tagging System

  • TagKeys: Define tag categories (e.g., "environment", "team")
  • TagValues: Define specific values within tag categories (e.g., "production", "development")
  • TagBindings: Associate TagValues with specific cloud resources
  • TagHolds: Prevent TagValue deletion by creating dependencies

Client Design

Each resource type has dedicated synchronous and asynchronous client classes with consistent patterns:

  • CRUD operations (Create, Read, Update, Delete)
  • Long-running operations for create/update/delete/move operations
  • IAM policy management
  • Pagination support for list operations
  • Search functionality where applicable

Capabilities

Projects Management

Comprehensive project lifecycle management including creation, updates, hierarchy management, and deletion/restoration. Projects serve as the fundamental organizational unit for Google Cloud resources.

class ProjectsClient:
    def get_project(
        self,
        request: GetProjectRequest = None,
        *,
        name: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> Project: ...
    
    def list_projects(
        self,
        request: ListProjectsRequest = None,
        *,
        parent: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> pagers.ListProjectsPager: ...
    
    def create_project(
        self,
        request: CreateProjectRequest = None,
        *,
        project: Project = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> operation.Operation: ...

Projects Management

Folders Management

Hierarchical organization and management of folders within organizations, providing an intermediate grouping layer between organizations and projects.

class FoldersClient:
    def get_folder(
        self,
        request: GetFolderRequest = None,
        *,
        name: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> Folder: ...
    
    def create_folder(
        self,
        request: CreateFolderRequest = None,
        *,
        folder: Folder = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> operation.Operation: ...

Folders Management

Organizations Management

Read-only access to organization information and search capabilities. Organizations represent the root-level container in the Google Cloud resource hierarchy.

class OrganizationsClient:
    def get_organization(
        self,
        request: GetOrganizationRequest = None,
        *,
        name: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> Organization: ...
    
    def search_organizations(
        self,
        request: SearchOrganizationsRequest = None,
        *,
        query: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> pagers.SearchOrganizationsPager: ...

Organizations Management

Tag Keys Management

Management of tag categories that define the taxonomy for organizing and controlling Google Cloud resources through policy and automation.

class TagKeysClient:
    def get_tag_key(
        self,
        request: GetTagKeyRequest = None,
        *,
        name: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> TagKey: ...
    
    def create_tag_key(
        self,
        request: CreateTagKeyRequest = None,
        *,
        tag_key: TagKey = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> operation.Operation: ...

Tag Keys Management

Tag Values Management

Management of specific values within tag categories, providing the actual tags that can be applied to Google Cloud resources.

class TagValuesClient:
    def get_tag_value(
        self,
        request: GetTagValueRequest = None,
        *,
        name: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> TagValue: ...
    
    def create_tag_value(
        self,
        request: CreateTagValueRequest = None,
        *,
        tag_value: TagValue = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> operation.Operation: ...

Tag Values Management

Tag Bindings Management

Association and management of tag values with specific Google Cloud resources, including listing effective tags that apply to resources through inheritance.

class TagBindingsClient:
    def create_tag_binding(
        self,
        request: CreateTagBindingRequest = None,
        *,
        tag_binding: TagBinding = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> operation.Operation: ...
    
    def list_effective_tags(
        self,
        request: ListEffectiveTagsRequest = None,
        *,
        parent: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> pagers.ListEffectiveTagsPager: ...

Tag Bindings Management

Tag Holds Management

Protection mechanism for tag values by creating holds that prevent deletion, ensuring critical tags remain available for policy enforcement and resource organization.

class TagHoldsClient:
    def create_tag_hold(
        self,
        request: CreateTagHoldRequest = None,
        *,
        parent: str = None,
        tag_hold: TagHold = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> operation.Operation: ...
    
    def list_tag_holds(
        self,
        request: ListTagHoldsRequest = None,
        *,
        parent: str = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
    ) -> pagers.ListTagHoldsPager: ...

Tag Holds Management

Common Types

# Core resource types
class Project:
    name: str
    project_id: str
    display_name: str
    parent: str
    state: Project.State
    labels: MutableMapping[str, str]
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    delete_time: timestamp_pb2.Timestamp
    etag: str

class Folder:
    name: str
    parent: str
    display_name: str
    state: Folder.State
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    delete_time: timestamp_pb2.Timestamp
    etag: str

class Organization:
    name: str
    display_name: str
    directory_customer_id: str
    state: Organization.State
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    delete_time: timestamp_pb2.Timestamp
    etag: str

# Tag-related types
class TagKey:
    name: str
    parent: str
    short_name: str
    namespaced_name: str
    display_name: str
    description: str
    purpose: Purpose
    purpose_data: MutableMapping[str, str]
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    etag: str

class TagValue:
    name: str
    parent: str
    short_name: str
    namespaced_name: str
    display_name: str
    description: str
    create_time: timestamp_pb2.Timestamp
    update_time: timestamp_pb2.Timestamp
    etag: str

class TagBinding:
    name: str
    parent: str
    tag_value: str
    tag_value_namespaced_name: str

class TagHold:
    name: str
    holder: str
    origin: str
    help_link: str
    create_time: timestamp_pb2.Timestamp

# Long-running operation type
from google.api_core.operation import Operation