Ejemplo n.º 1
0
def ri_load_parse_save(raw, region, pricing_option, operating_system,
                       purchase_option):
    data_standard_1yr = {}
    data_standard_3yr = {}
    data_convertible_1yr = {}
    data_convertible_3yr = {}

    # get pricing for select region
    raw = utility.get_pricing(region, pricing_option, operating_system)

    data_standard_1yr_nu,\
    data_standard_3yr_nu,\
    data_convertible_1yr_nu,\
    data_convertible_3yr_nu,\
    data_standard_1yr_pu,\
    data_standard_3yr_pu,\
    data_convertible_1yr_pu,\
    data_convertible_3yr_pu,\
    data_standard_1yr_au,\
    data_standard_3yr_au,\
    data_convertible_1yr_au,\
    data_convertible_3yr_au = utility.parse_reserved_instance_pricing(raw)

    if purchase_option == 'nu':
        data_standard_1yr = data_standard_1yr_nu
        data_standard_3yr = data_standard_3yr_nu
        data_convertible_1yr = data_convertible_1yr_nu
        data_convertible_3yr = data_convertible_3yr_nu
    elif purchase_option == 'pu':
        data_standard_1yr = data_standard_1yr_pu
        data_standard_3yr = data_standard_3yr_pu
        data_convertible_1yr = data_convertible_1yr_pu
        data_convertible_3yr = data_convertible_3yr_pu
    else:
        data_standard_1yr = data_standard_1yr_au
        data_standard_3yr = data_standard_3yr_au
        data_convertible_1yr = data_convertible_1yr_au
        data_convertible_3yr = data_convertible_3yr_au

    utility.write_s3_file(
        bucket, 'data/%s/%s/%s-standard-1yr-%s.json' %
        (region, pricing_option, operating_system, purchase_option),
        data_standard_1yr)
    utility.write_s3_file(
        bucket, 'data/%s/%s/%s-standard-3yr-%s.json' %
        (region, pricing_option, operating_system, purchase_option),
        data_standard_3yr)
    utility.write_s3_file(
        bucket, 'data/%s/%s/%s-convertible-1yr-%s.json' %
        (region, pricing_option, operating_system, purchase_option),
        data_convertible_1yr)
    utility.write_s3_file(
        bucket, 'data/%s/%s/%s-convertible-3yr-%s.json' %
        (region, pricing_option, operating_system, purchase_option),
        data_convertible_3yr)
Ejemplo n.º 2
0
def od_load_parse_save(region, pricing_option, operating_system):
    # get pricing for select region
    raw = utility.get_pricing(region, pricing_option, operating_system)

    # parse pricing
    data = utility.parse_ondemand_pricing(raw)

    # write json to S3
    utility.write_s3_file(
        bucket,
        'data/%s/%s/%s.json' % (region, pricing_option, operating_system),
        data)
Ejemplo n.º 3
0
def scrape_reservedinstance_pricing_test(region, operating_system):
    raw = utility.get_pricing(region, 'reserved-instance', operating_system)
    return utility.parse_reserved_instance_pricing(raw)
Ejemplo n.º 4
0
def scrape_ondemand_pricing_test(region, operating_system):
    raw = utility.get_pricing(region, 'ondemand', operating_system)
    return utility.parse_ondemand_pricing(raw)