Commit 2b69923b by diegolima

Melhorar tratamento de tipo de produto

1 parent b08cfaad
Showing with 4 additions and 11 deletions
...@@ -2,17 +2,7 @@ import urllib.request ...@@ -2,17 +2,7 @@ import urllib.request
import json import json
import sys import sys
if len(sys.argv) == 1: PRODUCT_TYPE = sys.argv[1] if len(sys.argv) == 2 else 'none'
print('You need to specify a product type', end='\n\n')
print('Supported product types are:')
print('- compute')
print('- database')
exit(1)
PRODUCT_TYPE = sys.argv[1]
if (PRODUCT_TYPE != 'compute') and (PRODUCT_TYPE != 'database'):
print('Product type needs to be either computer or database!')
exit(1)
TERM_ONDEMAND = 'JRTCKXETXF' #Ondemand. TODO: Find out where to get this from TERM_ONDEMAND = 'JRTCKXETXF' #Ondemand. TODO: Find out where to get this from
HOURLY_DIMENSION = '6YS6EN2CT7' #Tier1. TODO: Find out where to get this from HOURLY_DIMENSION = '6YS6EN2CT7' #Tier1. TODO: Find out where to get this from
...@@ -45,6 +35,9 @@ elif PRODUCT_TYPE == 'database': ...@@ -45,6 +35,9 @@ elif PRODUCT_TYPE == 'database':
FCATALOG = 'examples/aws_rds.json' FCATALOG = 'examples/aws_rds.json'
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'
else:
print("Product type not supported")
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())
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!