amazon-pricing 0.1.45 → 0.1.46
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.
- checksums.yaml +8 -8
- data/lib/amazon-pricing/ec2-instance-type.rb +7 -7
- data/lib/amazon-pricing/version.rb +1 -1
- data/lib/gov-cloud-price-list.rb +16 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGUyODcyODBiMTVhNGUxNTY5MDgwMzdjODkxNGMwOGFmNGY0ODA4OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjRlZjY1YWQ3YzVmZDgyN2EwZDE5N2Q3ZGRmMmFkYzJlZDA1NTA2Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWEyYjkwYmFhNDU5Y2I0ZjI5ZGVjZWMxODI4YTllYmZmNWQ4MjRhMmNiY2Q4
|
10
|
+
ZTdlYzM5YzkyZGIyMWE5OGNkMTcxN2QwNGQ2NWNiZmYyNDQ0ZTAwN2RkNjYw
|
11
|
+
MDIyZGJkYmQ0ZjU1NWQ2NDkyNzhmOTFiZjZiZDU3ZTExNjJjMzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmE2ZTk3NzczODU1OTJjZmIxYmQ5NTYyNWEzNjEzNmE1MGRkY2I0MzZkOTNh
|
14
|
+
YTUxMTk4YzU1NjM0NGUzMWU2MTE2MGI3ZDQxYzVhN2ExODU2NTdkODQwMDIz
|
15
|
+
NjE3ZmM3NDkwYTY4ODMyYmQ0MGVjNjRkM2IyZjFlOTk1OTcwNmU=
|
@@ -52,7 +52,7 @@ module AwsPricing
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
def update_pricing2(operating_system,
|
55
|
+
def update_pricing2(operating_system, res_type, ondemand_pph = nil, year1_prepay = nil, year3_prepay = nil, year1_pph = nil, year3_pph = nil)
|
56
56
|
|
57
57
|
os = get_category_type(operating_system)
|
58
58
|
if os.nil?
|
@@ -60,11 +60,11 @@ module AwsPricing
|
|
60
60
|
@category_types[operating_system] = os
|
61
61
|
end
|
62
62
|
|
63
|
-
os.set_price_per_hour(
|
64
|
-
os.set_prepay(
|
65
|
-
os.set_prepay(
|
66
|
-
os.set_price_per_hour(
|
67
|
-
os.set_price_per_hour(
|
63
|
+
os.set_price_per_hour(res_type, nil, coerce_price(ondemand_pph)) unless ondemand_pph.nil?
|
64
|
+
os.set_prepay(res_type, :year1, coerce_price(year1_prepay)) unless year1_prepay.nil?
|
65
|
+
os.set_prepay(res_type, :year3, coerce_price(year3_prepay)) unless year3_prepay.nil?
|
66
|
+
os.set_price_per_hour(res_type, :year1, coerce_price(year1_pph)) unless year1_pph.nil?
|
67
|
+
os.set_price_per_hour(res_type, :year3, coerce_price(year3_pph)) unless year3_pph.nil?
|
68
68
|
end
|
69
69
|
|
70
70
|
# Maintained for backward compatibility reasons
|
@@ -88,5 +88,5 @@ module AwsPricing
|
|
88
88
|
[api_name, name]
|
89
89
|
end
|
90
90
|
|
91
|
-
|
91
|
+
end
|
92
92
|
end
|
data/lib/gov-cloud-price-list.rb
CHANGED
@@ -19,23 +19,25 @@ module AwsPricing
|
|
19
19
|
client = Mechanize.new
|
20
20
|
page = client.get(GOV_CLOUD_URL)
|
21
21
|
tables = page.search("//div[@class='aws-table ']")
|
22
|
-
|
23
|
-
|
22
|
+
for i in 0..3
|
23
|
+
create_ondemand_instances(tables[i])
|
24
|
+
end
|
24
25
|
|
25
|
-
for i in
|
26
|
-
create_reserved_instances(
|
26
|
+
for i in 4..9
|
27
|
+
create_reserved_instances(tables[i], :light)
|
27
28
|
end
|
28
|
-
for i in
|
29
|
-
create_reserved_instances(
|
29
|
+
for i in 9..22
|
30
|
+
create_reserved_instances(tables[i], :medium)
|
30
31
|
end
|
31
|
-
for i in
|
32
|
-
create_reserved_instances(
|
32
|
+
for i in 23..33
|
33
|
+
create_reserved_instances(tables[i], :heavy)
|
33
34
|
end
|
34
35
|
|
35
36
|
end
|
36
37
|
|
37
38
|
# e.g. [["Prices / Hour", "Amazon Linux", "RHEL", "SLES"], ["m1.small", "$0.053", "$0.083", "$0.083"]]
|
38
|
-
def create_ondemand_instances(
|
39
|
+
def create_ondemand_instances(table)
|
40
|
+
rows = get_rows(table)
|
39
41
|
header = rows[0]
|
40
42
|
@_regions.values.each do |region|
|
41
43
|
|
@@ -54,16 +56,17 @@ module AwsPricing
|
|
54
56
|
end
|
55
57
|
|
56
58
|
# e.g. [["RHEL", "1 yr Term Upfront", "1 yr TermHourly", "3 yr TermUpfront", "3 yr Term Hourly"], ["m1.small", "$68.00", "$0.099", "$105.00", "$0.098"]]
|
57
|
-
def create_reserved_instances(
|
58
|
-
|
59
|
-
operating_system = get_os(
|
59
|
+
def create_reserved_instances(table, res_type)
|
60
|
+
rows = get_rows(table)
|
61
|
+
operating_system = get_os(table.search(".//td/p").last.inner_text.strip) # Wow...
|
62
|
+
|
60
63
|
@_regions.values.each do |region|
|
61
64
|
|
62
65
|
rows.slice(1, rows.size).each do |row|
|
63
66
|
api_name = row[0]
|
64
67
|
instance_type = region.get_instance_type(api_name)
|
65
68
|
if instance_type.nil?
|
66
|
-
api_name, name = Ec2InstanceType.get_name(nil,
|
69
|
+
api_name, name = Ec2InstanceType.get_name(nil, api_name, true)
|
67
70
|
instance_type = region.add_or_update_ec2_instance_type(api_name, name)
|
68
71
|
end
|
69
72
|
instance_type.update_pricing2(operating_system, res_type, nil, row[1], row[3], row[2], row[4])
|
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.
|
4
|
+
version: 0.1.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Kinsella
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Ruby library for retrieving pricing for Amazon Web Services
|
14
14
|
email:
|