Skip to main content

A CLI utility to manage Google Cloud Platform resource hierarchy paths.

Project description

gcpath

gcpath is a CLI utility to manage Google Cloud Platform resource hierarchy paths. It helps you translate between GCP resource names (e.g., folders/12345) and human-readable paths (e.g., //example.com/department/team).

Features

  • Recursive Listing: List all folders in your organization as paths.
  • Path Resolution: Get the resource name (ID) for a given path.
  • Reverse Lookup: Get the path for a given resource name (ID).
  • Tree Visualization: View your hierarchy as a tree with depth limits.
  • Dual Mode:
    • Cloud Asset API (Default): Fast, bulk loading using GCP Cloud Asset Inventory.
    • Resource Manager API: Iterative loading using standard Resource Manager API (slower, but different permissions).

Quick Start

After installation, ensure you are authenticated with Google Cloud and have the necessary permissions.

# List all resources
gcpath ls

# List children of a specific folder
gcpath ls folders/123456789

# Find ID of a specific path
gcpath name //example.com/engineering

# Find path of a specific resource ID
gcpath path folders/123456789

# View tree rooted at organization
gcpath tree

# View tree rooted at folder
gcpath tree folders/123456789

Usage

List Resources (ls)

List folders and projects. Defaults to the organization root.

gcpath ls [RESOURCE_NAME]

Options:

  • -l, --long: Show resource IDs and numbers (for projects).
  • -R, --recursive: List resources recursively.

Examples:

# List all organizations and their top-level children
gcpath ls

# List all contents of an organization recursively
gcpath ls -R

# List children of a specific folder
gcpath ls folders/123456789

Tree View (tree)

Visualize the resource hierarchy in a tree format.

gcpath tree [RESOURCE_NAME]

Options:

  • -L, --level N: Limit depth of the tree (max 3).
  • -i, --ids: Include resource IDs in the output.

Get Resource Name (name)

Get the GCP resource name (e.g., folders/123) from a path:

gcpath name //example.com/engineering/backend

To get just the ID:

gcpath name --id //example.com/engineering/backend

Get Path (path)

Get the path from a resource name:

gcpath path folders/987654321

Authentication

gcpath uses Google Cloud Application Default Credentials (ADC).

  1. Install gcloud CLI.
  2. Authenticate:
    gcloud auth application-default login
    

Permissions

  • Cloud Asset API: cloudasset.assets.searchAllResources on the Organization.
  • Resource Manager API: resourcemanager.folders.list and resourcemanager.projects.get.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcpath-0.2.2.tar.gz (60.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcpath-0.2.2-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file gcpath-0.2.2.tar.gz.

File metadata

  • Download URL: gcpath-0.2.2.tar.gz
  • Upload date:
  • Size: 60.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gcpath-0.2.2.tar.gz
Algorithm Hash digest
SHA256 9bb0d8b21c016a585a8db528cd15f5d514ea817816fc5f7de345f03b2f11ad1c
MD5 68d2541eca9990ee7b9b0facc47b1f94
BLAKE2b-256 a29f5d866cfb69f977fb2b865bb27790746c0a0f4195f5cf337e3ddfdff0bafb

See more details on using hashes here.

Provenance

The following attestation bundles were made for gcpath-0.2.2.tar.gz:

Publisher: release.yml on tardigrde/gcpath

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gcpath-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: gcpath-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gcpath-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c45f56a63904dfe0cf978b34735a7ba6bbbb7a2f43af04ee404d38f148aa8657
MD5 b25eb798ab3903915ddf3c0bcebeea5c
BLAKE2b-256 dabba2f1995891b9c03c61b903a9c41418effe2d010c1949cc661de2d4d79130

See more details on using hashes here.

Provenance

The following attestation bundles were made for gcpath-0.2.2-py3-none-any.whl:

Publisher: release.yml on tardigrde/gcpath

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page