class AwsPricing::ElastiCachePriceList
Public Class Methods
new()
click to toggle source
Calls superclass method
AwsPricing::PriceList::new
# File lib/amazon-pricing/elasticache-price-list.rb 4 def initialize 5 super 6 get_elasticache_on_demand_node_pricing 7 get_elasticache_reserved_node_pricing 8 end
Protected Instance Methods
fetch_on_demand_elasticache_node_pricing(url, cache_type)
click to toggle source
# File lib/amazon-pricing/elasticache-price-list.rb 37 def fetch_on_demand_elasticache_node_pricing(url, cache_type) 38 res = PriceList.fetch_url(url) 39 res['config']['regions'].each do |reg| 40 region_name = reg['region'] 41 region = get_region(region_name) 42 if region.nil? 43 $stderr.puts "[fetch_elasticache_od_node_pricing] WARNING: unable to find region #{region_name}" 44 next 45 end # region.nil? 46 47 reg['types'].each do |type| 48 name = type['name'] 49 50 type['tiers'].each do |tier| 51 begin 52 api_name = tier['name'] 53 node_type = region.add_or_update_elasticache_node_type(api_name, name) 54 node_type.update_pricing(cache_type, :ondemand, tier) 55 rescue UnknownTypeError 56 $stderr.puts "[fetch_on_demand_elasticache_node_pricing] WARNING: encountered #{$!.message}" 57 end # begin 58 end # do |tier| 59 end # do |type| 60 end # do |reg| 61 end
fetch_reserved_elasticache_node_pricing(url, cache_type)
click to toggle source
# File lib/amazon-pricing/elasticache-price-list.rb 63 def fetch_reserved_elasticache_node_pricing(url, cache_type) 64 res = PriceList.fetch_url(url) 65 res['config']['regions'].each do |reg| 66 region_name = reg['region'] 67 region = get_region(region_name) 68 if region.nil? 69 $stderr.puts "[fetch_elasticache_rc_node_pricing] WARNING: unable to find region #{region_name}" 70 next 71 end #region.nil? 72 73 reg['instanceTypes'].each do |type| 74 name = type['generation'] 75 type['tiers'].each do |tier| 76 begin 77 api_name = tier['size'] 78 node_type = region.add_or_update_elasticache_node_type(api_name, name) 79 node_type.update_pricing(cache_type, :partialupfront, tier) 80 rescue UnknownTypeError 81 $stderr.puts "[fetch_reserved_rds_instance_pricing] WARNING: encountered #{$!.message}" 82 end 83 end # do |tier| 84 end # do |type| 85 end # do |reg| 86 end
get_elasticache_on_demand_node_pricing()
click to toggle source
# File lib/amazon-pricing/elasticache-price-list.rb 15 def get_elasticache_on_demand_node_pricing 16 od_url = ELASTICACHE_BASE_URL + "pricing-standard-deployments-elasticache.min.js" 17 od_legacy_url = ELASTICACHE_BASE_URL + "previous-generation/pricing-standard-deployments-elasticache.min.js" 18 @@CACHE_TYPES.each do |type| 19 fetch_on_demand_elasticache_node_pricing(od_url, type) 20 21 # fetch again for legacy prices 22 fetch_on_demand_elasticache_node_pricing(od_legacy_url, type) 23 end 24 end
get_elasticache_reserved_node_pricing()
click to toggle source
# File lib/amazon-pricing/elasticache-price-list.rb 26 def get_elasticache_reserved_node_pricing 27 rc_url = ELASTICACHE_BASE_URL + "pricing-elasticache-heavy-standard-deployments.min.js" 28 rc_legacy_url = ELASTICACHE_BASE_URL + "previous-generation/pricing-elasticache-heavy-standard-deployments.min.js" 29 @@CACHE_TYPES.each do |type| 30 fetch_reserved_elasticache_node_pricing(rc_url, type) 31 32 # fetch again for legacy prices 33 fetch_reserved_elasticache_node_pricing(rc_legacy_url, type) 34 end 35 end