amazon-pricing 0.1.75 → 0.1.76

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YWU5NmE4N2NiY2I0MDAyMzNkZGIwOGRiNDU4YmIyMzI5NzRkNTRkMg==
5
- data.tar.gz: !binary |-
6
- NmEzYzg0ZGI2Mzk5NDhjYmFiMWVmNTYzYTQ0MjM2NDQ3MzNmM2E0ZQ==
2
+ SHA1:
3
+ metadata.gz: d472ba3a48cd3e5079c816df71dbe2249607e02a
4
+ data.tar.gz: 53d480512cdc7347d27ed0e5bc07b0791b8a91db
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZWVjOWQwYzIzZjdkYTY2ZWNmNGZjZGIzMTg0MGUyYjQ4OTgxMjNkOTk1ZDgz
10
- NWUzOTBjYWRjYzI1MWU5NjA1YjZmNWNkMjU4NzIwY2Q3MDYzMTc5OWU0ZDUw
11
- MmZmMWNkYzQzNzEzZjUxMzcwNDUzN2M0ZjU4ZmEwZTdiMTgxYjY=
12
- data.tar.gz: !binary |-
13
- YzI4N2E1NWNhNGEyZmY1ODgzZjVhYzI5ZjAzMzU1N2M3YjUxNzgzM2JiZTZm
14
- MGMxMDYzYmI2ZjhlNTdmODE2NWU2NmQ0MGY0Y2YyYjZmNzFmNWZlM2EzNGU5
15
- OWQzNWQ5MjllODQzNjI2Zjc1YzIyZmVmOTk0Njg4NzM1Y2E4NDQ=
6
+ metadata.gz: f37dfa9dc471b49204323ea8d631ab5ef1b5364e6fb692223ef56594afe5d43386b49cae7bcd43ba34274308ed56e259cf8ef4122d5b67d7c57d3305da008d92
7
+ data.tar.gz: a09e9a05ca0f7a82f4a5e665bc8f77b946226890d073e60c88ab9feff1bb491f9dc808779546aefedc9b5cc1f99b3c3c2721403cbd522de905ef6f7a72adbe1d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- amazon-pricing (0.1.75)
4
+ amazon-pricing (0.1.76)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -12,7 +12,8 @@ module AwsPricing
12
12
  class EbsPrice
13
13
  attr_accessor :standard_per_gb, :standard_per_million_io, :s3_snaps_per_gb,
14
14
  :preferred_per_gb, :preferred_per_iops,
15
- :ssd_per_gb
15
+ :ssd_per_gb,
16
+ :ebs_cold_hdd_per_gb, :ebs_optimized_hdd_per_gb
16
17
 
17
18
  def initialize(region)
18
19
  #@region = region
@@ -22,14 +23,18 @@ module AwsPricing
22
23
  def update_from_json(json)
23
24
  json["types"].each do |t|
24
25
  case t["name"]
25
- when "Amazon EBS Magnetic volumes"
26
+ when "Amazon EBS Magnetic volumes" # not supported by aws anymore, replaced by st1 and sc1
26
27
  @standard_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f
27
28
  @standard_per_million_io = t["values"].select{|v| v["rate"] == "perMMIOreq" }.first["prices"].values.first.to_f
28
- when "Amazon EBS Provisioned IOPS (SSD) volumes"
29
+ when "Amazon EBS Provisioned IOPS SSD (io1) volumes"
29
30
  @preferred_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f
30
31
  @preferred_per_iops = t["values"].select{|v| v["rate"] == "perPIOPSreq" }.first["prices"].values.first.to_f
31
- when "Amazon EBS General Purpose (SSD) volumes"
32
+ when "Amazon EBS General Purpose SSD (gp2) volumes"
32
33
  @ssd_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f
34
+ when "Amazon EBS Cold HDD (sc1) volumes"
35
+ @ebs_cold_hdd_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f
36
+ when "Amazon EBS Throughput Optimized HDD (st1) volumes"
37
+ @ebs_optimized_hdd_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f
33
38
  when "ebsSnapsToS3"
34
39
  @s3_snaps_per_gb = t["values"].select{|v| v["rate"] == "perGBmoDataStored" }.first["prices"].values.first.to_f
35
40
  end
@@ -59,16 +59,20 @@ module AwsPricing
59
59
  end
60
60
 
61
61
  def fetch_ec2_ebs_pricing
62
- res = PriceList.fetch_url(EBS_BASE_URL + "pricing-ebs.min.js")
63
- res["config"]["regions"].each do |ebs_types|
64
- region_name = ebs_types["region"]
62
+ res_current = PriceList.fetch_url(EBS_BASE_URL + "pricing-ebs.min.js")
63
+ res_previous = PriceList.fetch_url(EBS_BASE_URL + "pricing-ebs-previous-generation.min.js")
64
+ res_current["config"]["regions"].each do |region_types_current|
65
+ region_name = region_types_current["region"]
65
66
  region = get_region(region_name)
66
67
  if region.nil?
67
68
  $stderr.puts "[fetch_ec2_ebs_pricing] WARNING: unable to find region #{region_name}"
68
69
  next
69
70
  end
71
+ region_previous = res_previous["config"]["regions"]
72
+ region_types_previous = region_previous.select{|rp| region_name == rp["region"]}.first
70
73
  region.ebs_price = EbsPrice.new(region)
71
- region.ebs_price.update_from_json(ebs_types)
74
+ region.ebs_price.update_from_json(region_types_current)
75
+ region.ebs_price.update_from_json(region_types_previous)
72
76
  end
73
77
  end
74
78
 
@@ -8,5 +8,5 @@
8
8
  # Home:: http://github.com/CloudHealth/amazon-pricing
9
9
  #++
10
10
  module AwsPricing
11
- VERSION = '0.1.75'
11
+ VERSION = '0.1.76'
12
12
  end
@@ -80,19 +80,29 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
80
80
  end
81
81
 
82
82
  def test_ebs
83
- region = @@ec2_pricing.get_region('us-east')
83
+ region = @@ec2_pricing.get_region('us-east-1')
84
+ # next two prices are no longer provided by aws (May 09, 2016)
84
85
  assert region.ebs_price.standard_per_gb == 0.05
85
86
  assert region.ebs_price.standard_per_million_io == 0.05
86
87
  assert region.ebs_price.preferred_per_gb == 0.125
87
88
  assert region.ebs_price.preferred_per_iops == 0.065
88
89
  assert region.ebs_price.s3_snaps_per_gb == 0.095
90
+ # next two prices were added by aws (May 09, 2016)
91
+ assert region.ebs_price.ebs_optimized_hdd_per_gb == 0.045
92
+ assert region.ebs_price.ebs_cold_hdd_per_gb == 0.025
93
+
89
94
  end
90
95
 
91
96
  def test_ebs_not_null
92
97
  @@ec2_pricing.regions.each do |region|
93
98
  # Everyone should have standard pricing
99
+ # next two prices are no longer provided by aws (May 09, 2016)
94
100
  assert_not_nil region.ebs_price.standard_per_gb
95
101
  assert_not_nil region.ebs_price.standard_per_million_io
102
+ assert_not_nil region.ebs_price.preferred_per_gb
103
+ assert_not_nil region.ebs_price.preferred_per_iops
104
+ assert_not_nil region.ebs_price.ebs_optimized_hdd_per_gb
105
+ assert_not_nil region.ebs_price.ebs_cold_hdd_per_gb
96
106
  assert_not_nil region.ebs_price.s3_snaps_per_gb
97
107
  end
98
108
  end
@@ -166,11 +176,16 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
166
176
 
167
177
  def test_govcloud_ebs
168
178
  region = @@ec2_pricing.get_region('us-gov-west-1')
179
+ # next two prices are no longer provided by aws (May 09, 2016)
169
180
  assert region.ebs_price.standard_per_gb == 0.065
170
- assert region.ebs_price.standard_per_million_io == 0.065
181
+ assert region.ebs_price.standard_per_million_io == 0.065
171
182
  assert region.ebs_price.preferred_per_gb == 0.15
172
183
  assert region.ebs_price.preferred_per_iops == 0.078
173
184
  assert region.ebs_price.s3_snaps_per_gb == 0.125
185
+ # next two prices were added by aws (May 09, 2016)
186
+ assert region.ebs_price.ebs_optimized_hdd_per_gb == 0.054
187
+ assert region.ebs_price.ebs_cold_hdd_per_gb == 0.03
188
+
174
189
  end
175
190
 
176
191
  def test_govcloud_new_reservation_types
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.75
4
+ version: 0.1.76
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Kinsella
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-19 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby library for retrieving pricing for Amazon Web Services
14
14
  email:
@@ -19,7 +19,7 @@ extra_rdoc_files:
19
19
  - LICENSE
20
20
  - README.md
21
21
  files:
22
- - .gitignore
22
+ - ".gitignore"
23
23
  - CHANGELOG.md
24
24
  - Gemfile
25
25
  - Gemfile.lock
@@ -65,21 +65,21 @@ licenses:
65
65
  metadata: {}
66
66
  post_install_message:
67
67
  rdoc_options:
68
- - --title
68
+ - "--title"
69
69
  - amazon-pricing documentation
70
- - --line-numbers
71
- - --main
70
+ - "--line-numbers"
71
+ - "--main"
72
72
  - README.md
73
73
  require_paths:
74
74
  - lib
75
75
  required_ruby_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ! '>='
77
+ - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ! '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
@@ -88,12 +88,4 @@ rubygems_version: 2.4.8
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Amazon Web Services Pricing Ruby gem
91
- test_files:
92
- - spec/lib/amazon-pricing/definitions/database-type_spec.rb
93
- - spec/lib/amazon-pricing/elasticache_pricing_spec.rb
94
- - spec/lib/amazon-pricing/rds_pricing_spec.rb
95
- - spec/spec_helper.rb
96
- - spec/support/.gitignore
97
- - test/ec2_instance_types_test.rb
98
- - test/helper.rb
99
- has_rdoc:
91
+ test_files: []