Commit 97d0cd51 by diegolima

Mostrar SKUs

1 parent cbb17bec
Showing with 6 additions and 6 deletions
...@@ -39,10 +39,10 @@ else: ...@@ -39,10 +39,10 @@ else:
print("Product type not supported") print("Product type not supported")
sys.exit(1) sys.exit(1)
with urllib.request.urlopen(CATALOG) as url: #with urllib.request.urlopen(CATALOG) as url:
DATA = json.loads(url.read().decode()) # DATA = json.loads(url.read().decode())
# with open(FCATALOG) as url: with open(FCATALOG) as url:
# DATA = json.load(url) DATA = json.load(url)
for product in DATA["products"]: for product in DATA["products"]:
if DATA['products'][product].get('productFamily') == PRODUCT_FAMILY: if DATA['products'][product].get('productFamily') == PRODUCT_FAMILY:
sku = DATA['products'][product].get('sku') sku = DATA['products'][product].get('sku')
...@@ -62,10 +62,10 @@ with urllib.request.urlopen(CATALOG) as url: ...@@ -62,10 +62,10 @@ with urllib.request.urlopen(CATALOG) as url:
else: else:
sharedcores = 'nonshared' sharedcores = 'nonshared'
if DATA['products'][product]['attributes']['tenancy'] == 'Shared': if DATA['products'][product]['attributes']['tenancy'] == 'Shared':
print('aws,%s,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os, sharedcores)) print('aws,%s,%s,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os, sharedcores, sku))
elif PRODUCT_TYPE == 'database': elif PRODUCT_TYPE == 'database':
os = DATA['products'][product]['attributes']['databaseEngine'] os = DATA['products'][product]['attributes']['databaseEngine']
edition = DATA['products'][product]['attributes'].get('databaseEdition') edition = DATA['products'][product]['attributes'].get('databaseEdition')
licensemodel = DATA['products'][product]['attributes']['licenseModel'] licensemodel = DATA['products'][product]['attributes']['licenseModel']
deployment = DATA['products'][product]['attributes']['deploymentOption'] deployment = DATA['products'][product]['attributes']['deploymentOption']
print('aws,%s,%s,%s,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os, edition, licensemodel, deployment)) print('aws,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os, edition, licensemodel, deployment, sku))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!