Commit e3487b4a by Diego Lima

Adicionar informacoes de compartilhamento de nucleos

1 parent 8999c2d1
Showing with 10 additions and 5 deletions
...@@ -47,10 +47,10 @@ elif PRODUCT_TYPE == 'database': ...@@ -47,10 +47,10 @@ elif PRODUCT_TYPE == 'database':
CATALOG = 'https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonRDS/current/index.json' CATALOG = 'https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonRDS/current/index.json'
PRODUCT_FAMILY = 'Database Instance' PRODUCT_FAMILY = 'Database Instance'
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')
...@@ -64,8 +64,13 @@ with urllib.request.urlopen(CATALOG) as url: ...@@ -64,8 +64,13 @@ with urllib.request.urlopen(CATALOG) as url:
memory = str(DATA['products'][product]['attributes']['memory']).replace(',','') memory = str(DATA['products'][product]['attributes']['memory']).replace(',','')
if PRODUCT_TYPE == 'compute': if PRODUCT_TYPE == 'compute':
os = DATA['products'][product]['attributes']['operatingSystem'] os = DATA['products'][product]['attributes']['operatingSystem']
family = str(name[:1])
if family == 't':
sharedcores = 'shared'
else:
sharedcores = 'nonshared'
if DATA['products'][product]['attributes']['tenancy'] == 'Shared': if DATA['products'][product]['attributes']['tenancy'] == 'Shared':
print('aws,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os)) print('aws,%s,%s,%s,%s,%s,%s,%s' % (name, cpu, memory, cost, region, os, sharedcores))
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')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!