Created
          May 10, 2019 15:09 
        
      - 
      
- 
        Save Chan9390/e639997ad577d1f7499fa1adf5d50857 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | echo Project Name,Disk Name,Source Image | |
| for projectname in `gcloud projects list --format json | jq -r '.[].projectId'`; do | |
| gcloud compute disks list -q --project $projectname --format json | \ | |
| jq -r '.[] | ["\(.name)", "\(.sourceImage)"] | @tsv' | \ | |
| while IFS=$'\t' read -r diskname sourceimage; do | |
| os=`echo $sourceimage | awk -F "/" '{print $NF}'`; | |
| echo $projectname,$diskname,$os; | |
| done; | |
| done | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment