A CLI utility to manage Google Cloud Platform resource hierarchy paths.
Project description
gcpath
gcpath is a CLI utility to query 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).
Why should I use gcpath?
- familiar linux-like CLI
- you can stay in the terminal for quick resource hierarchy lookups
- no need to learn the complex
gcloudinterface - look-up only commands, so coding agents can't do harm using it
Features
- Tree Visualization: View your hierarchy as a tree.
- Recursive Listing: List all folders and projects 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).
- 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).
Roadmap
- caching, for lightning fast lookups
- diagram generation
- entrypoint configuration (organization or folder)
- IAM policies
- other resources
Prerequisites
Authentication
gcpath uses Google Cloud Application Default Credentials (ADC).
-
Install gcloud CLI.
-
Authenticate:
gcloud auth application-default login
Permissions
Ensure you have enough permissions on your entrypoint (organization or folder), see API modes.
Quick Start
# 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 (no limit by default).-i, --ids: Include resource IDs in the output.-y, --yes: Skip confirmation prompts for large hierarchy loads.
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
API Modes
gcpath supports two GCP APIs for loading resource hierarchy data:
Cloud Asset API (Default - Recommended)
Fast bulk loading via Cloud Asset Inventory. Recommended for most users.
# Use Cloud Asset API (default)
gcpath ls
gcpath ls --use-asset-api # explicit
gcpath ls -u # short form
Advantages:
- 5-6x faster than Resource Manager API
- Supports scoped loading (
ls folders/123,tree folders/123) - Efficient for large hierarchies (1000+ folders)
Required Permissions:
cloudasset.assets.searchAllResourcesresourcemanager.organizations.getresourcemanager.folders.getresourcemanager.projects.get
Setup: Requires Cloud Asset API to be enabled: gcloud services enable cloudasset.googleapis.com
Resource Manager API
Traditional recursive API calls. Use when Cloud Asset API is not available.
# Use Resource Manager API
gcpath ls --no-use-asset-api
gcpath ls -U # short form
Advantages:
- Works without Cloud Asset API enabled
- Simpler permission model
- Standard
resourcemanager.*permissions
Required Permissions:
resourcemanager.organizations.getresourcemanager.folders.listresourcemanager.projects.listresourcemanager.projects.get
Which Should I Use?
- For most users: Use the default (Cloud Asset API) for best performance
- If you get permission/API errors: Use
-Uflag for Resource Manager API
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gcpath-0.2.3.tar.gz.
File metadata
- Download URL: gcpath-0.2.3.tar.gz
- Upload date:
- Size: 67.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4534a0474a8d3dcc180d255f30b5c68e141ebaee0043ab01ddf7ef5d953f2303
|
|
| MD5 |
7a97017fe3479b2d7d6582c33299807a
|
|
| BLAKE2b-256 |
352c527671d2892e24f80e1123de1be1658452bfd84e60ff531504f5428d01a3
|
Provenance
The following attestation bundles were made for gcpath-0.2.3.tar.gz:
Publisher:
release.yml on tardigrde/gcpath
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gcpath-0.2.3.tar.gz -
Subject digest:
4534a0474a8d3dcc180d255f30b5c68e141ebaee0043ab01ddf7ef5d953f2303 - Sigstore transparency entry: 776205926
- Sigstore integration time:
-
Permalink:
tardigrde/gcpath@763378c3839c120d161e1d1225df009eda73c15a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tardigrde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@763378c3839c120d161e1d1225df009eda73c15a -
Trigger Event:
push
-
Statement type:
File details
Details for the file gcpath-0.2.3-py3-none-any.whl.
File metadata
- Download URL: gcpath-0.2.3-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60810c32afa143ff08b53f9526c3fc05673ec16e75aadcebbd160d5e5540b38d
|
|
| MD5 |
0fe7dcadd31b2ba44e1962618e306691
|
|
| BLAKE2b-256 |
aa3c529e871fdd239d650e61bde3b9f07d1db1b0628f002419b5f3c297e05473
|
Provenance
The following attestation bundles were made for gcpath-0.2.3-py3-none-any.whl:
Publisher:
release.yml on tardigrde/gcpath
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gcpath-0.2.3-py3-none-any.whl -
Subject digest:
60810c32afa143ff08b53f9526c3fc05673ec16e75aadcebbd160d5e5540b38d - Sigstore transparency entry: 776205930
- Sigstore integration time:
-
Permalink:
tardigrde/gcpath@763378c3839c120d161e1d1225df009eda73c15a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tardigrde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@763378c3839c120d161e1d1225df009eda73c15a -
Trigger Event:
push
-
Statement type: