Class: AwsPricing::EbsPrice
- Inherits:
-
Object
- Object
- AwsPricing::EbsPrice
- Defined in:
- lib/amazon-pricing/definitions/ebs-price.rb
Instance Attribute Summary collapse
-
#ebs_cold_hdd_per_gb ⇒ Object
Returns the value of attribute ebs_cold_hdd_per_gb.
-
#ebs_optimized_hdd_per_gb ⇒ Object
Returns the value of attribute ebs_optimized_hdd_per_gb.
-
#preferred_per_gb ⇒ Object
Returns the value of attribute preferred_per_gb.
-
#preferred_per_iops ⇒ Object
Returns the value of attribute preferred_per_iops.
-
#s3_snaps_per_gb ⇒ Object
Returns the value of attribute s3_snaps_per_gb.
-
#ssd_per_gb ⇒ Object
Returns the value of attribute ssd_per_gb.
-
#standard_per_gb ⇒ Object
Returns the value of attribute standard_per_gb.
-
#standard_per_million_io ⇒ Object
Returns the value of attribute standard_per_million_io.
Instance Method Summary collapse
-
#initialize(region) ⇒ EbsPrice
constructor
A new instance of EbsPrice.
- #update_from_json(json) ⇒ Object
Constructor Details
#initialize(region) ⇒ EbsPrice
18 19 20 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 18 def initialize(region) #@region = region end |
Instance Attribute Details
#ebs_cold_hdd_per_gb ⇒ Object
Returns the value of attribute ebs_cold_hdd_per_gb.
13 14 15 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 13 def ebs_cold_hdd_per_gb @ebs_cold_hdd_per_gb end |
#ebs_optimized_hdd_per_gb ⇒ Object
Returns the value of attribute ebs_optimized_hdd_per_gb.
13 14 15 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 13 def ebs_optimized_hdd_per_gb @ebs_optimized_hdd_per_gb end |
#preferred_per_gb ⇒ Object
Returns the value of attribute preferred_per_gb.
13 14 15 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 13 def preferred_per_gb @preferred_per_gb end |
#preferred_per_iops ⇒ Object
Returns the value of attribute preferred_per_iops.
13 14 15 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 13 def preferred_per_iops @preferred_per_iops end |
#s3_snaps_per_gb ⇒ Object
Returns the value of attribute s3_snaps_per_gb.
13 14 15 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 13 def s3_snaps_per_gb @s3_snaps_per_gb end |
#ssd_per_gb ⇒ Object
Returns the value of attribute ssd_per_gb.
13 14 15 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 13 def ssd_per_gb @ssd_per_gb end |
#standard_per_gb ⇒ Object
Returns the value of attribute standard_per_gb.
13 14 15 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 13 def standard_per_gb @standard_per_gb end |
#standard_per_million_io ⇒ Object
Returns the value of attribute standard_per_million_io.
13 14 15 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 13 def standard_per_million_io @standard_per_million_io end |
Instance Method Details
#update_from_json(json) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/amazon-pricing/definitions/ebs-price.rb', line 23 def update_from_json(json) json["types"].each do |t| case t["name"] when "Amazon EBS Magnetic volumes" # not supported by aws anymore, replaced by st1 and sc1 @standard_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f @standard_per_million_io = t["values"].select{|v| v["rate"] == "perMMIOreq" }.first["prices"].values.first.to_f when "Amazon EBS Provisioned IOPS SSD (io1) volumes", "ebsPIOPSSSD" @preferred_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f @preferred_per_iops = t["values"].select{|v| v["rate"] == "perPIOPSreq" }.first["prices"].values.first.to_f when "Amazon EBS General Purpose SSD (gp2) volumes", "ebsGPSSD" @ssd_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f when "Amazon EBS Cold HDD (sc1) volumes", "ebsColdHDD" @ebs_cold_hdd_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f when "Amazon EBS Throughput Optimized HDD (st1) volumes", "ebsTOHDD" @ebs_optimized_hdd_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f when "ebsSnapsToS3" @s3_snaps_per_gb = t["values"].select{|v| v["rate"] == "perGBmoDataStored" }.first["prices"].values.first.to_f else puts "[#{__method__}] Unknown EBS type=#{t['name']}, ignoring #{t}." end end end |