Class: AwsPricing::Region
- Inherits:
-
Object
- Object
- AwsPricing::Region
- Defined in:
- lib/amazon-pricing/definitions/region.rb
Overview
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
Instance Attribute Summary collapse
-
#ebs_price ⇒ Object
Returns the value of attribute ebs_price.
-
#ec2_dh_types ⇒ Object
Returns the value of attribute ec2_dh_types.
-
#ec2_instance_types ⇒ Object
Returns the value of attribute ec2_instance_types.
-
#elasticache_node_types ⇒ Object
Returns the value of attribute elasticache_node_types.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rds_instance_types ⇒ Object
Returns the value of attribute rds_instance_types.
Instance Method Summary collapse
- #add_or_update_ec2_dh_type(family) ⇒ Object
-
#add_or_update_ec2_instance_type(api_name, name) ⇒ Object
type_of_instance = :ondemand, :light, :medium, :heavy.
- #add_or_update_elasticache_node_type(api_name, name) ⇒ Object
- #add_or_update_rds_instance_type(api_name, name) ⇒ Object
- #get_ec2_dh_type(family) ⇒ Object
- #get_ec2_instance_type(api_name) ⇒ Object
- #get_elasticache_node_type(api_name) ⇒ Object
-
#get_instance_type(api_name) ⇒ Object
Maintained for backward compatibility reasons (retrieves EC2 instance type).
- #get_rds_instance_type(api_name) ⇒ Object
-
#initialize(name) ⇒ Region
constructor
A new instance of Region.
-
#instance_type_available?(api_name, type_of_instance = :ondemand, operating_system = :linux) ⇒ Boolean
Returns whether an instance_type is available.
-
#instance_types ⇒ Object
Maintained for backward compatibility reasons (retrieves EC2 instance type).
Constructor Details
#initialize(name) ⇒ Region
Returns a new instance of Region.
20 21 22 23 24 25 26 |
# File 'lib/amazon-pricing/definitions/region.rb', line 20 def initialize(name) @name = name @ec2_instance_types = {} @rds_instance_types = {} @elasticache_node_types = {} @ec2_dh_types = {} end |
Instance Attribute Details
#ebs_price ⇒ Object
Returns the value of attribute ebs_price.
18 19 20 |
# File 'lib/amazon-pricing/definitions/region.rb', line 18 def ebs_price @ebs_price end |
#ec2_dh_types ⇒ Object
Returns the value of attribute ec2_dh_types.
18 19 20 |
# File 'lib/amazon-pricing/definitions/region.rb', line 18 def ec2_dh_types @ec2_dh_types end |
#ec2_instance_types ⇒ Object
Returns the value of attribute ec2_instance_types.
18 19 20 |
# File 'lib/amazon-pricing/definitions/region.rb', line 18 def ec2_instance_types @ec2_instance_types end |
#elasticache_node_types ⇒ Object
Returns the value of attribute elasticache_node_types.
18 19 20 |
# File 'lib/amazon-pricing/definitions/region.rb', line 18 def elasticache_node_types @elasticache_node_types end |
#name ⇒ Object
Returns the value of attribute name.
18 19 20 |
# File 'lib/amazon-pricing/definitions/region.rb', line 18 def name @name end |
#rds_instance_types ⇒ Object
Returns the value of attribute rds_instance_types.
18 19 20 |
# File 'lib/amazon-pricing/definitions/region.rb', line 18 def rds_instance_types @rds_instance_types end |
Instance Method Details
#add_or_update_ec2_dh_type(family) ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/amazon-pricing/definitions/region.rb', line 86 def add_or_update_ec2_dh_type(family) current = get_ec2_dh_type(family) if current.nil? current = Ec2DedicatedHostType.new(self, family) @ec2_dh_types[family] = current end current end |
#add_or_update_ec2_instance_type(api_name, name) ⇒ Object
type_of_instance = :ondemand, :light, :medium, :heavy
59 60 61 62 63 64 65 66 |
# File 'lib/amazon-pricing/definitions/region.rb', line 59 def add_or_update_ec2_instance_type(api_name, name) current = get_ec2_instance_type(api_name) if current.nil? current = Ec2InstanceType.new(self, api_name, name) @ec2_instance_types[api_name] = current end current end |
#add_or_update_elasticache_node_type(api_name, name) ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/amazon-pricing/definitions/region.rb', line 77 def add_or_update_elasticache_node_type(api_name, name) current = get_elasticache_node_type(api_name) if current.nil? current = ElastiCacheNodeType.new(self, api_name, name) @elasticache_node_types[api_name] = current end current end |
#add_or_update_rds_instance_type(api_name, name) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/amazon-pricing/definitions/region.rb', line 68 def add_or_update_rds_instance_type(api_name, name) current = get_rds_instance_type(api_name) if current.nil? current = RdsInstanceType.new(self, api_name, name) @rds_instance_types[api_name] = current end current end |
#get_ec2_dh_type(family) ⇒ Object
112 113 114 |
# File 'lib/amazon-pricing/definitions/region.rb', line 112 def get_ec2_dh_type(family) @ec2_dh_types[family] end |
#get_ec2_instance_type(api_name) ⇒ Object
100 101 102 |
# File 'lib/amazon-pricing/definitions/region.rb', line 100 def get_ec2_instance_type(api_name) @ec2_instance_types[api_name] end |
#get_elasticache_node_type(api_name) ⇒ Object
108 109 110 |
# File 'lib/amazon-pricing/definitions/region.rb', line 108 def get_elasticache_node_type(api_name) @elasticache_node_types[api_name] end |
#get_instance_type(api_name) ⇒ Object
Maintained for backward compatibility reasons (retrieves EC2 instance type)
96 97 98 |
# File 'lib/amazon-pricing/definitions/region.rb', line 96 def get_instance_type(api_name) get_ec2_instance_type(api_name) end |
#get_rds_instance_type(api_name) ⇒ Object
104 105 106 |
# File 'lib/amazon-pricing/definitions/region.rb', line 104 def get_rds_instance_type(api_name) @rds_instance_types[api_name] end |
#instance_type_available?(api_name, type_of_instance = :ondemand, operating_system = :linux) ⇒ Boolean
Returns whether an instance_type is available. operating_system = :linux, :mswin, :rhel, :sles, :mswinSQL, :mswinSQLWeb type_of_instance = :ondemand, :light, :medium, :heavy
52 53 54 55 56 |
# File 'lib/amazon-pricing/definitions/region.rb', line 52 def instance_type_available?(api_name, type_of_instance = :ondemand, = :linux) instance = @ec2_instance_types[api_name] return false if instance.nil? instance.available?(type_of_instance, ) end |
#instance_types ⇒ Object
Maintained for backward compatibility reasons (retrieves EC2 instance type)
29 30 31 |
# File 'lib/amazon-pricing/definitions/region.rb', line 29 def instance_types ec2_instance_types end |