-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogle_api_client_install_admin
More file actions
35 lines (25 loc) · 1015 Bytes
/
google_api_client_install_admin
File metadata and controls
35 lines (25 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/python
##admin box, (with python, oauth2, google-api-client), talks to google api with python to
##spin up a new instance with apache. quick static server--not as secure and would need mod ssl to be more so
##directory in var/wwww but dj in /opt. oauth2 allows authentication using cloud credentials.
yum -y install git python-pip
pip install upgrade pip
pip install google-api-python-client
pip install oauth2client
exit
#! /usr/bin/python
import argparse
import os
import time
import googleapiclient.discovery
from six.moves import input
from oauth2client.client import GoogleCredentials
from googleapiclient import discovery
project="artful-sled-217801"
zone="us-east1-b"
credentials = GoogleCredentials.get_application_default()
compute = discovery.build('compute', 'v1', credentials=credentials)
def list_instances(compute, project, zone):
result = compute.instances().list(project=project, zone=zone).execute()
return result['items']
print(list_instances(compute,project,zone))