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).
- 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
# Find ID of a specific path
gcpath name //example.com/engineering
# Find path of a specific resource ID
gcpath path folders/123456789
Authentication
gcpath uses Google Cloud Application Default Credentials (ADC).
Setup
- Install gcloud CLI.
- Authenticate:
gcloud auth application-default login
For service accounts in CI/CD environments:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
Usage
List Folders
Recursively list all folders in your organization(s):
gcpath ls
Output:
//example.com/engineering
//example.com/engineering/backend
//example.com/sales
...
You can also filter by organization display name:
gcpath ls "example.com"
Get Resource Name
Get the GCP resource name (e.g., folders/123) from a path:
gcpath name //example.com/engineering/backend
# Output: folders/987654321
To get just the ID:
gcpath name --id //example.com/engineering/backend
# Output: 987654321
Get Path
Get the path from a resource name:
gcpath path folders/987654321
# Output: //example.com/engineering/backend
Tree View
Visualize the hierarchy in a tree format:
gcpath tree
Options:
-L, --level N: Limit depth of the tree.-i, --ids: Include resource IDs in the output.
Modes
By default, gcpath uses the Cloud Asset API which is faster for large hierarchies.
To force using the Resource Manager API (iterative), use the -U / --no-use-asset-api flag:
gcpath ls -U
Permissions
Cloud Asset API (Default)
Requires cloudasset.assets.searchAllResources permission on the Organization.
Resource Manager API
Requires resourcemanager.folders.list on the Organization and folders.
Development
Prerequisites: uv (https://github.com/astral-sh/uv).
- Clone the repository.
- Install dependencies:
uv sync - Run tests:
uv run pytest
License
MIT
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.1.0.tar.gz.
File metadata
- Download URL: gcpath-0.1.0.tar.gz
- Upload date:
- Size: 46.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa27022c1dcd2b49a652260a3f69a8fb0512b3f40c20047bfa38625636b80d9d
|
|
| MD5 |
a4913b5d939e31fae41e14c311b414fe
|
|
| BLAKE2b-256 |
e943a144465494dab64be14e38977e8a4963823f5bc5b852422d567af6a6fd48
|
Provenance
The following attestation bundles were made for gcpath-0.1.0.tar.gz:
Publisher:
ci.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.1.0.tar.gz -
Subject digest:
fa27022c1dcd2b49a652260a3f69a8fb0512b3f40c20047bfa38625636b80d9d - Sigstore transparency entry: 774455604
- Sigstore integration time:
-
Permalink:
tardigrde/gcpath@fba48b3f8d0330f84db3a5274c416ce40138cab2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tardigrde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@fba48b3f8d0330f84db3a5274c416ce40138cab2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gcpath-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gcpath-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.6 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 |
c8fc75834c4498052f1187af8aae4685f3fe422eea69fe9cc3dcfe5b0c6b04e0
|
|
| MD5 |
bc93f71725356657c684cd0ce5453245
|
|
| BLAKE2b-256 |
4e42eac95ec78aa29c1ba3919c3333d52ddf5d421fecff2f2afda63376177246
|
Provenance
The following attestation bundles were made for gcpath-0.1.0-py3-none-any.whl:
Publisher:
ci.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.1.0-py3-none-any.whl -
Subject digest:
c8fc75834c4498052f1187af8aae4685f3fe422eea69fe9cc3dcfe5b0c6b04e0 - Sigstore transparency entry: 774455605
- Sigstore integration time:
-
Permalink:
tardigrde/gcpath@fba48b3f8d0330f84db3a5274c416ce40138cab2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tardigrde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@fba48b3f8d0330f84db3a5274c416ce40138cab2 -
Trigger Event:
push
-
Statement type: