Class: AwsPricing::Ec2DedicatedHostType

Inherits:
InstanceType show all
Defined in:
lib/amazon-pricing/definitions/ec2-dh-type.rb

Instance Attribute Summary

Attributes inherited from InstanceType

#api_name, #compute_units, #disk_in_gb, #disk_type, #memory_in_mb, #name, #platform, #virtual_cores

Instance Method Summary collapse

Methods inherited from InstanceType

disk_bytes_per_sec_capacity, #disk_in_mb, disk_ops_per_sec_capacity, #get_breakeven_month, #get_category_type, get_descriptive_cache_name, get_descriptive_name, #memory_in_gb, populate_lookups, #prepay, #price_per_hour, service_type

Constructor Details

#initialize(region, family_name) ⇒ Ec2DedicatedHostType

Returns a new instance of Ec2DedicatedHostType.



6
7
8
9
10
11
# File 'lib/amazon-pricing/definitions/ec2-dh-type.rb', line 6

def initialize(region, family_name)
  @category_types = {}
  @region = region
  @name = ''
  @api_name = family_name
end

Instance Method Details

#category_typesObject



13
14
15
# File 'lib/amazon-pricing/definitions/ec2-dh-type.rb', line 13

def category_types
  @category_types
end

#regionObject



17
18
19
# File 'lib/amazon-pricing/definitions/ec2-dh-type.rb', line 17

def region
  @region
end

#update_dh_pricing(operating_system, dhprice) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/amazon-pricing/definitions/ec2-dh-type.rb', line 21

def update_dh_pricing(operating_system, dhprice)
  os = get_category_type(operating_system)
  if os.nil?
    os = OperatingSystem.new(self, operating_system)
    @category_types[operating_system] = os
  end

  category = operating_system.to_s
  values = { category => dhprice }
  price = coerce_price(values[category])
  os.set_price_per_hour(:ondemand, nil, price)
end