amazon-pricing 0.1.56 → 0.1.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +8 -0
- data/Gemfile +4 -3
- data/Gemfile.lock +13 -7
- data/lib/amazon-pricing.rb +5 -10
- data/lib/{aws-price-list.rb → amazon-pricing/aws-price-list.rb} +3 -0
- data/lib/amazon-pricing/{category-type.rb → definitions/category-type.rb} +0 -0
- data/lib/amazon-pricing/{database-type.rb → definitions/database-type.rb} +8 -1
- data/lib/amazon-pricing/{ebs-price.rb → definitions/ebs-price.rb} +0 -0
- data/lib/amazon-pricing/{ec2-instance-type.rb → definitions/ec2-instance-type.rb} +2 -1
- data/lib/amazon-pricing/{instance-type.rb → definitions/instance-type.rb} +0 -0
- data/lib/amazon-pricing/{operating-system.rb → definitions/operating-system.rb} +3 -0
- data/lib/amazon-pricing/{rds-instance-type.rb → definitions/rds-instance-type.rb} +2 -1
- data/lib/amazon-pricing/{region.rb → definitions/region.rb} +0 -0
- data/lib/{dynamo-db-price-list.rb → amazon-pricing/dynamo-db-price-list.rb} +0 -0
- data/lib/{ec2-price-list.rb → amazon-pricing/ec2-price-list.rb} +0 -0
- data/lib/{rds-price-list.rb → amazon-pricing/rds-price-list.rb} +31 -12
- data/lib/amazon-pricing/version.rb +1 -1
- data/spec/lib/amazon-pricing/definitions/database-type_spec.rb +13 -0
- data/spec/{rds_pricing_spec.rb → lib/amazon-pricing/rds_pricing_spec.rb} +1 -3
- data/spec/spec_helper.rb +7 -1
- metadata +19 -26
- data/spec/instance_type_spec.rb +0 -12
- data/spec/price_list_spec.rb +0 -44
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGNhNDVjYjI2NDdhZTk5ZDM4ZjliMjk2MWU0NmEwMmRiOTIwN2M2Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzQxOGYwZWNlOWRlMTdkN2U4YjA0Y2JhYWU4NjI2ZTEyYTcxMjdhMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTUyZDg1Y2UwNWJjOGU1YzRhZTc2MGNkYjFjNWRjNmJmNjlhZGNkNDJiMTA5
|
10
|
+
YTJkNzU1ZmRlMjE1OWFlY2M3MjliNjc1MTg2OTkxYWU4NWVlYjIzN2ZiODBl
|
11
|
+
NDcxMWZlMzIzNjEzZWVhMGY2YzIwYTk1ZTcxZGZiNTFiM2EwODA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjU4MDFlNDI3YTU2ZmIwNGJhZTAxMzBmMWZhYjJmOThiZjZhZTM1ZTdkMjVh
|
14
|
+
MDYyNTJjNDNkNzlhZWUyZTYxYzdiMTQwMWY2YjdhOTBjYmU3YzNkYmU1ZjAx
|
15
|
+
NWZmOWI4YjA5YjE1MDFmODUxYzA0Zjg5ZGY3YjU4ZWEwMzU1ZmM=
|
data/.gitignore
ADDED
data/Gemfile
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
# A sample Gemfile
|
2
1
|
source "https://rubygems.org"
|
3
2
|
gemspec
|
4
3
|
|
5
4
|
gem 'mechanize', '~> 2.7.3'
|
6
5
|
|
6
|
+
group :development do
|
7
|
+
gem 'pry'
|
8
|
+
end
|
9
|
+
|
7
10
|
group :test do
|
8
11
|
gem 'rake'
|
9
12
|
gem 'test-unit'
|
10
13
|
gem 'rspec', '~> 2.11.0'
|
11
14
|
end
|
12
|
-
|
13
|
-
# gem "rails"
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
amazon-pricing (0.1.
|
4
|
+
amazon-pricing (0.1.57)
|
5
5
|
mechanize (~> 2.7.3)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
coderay (1.1.0)
|
10
11
|
diff-lcs (1.1.3)
|
11
12
|
domain_name (0.5.23)
|
12
13
|
unf (>= 0.0.5, < 1.0.0)
|
@@ -21,15 +22,19 @@ GEM
|
|
21
22
|
nokogiri (~> 1.4)
|
22
23
|
ntlm-http (~> 0.1, >= 0.1.1)
|
23
24
|
webrobots (>= 0.0.9, < 0.2)
|
25
|
+
method_source (0.8.2)
|
24
26
|
mime-types (2.4.3)
|
25
|
-
mini_portile (0.6.
|
27
|
+
mini_portile (0.6.2)
|
26
28
|
net-http-digest_auth (1.4)
|
27
29
|
net-http-persistent (2.9.4)
|
28
|
-
nokogiri (1.6.
|
30
|
+
nokogiri (1.6.6.2)
|
29
31
|
mini_portile (~> 0.6.0)
|
30
32
|
ntlm-http (0.1.1)
|
31
|
-
|
32
|
-
|
33
|
+
pry (0.10.1)
|
34
|
+
coderay (~> 1.1.0)
|
35
|
+
method_source (~> 0.8.1)
|
36
|
+
slop (~> 3.4)
|
37
|
+
rake (10.1.0)
|
33
38
|
rspec (2.11.0)
|
34
39
|
rspec-core (~> 2.11.0)
|
35
40
|
rspec-expectations (~> 2.11.0)
|
@@ -38,8 +43,8 @@ GEM
|
|
38
43
|
rspec-expectations (2.11.3)
|
39
44
|
diff-lcs (~> 1.1.3)
|
40
45
|
rspec-mocks (2.11.3)
|
41
|
-
|
42
|
-
|
46
|
+
slop (3.6.0)
|
47
|
+
test-unit (2.5.5)
|
43
48
|
unf (0.1.4)
|
44
49
|
unf_ext
|
45
50
|
unf_ext (0.0.6)
|
@@ -51,6 +56,7 @@ PLATFORMS
|
|
51
56
|
DEPENDENCIES
|
52
57
|
amazon-pricing!
|
53
58
|
mechanize (~> 2.7.3)
|
59
|
+
pry
|
54
60
|
rake
|
55
61
|
rspec (~> 2.11.0)
|
56
62
|
test-unit
|
data/lib/amazon-pricing.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
|
2
1
|
require 'json'
|
3
2
|
require 'net/http'
|
4
3
|
require 'mechanize'
|
5
4
|
|
6
|
-
Dir[File.join(File.dirname(__FILE__), 'amazon-pricing/*.rb')].sort.each { |lib| require lib }
|
7
|
-
|
8
|
-
require 'aws-price-list'
|
9
|
-
require 'ec2-price-list'
|
10
|
-
require 'rds-price-list'
|
11
|
-
require 'dynamo-db-price-list'
|
5
|
+
Dir[File.join(File.dirname(__FILE__), 'amazon-pricing/definitions/*.rb')].sort.each { |lib| require lib }
|
12
6
|
|
13
|
-
require '
|
14
|
-
|
15
|
-
|
7
|
+
require 'amazon-pricing/aws-price-list'
|
8
|
+
require 'amazon-pricing/ec2-price-list'
|
9
|
+
require 'amazon-pricing/rds-price-list'
|
10
|
+
require 'amazon-pricing/dynamo-db-price-list'
|
File without changes
|
@@ -7,6 +7,9 @@
|
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
8
|
# Home:: http://github.com/CloudHealth/amazon-pricing
|
9
9
|
#++
|
10
|
+
|
11
|
+
require 'amazon-pricing/definitions/category-type'
|
12
|
+
|
10
13
|
module AwsPricing
|
11
14
|
class DatabaseType < CategoryType
|
12
15
|
|
@@ -26,7 +29,9 @@ module AwsPricing
|
|
26
29
|
'sqlserver_ex' => 'Microsoft SQL Server Express Edition',
|
27
30
|
'sqlserver_web' => 'Microsoft SQL Server Web Edition',
|
28
31
|
'sqlserver_se_standard' => 'Microsoft SQL Server Standard Edition',
|
32
|
+
'sqlserver_se_multiaz' => 'Microsoft SQL Server Standard Edition (Multi-AZ)',
|
29
33
|
'sqlserver_se_byol' => 'Microsoft SQL Server Standard Edition (BYOL)',
|
34
|
+
'sqlserver_se_byol_multiaz' => 'Microsoft SQL Server Standard Edition (BYOL Multi-AZ)',
|
30
35
|
'sqlserver_ee_byol' => 'Microsoft SQL Server Enterprise Edition (BYOL)'
|
31
36
|
}
|
32
37
|
|
@@ -48,7 +53,9 @@ module AwsPricing
|
|
48
53
|
'sqlserver-ee(byol)' => 'sqlserver_ee_byol',
|
49
54
|
'sqlserver-ex(li)' => 'sqlserver_ex',
|
50
55
|
'sqlserver-se(byol)' => 'sqlserver_se_byol',
|
56
|
+
'sqlserver-se(byol)_multiaz' => 'sqlserver_se_byol_multiaz',
|
51
57
|
'sqlserver-se(li)' => 'sqlserver_se_standard',
|
58
|
+
'sqlserver-se(li)_multiaz' => 'sqlserver_se_multiaz',
|
52
59
|
'sqlserver-web(li)' => 'sqlserver_web',
|
53
60
|
}
|
54
61
|
|
@@ -58,7 +65,7 @@ module AwsPricing
|
|
58
65
|
:oracle_se1 => [:standard, :multiaz, :byol, :byol_multiaz],
|
59
66
|
:oracle_se => [:byol, :byol_multiaz],
|
60
67
|
:oracle_ee => [:byol, :byol_multiaz],
|
61
|
-
:sqlserver_se => [:standard, :byol],
|
68
|
+
:sqlserver_se => [:standard, :multiaz, :byol, :byol_multiaz],
|
62
69
|
:sqlserver_ee => [:byol]
|
63
70
|
}
|
64
71
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -14,19 +14,26 @@ module AwsPricing
|
|
14
14
|
@@RES_TYPES = [:light, :medium, :heavy]
|
15
15
|
|
16
16
|
@@OD_DB_DEPLOY_TYPE = {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
:mysql => {:mysql=>["standard","multiAZ"]},
|
18
|
+
:postgresql => {:postgresql=>["standard","multiAZ"]},
|
19
|
+
:oracle => {
|
20
|
+
:oracle_se1=>["li-standard","li-multiAZ","byol-standard","byol-multiAZ"],
|
21
|
+
:oracle_se=>["byol-standard","byol-multiAZ"],
|
22
|
+
:oracle_ee=>["byol-standard","byol-multiAZ"]
|
23
|
+
},
|
24
|
+
:sqlserver => {
|
25
|
+
:sqlserver_ex=>["li-ex"],
|
26
|
+
:sqlserver_web=>["li-web"],
|
27
|
+
:sqlserver_se=>["li-se", "li-se-multiAZ", "byol", "byol-multiAZ"],
|
28
|
+
:sqlserver_ee=>["byol"]
|
29
|
+
}
|
30
|
+
}
|
23
31
|
|
24
32
|
@@RESERVED_DB_DEPLOY_TYPE = {
|
25
|
-
|
26
|
-
|
27
|
-
|
33
|
+
:oracle=> {:oracle_se1=>["li","byol"], :oracle_se=>["byol"], :oracle_ee=>["byol"]},
|
34
|
+
:sqlserver=> {:sqlserver_ex=>["li-ex"], :sqlserver_web=>["li-web"], :sqlserver_se=>["li-se","byol"], :sqlserver_ee=>["byol"]}
|
35
|
+
}
|
28
36
|
|
29
|
-
|
30
37
|
def is_multi_az?(type)
|
31
38
|
return true if type.upcase.match("MULTI-AZ")
|
32
39
|
false
|
@@ -45,18 +52,27 @@ module AwsPricing
|
|
45
52
|
# to find out the byol type
|
46
53
|
is_byol = is_byol? dp_type
|
47
54
|
is_multi_az = dp_type.upcase.include?("MULTIAZ")
|
55
|
+
dp_type = dp_type.gsub('-multiAZ', '') if db == :sqlserver
|
48
56
|
|
49
57
|
if [:mysql, :postgresql, :oracle].include? db
|
50
58
|
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{dp_type}-deployments.min.js",:ondemand, db_type, is_byol, is_multi_az)
|
51
59
|
elsif db == :sqlserver
|
52
|
-
|
60
|
+
if is_multi_az
|
61
|
+
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/sqlserver-#{dp_type}-ondemand-maz.min.js",:ondemand, db_type, is_byol, is_multi_az)
|
62
|
+
else
|
63
|
+
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/sqlserver-#{dp_type}-ondemand.min.js",:ondemand, db_type, is_byol, is_multi_az)
|
64
|
+
end
|
53
65
|
end
|
54
66
|
|
55
67
|
# Now repeat for legacy instances
|
56
68
|
if [:mysql, :postgresql, :oracle].include? db
|
57
69
|
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/previous-generation/pricing-#{dp_type}-deployments.min.js",:ondemand, db_type, is_byol, is_multi_az)
|
58
70
|
elsif db == :sqlserver
|
59
|
-
|
71
|
+
if is_multi_az
|
72
|
+
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/previous-generation/sqlserver-#{dp_type}-ondemand-maz.min.js",:ondemand, db_type, is_byol, is_multi_az)
|
73
|
+
else
|
74
|
+
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/previous-generation/sqlserver-#{dp_type}-ondemand.min.js",:ondemand, db_type, is_byol, is_multi_az)
|
75
|
+
end
|
60
76
|
end
|
61
77
|
|
62
78
|
end
|
@@ -152,6 +168,9 @@ module AwsPricing
|
|
152
168
|
end
|
153
169
|
end
|
154
170
|
end
|
171
|
+
rescue => ex
|
172
|
+
$sterr.puts "Failed to fetch: #{url}"
|
173
|
+
raise
|
155
174
|
end
|
156
175
|
end
|
157
176
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'AwsPricing::DatabaseType' do
|
4
|
+
context 'Display Names' do
|
5
|
+
::AwsPricing::DatabaseType.class_variable_get(:@@ProductDescription).each_pair.each do |k, v|
|
6
|
+
class_eval %*
|
7
|
+
it "#{k} should be defined" do
|
8
|
+
::AwsPricing::DatabaseType.class_variable_get(:@@Database_Name_Lookup)['#{v}'].should_not eq(nil)
|
9
|
+
end
|
10
|
+
*
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'amazon-pricing'
|
2
|
-
require File.join('amazon-pricing', 'database-type')
|
3
1
|
require 'spec_helper'
|
4
2
|
|
5
3
|
describe AwsPricing::RdsPriceList do
|
@@ -10,7 +8,7 @@ describe AwsPricing::RdsPriceList do
|
|
10
8
|
end
|
11
9
|
|
12
10
|
describe 'new' do
|
13
|
-
it 'RdsPriceList.new should return the valid response' do
|
11
|
+
it 'RdsPriceList.new should return the valid response', broken: true do
|
14
12
|
@pricing.regions.each do |region|
|
15
13
|
# response should have valid region
|
16
14
|
expect(@region_name).to include(region.name)
|
data/spec/spec_helper.rb
CHANGED
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.57
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Kinsella
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -33,6 +33,7 @@ extra_rdoc_files:
|
|
33
33
|
- LICENSE
|
34
34
|
- README.md
|
35
35
|
files:
|
36
|
+
- .gitignore
|
36
37
|
- CHANGELOG.md
|
37
38
|
- Gemfile
|
38
39
|
- Gemfile.lock
|
@@ -46,22 +47,21 @@ files:
|
|
46
47
|
- archive/rds-2014-05-22.csv
|
47
48
|
- lib/.DS_Store
|
48
49
|
- lib/amazon-pricing.rb
|
49
|
-
- lib/amazon-pricing/
|
50
|
-
- lib/amazon-pricing/
|
51
|
-
- lib/amazon-pricing/
|
52
|
-
- lib/amazon-pricing/
|
53
|
-
- lib/amazon-pricing/instance-type.rb
|
54
|
-
- lib/amazon-pricing/
|
55
|
-
- lib/amazon-pricing/
|
56
|
-
- lib/amazon-pricing/
|
50
|
+
- lib/amazon-pricing/aws-price-list.rb
|
51
|
+
- lib/amazon-pricing/definitions/category-type.rb
|
52
|
+
- lib/amazon-pricing/definitions/database-type.rb
|
53
|
+
- lib/amazon-pricing/definitions/ebs-price.rb
|
54
|
+
- lib/amazon-pricing/definitions/ec2-instance-type.rb
|
55
|
+
- lib/amazon-pricing/definitions/instance-type.rb
|
56
|
+
- lib/amazon-pricing/definitions/operating-system.rb
|
57
|
+
- lib/amazon-pricing/definitions/rds-instance-type.rb
|
58
|
+
- lib/amazon-pricing/definitions/region.rb
|
59
|
+
- lib/amazon-pricing/dynamo-db-price-list.rb
|
60
|
+
- lib/amazon-pricing/ec2-price-list.rb
|
61
|
+
- lib/amazon-pricing/rds-price-list.rb
|
57
62
|
- lib/amazon-pricing/version.rb
|
58
|
-
- lib/
|
59
|
-
- lib/
|
60
|
-
- lib/ec2-price-list.rb
|
61
|
-
- lib/rds-price-list.rb
|
62
|
-
- spec/instance_type_spec.rb
|
63
|
-
- spec/price_list_spec.rb
|
64
|
-
- spec/rds_pricing_spec.rb
|
63
|
+
- spec/lib/amazon-pricing/definitions/database-type_spec.rb
|
64
|
+
- spec/lib/amazon-pricing/rds_pricing_spec.rb
|
65
65
|
- spec/spec_helper.rb
|
66
66
|
- spec/support/.gitignore
|
67
67
|
- test/ec2_instance_types_test.rb
|
@@ -91,15 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project: amazon-pricing
|
94
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.3.0
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Amazon Web Services Pricing Ruby gem
|
98
|
-
test_files:
|
99
|
-
- spec/instance_type_spec.rb
|
100
|
-
- spec/price_list_spec.rb
|
101
|
-
- spec/rds_pricing_spec.rb
|
102
|
-
- spec/spec_helper.rb
|
103
|
-
- spec/support/.gitignore
|
104
|
-
- test/ec2_instance_types_test.rb
|
105
|
-
- test/helper.rb
|
98
|
+
test_files: []
|
data/spec/instance_type_spec.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#require 'amazon-pricing/instance-type'
|
2
|
-
#
|
3
|
-
# THIS TEST IS NO LONGER VALID
|
4
|
-
#describe AwsPricing::InstanceType do
|
5
|
-
# describe '::get_values' do
|
6
|
-
# it 'raises an UnknownTypeError on an unexpected instance type' do
|
7
|
-
# expect {
|
8
|
-
# AwsPricing::InstanceType::get_values 'QuantumODI', 'huge'
|
9
|
-
# }.to raise_error(AwsPricing::UnknownTypeError)
|
10
|
-
# end
|
11
|
-
# end
|
12
|
-
#end
|
data/spec/price_list_spec.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'amazon-pricing'
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe AwsPricing::PriceList do
|
5
|
-
|
6
|
-
# Need to update below based on 2013-07 changes
|
7
|
-
=begin
|
8
|
-
describe "#get_ec2_on_demand_instance_pricing" do
|
9
|
-
let(:price_list) {
|
10
|
-
{
|
11
|
-
'config' => {
|
12
|
-
'regions' => [{
|
13
|
-
'region' => 'us-east',
|
14
|
-
'instanceTypes' => [{
|
15
|
-
'type' => 'stdODI',
|
16
|
-
'sizes' => [{
|
17
|
-
'size' => 'sm',
|
18
|
-
'valueColumns' => [
|
19
|
-
{'name' => 'linux', 'prices' => { 'USD' => '0.065' }},
|
20
|
-
{'name' => 'mswin', 'prices' => { 'USD' => '0.265' }}
|
21
|
-
]}]}]}]
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
before do
|
27
|
-
AwsPricing::PriceList.any_instance.tap do |it|
|
28
|
-
it.stub :get_ec2_reserved_instance_pricing
|
29
|
-
it.stub :fetch_ec2_ebs_pricing
|
30
|
-
it.stub :fetch_url => price_list
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it "doesn't break when amazon adds instance types" do
|
35
|
-
newType = {'type' => 'quantumODI', 'sizes' => [{'size' => 'sm', 'valueColumns' => []}]}
|
36
|
-
price_list['config']['regions'][0]['instanceTypes'] << newType
|
37
|
-
|
38
|
-
expect {
|
39
|
-
AwsPricing::PriceList.new
|
40
|
-
}.to_not raise_error
|
41
|
-
end
|
42
|
-
end
|
43
|
-
=end
|
44
|
-
end
|