Skip to main content

List your GCP Org heirachy as a tree in JSON or Text

Project description

gcptree

Like the unix tree command but for GCP Org Heirarchy.

For a note on coloring, the org node is green, folders and blue, and projects that are not ACTIVE are dimmed. These styles won't show up if you redirect output and Windows is supported by virtue of the colorama package.

Installation

pip install gcptree

Usage

First make sure you are authenticated to gcloud and have your application default credentials set using:

gcloud auth login --update-adc

You just need your org id, which you can find in the GCP console under the popup for picking organizations. It should be a long number around 12 digits or so.

gcptree $ORG_ID

The flags are fairly simple and can be seen with the --help flag.

$ gcptree --help
usage: gcptree [-h] [--format FORMAT] [--full-resource] org_id

Print out a GCP org heirarchy

positional arguments:
  org_id           GCP Organization ID

optional arguments:
  -h, --help       show this help message and exit
  --format FORMAT  Output format (json or text)
  --full-resource  API-parsable nodes where org and folder resource names are not resolved, i.e org/123 instead of example.com

Permissions

The minimum role you'll need at the organization level is:

  • roles/browser

The actual permissions needed (in case you want a custom role) are:

  • resourcemanager.projects.get
  • resourcemanager.projects.list
  • resourcemanager.folders.get
  • resourcemanager.organizations.get

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

gcptree-0.1.3.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file gcptree-0.1.3.tar.gz.

File metadata

  • Download URL: gcptree-0.1.3.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for gcptree-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4ec6d25e8cc55bf83d869902e4dae51240d174b89bccf9a11abbb6c341bc76e9
MD5 3a0461d9f619941b38c1a14a8468a0ed
BLAKE2b-256 ea239d02e6146c7c00030ff8ccfdf3c1f3ae83b369728133040b4e41f2f1a4a0

See more details on using hashes here.

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