gcptree - Like the unix tree command but for GCP Org Heirarchy

Overview

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
  • roles/cloudasset.viewer
You might also like...
AML Command Transfer. A lightweight tool to transfer any command line to Azure Machine Learning Services

AML Command Transfer (ACT) ACT is a lightweight tool to transfer any command from the local machine to AML or ITP, both of which are Azure Machine Lea

Ros command - Unifying the ROS command line tools
Ros command - Unifying the ROS command line tools

Unifying the ROS command line tools One impairment to ROS 2 adoption is that all

A Python-based command prompt concept which includes windows command emulation.

PythonCMD A Python-based command prompt concept which includes windows command emulation. Current features: echo: Input your message and it will be cl

Make tree planting a part of your daily workflow. 🌳

Continuous Reforestation Make tree planting a part of your daily workflow. 🌳 A GitHub Action for planting trees within your development workflow usin

A selfbot made with DPY, doesn't have much commands but there's some useful commands to use.
A selfbot made with DPY, doesn't have much commands but there's some useful commands to use.

Phantom Selfbot A selfbot made in DPY, made by Zenith. How to use Add your token in token = 'YOUR-MOMS-TOKEN-HERE' Change the prefix in prefix = If

A simple file transfer tools, similar to rz / sz but compatible with tmux (control mode), which works with iTerm2 and has a nice progress bar
A simple file transfer tools, similar to rz / sz but compatible with tmux (control mode), which works with iTerm2 and has a nice progress bar

trzsz A simple file transfer tools, similar to rz/sz but compatible with tmux (control mode), which works with iTerm2 and has a nice progress bar. Why

Simple Tool To Grab Like-Card Coupon
Simple Tool To Grab Like-Card Coupon

Simple Tool To Grab Like-Card Coupon

A linux-like remote terminal for Micropython
A linux-like remote terminal for Micropython

A linux-like remote terminal for Micropython

Python script to tabulate data formats like json, csv, html, etc

pyT PyT is a a command line tool and as well a library for visualising various data formats like: JSON HTML Table CSV XML, etc. Features Print table o

Comments
  • feat: Use CAI instead of CRM

    feat: Use CAI instead of CRM

    Fixes: #4

    Note that project name has changed to support CRM v3, which means format is now projects/NUMBER instead of projects/ID.

    Thanks to u/rosmo on Reddit for pointing out the an assets list feature exists :)

    This feature has a number of improvements:

    • Performance boost due to less round trip API calls thanks to CAI
    • The --no-cache option to manually bust the cache
    • Helpful error message and auto-cache upgrade logic to help migration
    • From now on the pip version will appear in the help message
    opened by onetwopunch 1
  • Initialize data variable

    Initialize data variable

    I was receiving this error on first run -

    Traceback (most recent call last):
      File "/usr/local/bin/gcptree", line 5, in <module>
        Cli().run()
      File "/usr/local/lib/python3.9/site-packages/gcptree/cli.py", line 55, in run
        tree = self.build_tree()
      File "/usr/local/lib/python3.9/site-packages/gcptree/cli.py", line 28, in build_tree
        if t.cache.is_empty():
      File "/usr/local/lib/python3.9/site-packages/gcptree/cache.py", line 23, in is_empty
        return len(self.data) == 0
    AttributeError: 'Cache' object has no attribute 'data'
    

    Added cache data initialization to build the first cache file.

    opened by dgwhited 1
  • Investigate using CAI instead of CRM

    Investigate using CAI instead of CRM

    CAI may give us some benefits over CRM if it can select all projects by an org as opposed to all projects that the authenticated use has access to. This changes the permissions slightly but for multi-org setups, this could be a significant efficiency increase.

    opened by onetwopunch 0
Owner
Ryan Canty
Ryan Canty
gcp-doctor - Diagnostics for Google Cloud Platform

gcp-doctor is a command-line diagnostics tool for GCP customers. It finds and helps to fix common issues in Google Cloud Platform projects. It is used to test projects against a wide range of best-practices and frequent mistakes, based on the troubleshooting experience of the Google Cloud Support team.

Google Cloud Platform 185 Dec 20, 2022
xonsh is a Python-powered, cross-platform, Unix-gazing shell

xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt.

xonsh 6.7k Dec 31, 2022
adds flavor of interactive filtering to the traditional pipe concept of UNIX shell

percol __ ____ ___ ______________ / / / __ \/ _ \/ ___/ ___/ __ \/ / / /_/ / __/ / / /__/ /_/ / / / .__

Masafumi Oyamada 3.2k Jan 7, 2023
A CLI Spigot plugin manager that adheres to Unix conventions and Python best practices.

Spud A cross-platform, Spigot plugin manager that adheres to the Unix philosophy and Python best practices. Some focuses of the project are: Easy and

Tommy Dougiamas 9 Dec 2, 2022
ctree - command line christmas tree

ctree ctree - command line christmas tree It is small python script that prints a christmas tree in terminal. It is colourful and always gives you a d

null 15 Aug 15, 2022
A mini command line tool to spellcheck text files using tadqeek.alsharekh.org

tadqeek_sakhr A mini command line tool to spellcheck text files using tadqeek.alsharekh.org Usage usage: python tadqeek_sakhr.py [-h] -i INPUT [-o OUT

Youssif Shaaban Alsager 5 Dec 11, 2022
A cd command that learns - easily navigate directories from the command line

NAME autojump - a faster way to navigate your filesystem DESCRIPTION autojump is a faster way to navigate your filesystem. It works by maintaining a d

William Ting 14.5k Jan 3, 2023
A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Stream your favorite shows straight from the command line.

A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Installation pip install -r requirements.txt It use

Jonardon Hazarika 17 Dec 11, 2022
commandpack - A package of modules for working with commands, command packages, files with command packages.

commandpack Help the project financially: Donate: https://smartlegion.github.io/donate/ Yandex Money: https://yoomoney.ru/to/4100115206129186 PayPal:

null 4 Sep 4, 2021