class AwsPricing::Ec2DiPriceList

Constants

OD_OS_INDEX
OS_INDEX
RI_OS_INDEX

Public Class Methods

new() click to toggle source
Calls superclass method AwsPricing::PriceList::new
   # File lib/amazon-pricing/ec2-di-price-list.rb
 5 def initialize
 6   super
 7   InstanceType.populate_lookups
 8   get_ec2_di_od_pricing
 9   # assumption is above/di_od populates all InstanceType's, but it missing entries e.g. x1.32xlarge;
10   # the fix is we now allow fetch_ec2_instance_pricing_ri_v2 to add instance_types
11   get_ec2_reserved_di_pricing
12 end

Protected Instance Methods

for_each_os_and_name(os_index, os_name_index) { |os, os_name| ... } click to toggle source
   # File lib/amazon-pricing/ec2-di-price-list.rb
47 def for_each_os_and_name os_index, os_name_index
48   @@OS_TYPES.inject({}) {|h,o| h[o[os_index]]=o[os_name_index];h}.each do |os, os_name|
49     yield os, os_name
50   end
51 end
get_ec2_di_od_pricing() click to toggle source
   # File lib/amazon-pricing/ec2-di-price-list.rb
33 def get_ec2_di_od_pricing
34   for_each_os_and_name(OS_INDEX, OD_OS_INDEX) do |os, os_name|
35     fetch_ec2_instance_pricing(DI_OD_BASE_URL + "di-#{os_name}-od.min.js", :ondemand, os.to_sym)
36   end
37 end
get_ec2_reserved_di_pricing() click to toggle source
   # File lib/amazon-pricing/ec2-di-price-list.rb
39 def get_ec2_reserved_di_pricing
40   for_each_os_and_name(OS_INDEX, RI_OS_INDEX) do |os, os_name|
41     fetch_ec2_instance_pricing_ri_v2(RESERVED_DI_BASE_URL + "#{os_name}-dedicated.min.js", os.to_sym)
42     next if os == 'mswinSQLEnterprise' # No SQL Enterprise for previous generation
43     fetch_ec2_instance_pricing_ri_v2(RESERVED_DI_PREV_GEN_BASE_URL + "#{os_name}-dedicated.min.js", os.to_sym)
44   end
45 end