Skip to content

Instantly share code, notes, and snippets.

@sanketsudake
Created September 17, 2017 16:18
Show Gist options
  • Save sanketsudake/7811a69d6e1f1d4194f8f9b570e4358e to your computer and use it in GitHub Desktop.
Save sanketsudake/7811a69d6e1f1d4194f8f9b570e4358e to your computer and use it in GitHub Desktop.
[WIP] List Google Compute Engine Resources
# pip install google-api-python-client>=1.4.2
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
service_key='service_key.json'
project='myproject'
credentials = GoogleCredentials.from_stream(service_key)
service = build('compute', 'beta', credentials=credentials)
service.machineTypes().list(project=project, zone='us-central1-c').execute()
service.networks().list(project=project, zone='us-central1-c').execute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment