class AwsPricing::Region

Region represents a geographic area in which Amazon Web Services has one or more data centers. Different regions will offer difference services and pricing.

e.g. us-east, us-west

Attributes

ebs_price[RW]
ec2_dh_types[RW]
ec2_instance_types[RW]
elasticache_node_types[RW]
name[RW]
rds_instance_types[RW]

Public Class Methods

new(name) click to toggle source
   # File lib/amazon-pricing/definitions/region.rb
20 def initialize(name)
21   @name = name
22   @ec2_instance_types     = {}
23   @rds_instance_types     = {}
24   @elasticache_node_types = {}
25   @ec2_dh_types           = {}
26 end

Public Instance Methods

add_or_update_ec2_dh_type(family) click to toggle source
   # File lib/amazon-pricing/definitions/region.rb
86 def add_or_update_ec2_dh_type(family)
87   current = get_ec2_dh_type(family)
88   if current.nil?
89     current = Ec2DedicatedHostType.new(self, family)
90     @ec2_dh_types[family] = current
91   end
92   current
93 end
add_or_update_ec2_instance_type(api_name, name) click to toggle source

type_of_instance = :ondemand, :light, :medium, :heavy

   # File lib/amazon-pricing/definitions/region.rb
59 def add_or_update_ec2_instance_type(api_name, name)
60   current = get_ec2_instance_type(api_name)
61   if current.nil?
62     current = Ec2InstanceType.new(self, api_name, name)
63     @ec2_instance_types[api_name] = current
64   end
65   current
66 end
add_or_update_elasticache_node_type(api_name, name) click to toggle source
   # File lib/amazon-pricing/definitions/region.rb
77 def add_or_update_elasticache_node_type(api_name, name)
78   current = get_elasticache_node_type(api_name)
79   if current.nil?
80     current = ElastiCacheNodeType.new(self, api_name, name)
81     @elasticache_node_types[api_name] = current
82   end
83   current
84 end
add_or_update_rds_instance_type(api_name, name) click to toggle source
   # File lib/amazon-pricing/definitions/region.rb
68 def add_or_update_rds_instance_type(api_name, name)
69   current = get_rds_instance_type(api_name)
70   if current.nil?
71     current = RdsInstanceType.new(self, api_name, name)
72     @rds_instance_types[api_name] = current
73   end
74   current
75 end
get_ec2_dh_type(family) click to toggle source
    # File lib/amazon-pricing/definitions/region.rb
112 def get_ec2_dh_type(family)
113   @ec2_dh_types[family]
114 end
get_ec2_instance_type(api_name) click to toggle source
    # File lib/amazon-pricing/definitions/region.rb
100 def get_ec2_instance_type(api_name)
101   @ec2_instance_types[api_name]
102 end
get_elasticache_node_type(api_name) click to toggle source
    # File lib/amazon-pricing/definitions/region.rb
108 def get_elasticache_node_type(api_name)
109   @elasticache_node_types[api_name]
110 end
get_instance_type(api_name) click to toggle source

Maintained for backward compatibility reasons (retrieves EC2 instance type)

   # File lib/amazon-pricing/definitions/region.rb
96 def get_instance_type(api_name)
97   get_ec2_instance_type(api_name)
98 end
get_rds_instance_type(api_name) click to toggle source
    # File lib/amazon-pricing/definitions/region.rb
104 def get_rds_instance_type(api_name)
105   @rds_instance_types[api_name]
106 end
instance_type_available?(api_name, type_of_instance = :ondemand, operating_system = :linux) click to toggle source

Returns whether an instance_type is available. operating_system = :linux, :mswin, :rhel, :sles, :mswinSQL, :mswinSQLWeb type_of_instance = :ondemand, :light, :medium, :heavy

   # File lib/amazon-pricing/definitions/region.rb
52 def instance_type_available?(api_name, type_of_instance = :ondemand, operating_system = :linux)
53   instance = @ec2_instance_types[api_name]
54   return false if instance.nil?
55   instance.available?(type_of_instance, operating_system)
56 end
instance_types() click to toggle source

Maintained for backward compatibility reasons (retrieves EC2 instance type)

   # File lib/amazon-pricing/definitions/region.rb
29 def instance_types
30   ec2_instance_types
31 end