amazon-pricing 0.1.30 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/amazon-pricing.rb +13 -4
- data/lib/amazon-pricing/ebs-price.rb +2 -2
- data/lib/amazon-pricing/version.rb +1 -1
- data/test/ec2_instance_types_test.rb +5 -10
- data/test/govcloud_test.rb +4 -4
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/amazon-pricing.rb
CHANGED
@@ -30,6 +30,16 @@ module AwsPricing
|
|
30
30
|
@_regions.values
|
31
31
|
end
|
32
32
|
|
33
|
+
def get_instance_types
|
34
|
+
instance_types = []
|
35
|
+
@_regions.each do |region|
|
36
|
+
region.ec2_instance_types.each do |instance_type|
|
37
|
+
instance_types << instance_type
|
38
|
+
end
|
39
|
+
end
|
40
|
+
instance_types
|
41
|
+
end
|
42
|
+
|
33
43
|
def get_instance_type(region_name, api_name)
|
34
44
|
region = get_region(region_name)
|
35
45
|
raise "Region #{region_name} not found" if region.nil?
|
@@ -100,7 +110,7 @@ module AwsPricing
|
|
100
110
|
|
101
111
|
def initialize
|
102
112
|
@_regions = {}
|
103
|
-
@_regions["us-gov-west"] = Region.new("us-gov-west")
|
113
|
+
@_regions["us-gov-west-1"] = Region.new("us-gov-west-1")
|
104
114
|
InstanceType.populate_lookups
|
105
115
|
get_ec2_instance_pricing
|
106
116
|
fetch_ec2_ebs_pricing
|
@@ -113,7 +123,6 @@ module AwsPricing
|
|
113
123
|
client = Mechanize.new
|
114
124
|
page = client.get(GOV_CLOUD_URL)
|
115
125
|
tables = page.search("//div[@class='aws-table section']")
|
116
|
-
|
117
126
|
create_ondemand_instances(get_rows(tables[0]))
|
118
127
|
create_ondemand_instances(get_rows(tables[1]))
|
119
128
|
|
@@ -161,7 +170,7 @@ module AwsPricing
|
|
161
170
|
api_name, name = Ec2InstanceType.get_name(nil, row[0], true)
|
162
171
|
instance_type = region.add_or_update_ec2_instance_type(api_name, name)
|
163
172
|
end
|
164
|
-
instance_type.update_pricing2(operating_system, res_type, nil, row[1], row[
|
173
|
+
instance_type.update_pricing2(operating_system, res_type, nil, row[1], row[3], row[2], row[4])
|
165
174
|
end
|
166
175
|
end
|
167
176
|
end
|
@@ -226,7 +235,7 @@ module AwsPricing
|
|
226
235
|
|
227
236
|
def initialize
|
228
237
|
@_regions = {}
|
229
|
-
@_regions["us-gov-west"] = Region.new("us-gov-west")
|
238
|
+
@_regions["us-gov-west-1"] = Region.new("us-gov-west-1")
|
230
239
|
InstanceType.populate_lookups
|
231
240
|
get_rds_instance_pricing
|
232
241
|
end
|
@@ -10,11 +10,11 @@
|
|
10
10
|
module AwsPricing
|
11
11
|
|
12
12
|
class EbsPrice
|
13
|
-
attr_accessor :
|
13
|
+
attr_accessor :standard_per_gb, :standard_per_million_io,
|
14
14
|
:preferred_per_gb, :preferred_per_iops, :s3_snaps_per_gb
|
15
15
|
|
16
16
|
def initialize(region)
|
17
|
-
|
17
|
+
#@region = region
|
18
18
|
end
|
19
19
|
|
20
20
|
def update_from_json(json)
|
@@ -22,11 +22,6 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def test_cc8xlarge_issue
|
26
|
-
obj = @@ec2_pricing.get_instance_type('us-east', 'cc2.8xlarge')
|
27
|
-
assert obj.api_name == 'cc2.8xlarge'
|
28
|
-
end
|
29
|
-
|
30
25
|
def test_name_lookup
|
31
26
|
@@ec2_pricing.regions.each do |region|
|
32
27
|
assert_not_nil region.name
|
@@ -49,7 +44,7 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
49
44
|
def test_available
|
50
45
|
# Validate instance types in specific regions are available
|
51
46
|
region = @@ec2_pricing.get_region('us-east')
|
52
|
-
assert region.instance_type_available?('
|
47
|
+
assert region.instance_type_available?('m3.large')
|
53
48
|
end
|
54
49
|
|
55
50
|
def test_fetch_all_breakeven_months
|
@@ -68,7 +63,7 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
68
63
|
|
69
64
|
def test_breakeven_month
|
70
65
|
region = @@ec2_pricing.get_region('us-east')
|
71
|
-
instance = region.get_ec2_instance_type('
|
66
|
+
instance = region.get_ec2_instance_type('m3.large')
|
72
67
|
bem = instance.get_breakeven_month(:linux, :heavy, :year1)
|
73
68
|
assert bem == 6
|
74
69
|
end
|
@@ -76,13 +71,13 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
76
71
|
def test_memory
|
77
72
|
# Validate instance types in specific regions are available
|
78
73
|
region = @@ec2_pricing.get_region('us-east')
|
79
|
-
instance = region.get_ec2_instance_type('
|
74
|
+
instance = region.get_ec2_instance_type('m3.large')
|
80
75
|
assert instance.memory_in_mb == 7500
|
81
76
|
end
|
82
77
|
|
83
78
|
def test_non_standard_region_name
|
84
79
|
region = @@ec2_pricing.get_region('eu-west-1')
|
85
|
-
instance = region.get_ec2_instance_type('
|
80
|
+
instance = region.get_ec2_instance_type('m3.large')
|
86
81
|
assert instance.memory_in_mb == 7500
|
87
82
|
end
|
88
83
|
|
@@ -106,7 +101,7 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
106
101
|
|
107
102
|
def test_virtual_cores
|
108
103
|
region = @@ec2_pricing.get_region('us-east')
|
109
|
-
instance = region.get_ec2_instance_type('
|
104
|
+
instance = region.get_ec2_instance_type('m3.large')
|
110
105
|
assert instance.virtual_cores == 2
|
111
106
|
end
|
112
107
|
|
data/test/govcloud_test.rb
CHANGED
@@ -23,25 +23,25 @@ class TestGovCloud < Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_cc8xlarge_issue
|
26
|
-
obj = @@ec2_pricing.get_instance_type('us-gov-west', 'cc2.8xlarge')
|
26
|
+
obj = @@ec2_pricing.get_instance_type('us-gov-west-1', 'cc2.8xlarge')
|
27
27
|
assert obj.api_name == 'cc2.8xlarge'
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_memory
|
31
31
|
# Validate instance types in specific regions are available
|
32
|
-
region = @@ec2_pricing.get_region('us-gov-west')
|
32
|
+
region = @@ec2_pricing.get_region('us-gov-west-1')
|
33
33
|
instance = region.get_ec2_instance_type('m1.large')
|
34
34
|
assert instance.memory_in_mb == 7500
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_virtual_cores
|
38
|
-
region = @@ec2_pricing.get_region('us-gov-west')
|
38
|
+
region = @@ec2_pricing.get_region('us-gov-west-1')
|
39
39
|
instance = region.get_ec2_instance_type('m1.large')
|
40
40
|
assert instance.virtual_cores == 2
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_ebs
|
44
|
-
region = @@ec2_pricing.get_region('us-gov-west')
|
44
|
+
region = @@ec2_pricing.get_region('us-gov-west-1')
|
45
45
|
assert region.ebs_price.standard_per_gb == 0.065
|
46
46
|
assert region.ebs_price.standard_per_million_io == 0.065
|
47
47
|
assert region.ebs_price.preferred_per_gb == 0.15
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon-pricing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.32
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby library for retrieving pricing for Amazon Web Services
|
15
15
|
email:
|
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
65
|
version: '0'
|
66
66
|
segments:
|
67
67
|
- 0
|
68
|
-
hash: -
|
68
|
+
hash: -865750944682742325
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
none: false
|
71
71
|
requirements:
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
segments:
|
76
76
|
- 0
|
77
|
-
hash: -
|
77
|
+
hash: -865750944682742325
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project: amazon-pricing
|
80
80
|
rubygems_version: 1.8.25
|