-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsl_getInventory.py
More file actions
63 lines (41 loc) · 1.14 KB
/
sl_getInventory.py
File metadata and controls
63 lines (41 loc) · 1.14 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'takechika'
import SoftLayer
import sluser
SL_USERNAME = sluser.SL_USERNAME
SL_API_KEY = sluser.SL_API_KEY
client = SoftLayer.Client(username=SL_USERNAME, api_key=SL_API_KEY)
### Data Center
print("### Data Center and Region ###")
dataCenters = client['Location'].getDatacenters()
for dc in dataCenters:
# print(dc)
address = client['Location'].getLocationAddress(id=dc['id'])
region = client['Location'].getRegions(id=dc['id'])
print(dc, region, address)
print()
### PoP
print("### PoP ###")
pops = client['Location'].getpointOfPresence()
for pop in pops:
print(pop)
print()
### Object Storage Datacenter
print("### Object Storage ###")
objectStorages = client['Location'].getAvailableObjectStorageDatacenters()
for os in objectStorages:
print(os)
print()
exit()
### Data Center
_vg_mask = '''
id,
fullyQualifiedDomainName,
location.pathString'''
virtualGuests = client['Account'].getVirtualGuests(mask=_vg_mask)
for vg in virtualGuests:
print(vg['id'],
vg['fullyQualifiedDomainName'],
vg['location']['pathString'] )
exit()