Created
September 17, 2017 16:18
-
-
Save sanketsudake/7811a69d6e1f1d4194f8f9b570e4358e to your computer and use it in GitHub Desktop.
[WIP] List Google Compute Engine Resources
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
# 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