]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - python/list_servers.py
Merge branch 'dev'
[perso/Immae/Projets/Puppet.git] / python / list_servers.py
1 try:
2 from ovh import ovh
3 except ImportError:
4 # In case it's installed globally
5 import ovh
6
7 client = ovh.Client()
8
9 print("OVH cloud instances:")
10 projects_list = client.get('/cloud/project/')
11 for project_id in projects_list:
12 project = client.get('/cloud/project/{}'.format(project_id))
13 print("\t{}:".format(project["description"]))
14 instances_list = client.get('/cloud/project/{}/instance'.format(project_id))
15 for instance in instances_list:
16 print("\t\t{}: {}".format(instance["name"], instance["id"]))
17
18 vps_list = client.get('/vps/')
19
20 print("OVH VPS SSD servers:")
21 for vps in vps_list:
22 print("\t{}".format(vps))
23