aws-pricing 0.5.0 → 0.6.0
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/.travis.yml +9 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/aws-pricing.gemspec +2 -2
- data/lib/aws-pricing/cloudfront.rb +3 -3
- data/lib/aws-pricing/ec2.rb +22 -7
- data/lib/aws-pricing/rds.rb +4 -3
- data/lib/aws-pricing/s3.rb +5 -3
- data/spec/aws-pricing_spec.rb +38 -0
- metadata +3 -3
data/.travis.yml
CHANGED
data/README.rdoc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
{<img src="https://secure.travis-ci.org/seeingidog/aws-pricing.png?branch=master" alt="Build Status" />}[http://travis-ci.org/seeingidog/aws-pricing]
|
4
4
|
{<img src="https://gemnasium.com/seeingidog/aws-pricing.png" alt="Dependency Status" />}[https://gemnasium.com/seeingidog/aws-pricing]
|
5
|
-
|
5
|
+
{<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/seeingidog/aws-pricing]
|
6
6
|
|
7
7
|
Simpler interface to AWS pricing data. Uses Amazon's unofficial json price URLs.
|
8
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/aws-pricing.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "aws-pricing"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ian Morgan"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-08-09"
|
13
13
|
s.description = "Simpler interface to AWS pricing data"
|
14
14
|
s.email = "ian@ruby-code.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module AWSPricing
|
2
2
|
class CloudFront
|
3
3
|
#Cloudfront pricing data
|
4
|
-
|
4
|
+
CLOUDFRONT_BASE_URL = '/cloudfront/pricing/pricing-cloudfront-'
|
5
5
|
|
6
6
|
#Returns Hash of request pricing information
|
7
7
|
def self.requests
|
8
|
-
Base.get('
|
8
|
+
Base.get(CLOUDFRONT_BASE_URL + 'requests')
|
9
9
|
end
|
10
10
|
|
11
11
|
#Returns Hash of data transfer pricing information
|
12
12
|
def self.data_transfer
|
13
|
-
Base.get('
|
13
|
+
Base.get(CLOUDFRONT_BASE_URL + 'on-demand')
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
data/lib/aws-pricing/ec2.rb
CHANGED
@@ -2,12 +2,27 @@ module AWSPricing
|
|
2
2
|
class EC2
|
3
3
|
#Elastic Compute pricing data
|
4
4
|
|
5
|
+
|
5
6
|
|
7
|
+
EC2_BASE_URL = '/ec2/pricing/pricing-'
|
8
|
+
EC2_RESERVED_BASE_URL = '/ec2/pricing/'
|
9
|
+
|
6
10
|
#Returns Hash of on-demand server instance pricing information
|
7
11
|
def self.instances
|
8
|
-
Base.get('
|
12
|
+
Base.get(EC2_BASE_URL + 'on-demand-instances')
|
9
13
|
end
|
10
|
-
|
14
|
+
|
15
|
+
#Returns Hash of reserved server instance pricing information
|
16
|
+
def self.reserved_instances(options = {})
|
17
|
+
os = options[:os].to_s || 'linux'
|
18
|
+
utilization = options[:utilization].to_s || 'heavy'
|
19
|
+
|
20
|
+
raise "AWSPricing: Invalid OS" unless /^linux|mswin+$/ =~ os
|
21
|
+
raise "AWSPricing: Invalid Utilization" unless /^light|medium|heavy$/ =~ utilization
|
22
|
+
|
23
|
+
Base.get(EC2_RESERVED_BASE_URL + "ri-#{utilization}-#{os}")
|
24
|
+
end
|
25
|
+
|
11
26
|
#Returns Hash of current spot instance pricing information (5m)
|
12
27
|
def self.spot_instances
|
13
28
|
callback_response = Net::HTTP.get_response(URI.parse 'http://spot-price.s3.amazonaws.com/spot.js').body
|
@@ -18,27 +33,27 @@ module AWSPricing
|
|
18
33
|
|
19
34
|
#Returns Hash of elastic block storage pricing information
|
20
35
|
def self.ebs
|
21
|
-
Base.get('
|
36
|
+
Base.get(EC2_BASE_URL + 'ebs')
|
22
37
|
end
|
23
38
|
|
24
39
|
#Returns Hash of data transfer pricing information
|
25
40
|
def self.data_transfer
|
26
|
-
Base.get('
|
41
|
+
Base.get(EC2_BASE_URL + 'data-transfer')
|
27
42
|
end
|
28
43
|
|
29
44
|
#Returns Hash of elastic IP pricing information
|
30
45
|
def self.elastic_ips
|
31
|
-
Base.get('
|
46
|
+
Base.get(EC2_BASE_URL + 'elastic-ips')
|
32
47
|
end
|
33
48
|
|
34
49
|
#Returns Hash of Cloudwatch monitoring pricing information
|
35
50
|
def self.cloud_watch
|
36
|
-
Base.get('
|
51
|
+
Base.get(EC2_BASE_URL + 'cloudwatch')
|
37
52
|
end
|
38
53
|
|
39
54
|
#Returns Hash of elastic loadbalancer pricing information
|
40
55
|
def self.elb
|
41
|
-
Base.get('
|
56
|
+
Base.get(EC2_BASE_URL + 'elb')
|
42
57
|
end
|
43
58
|
|
44
59
|
end
|
data/lib/aws-pricing/rds.rb
CHANGED
@@ -2,15 +2,16 @@ module AWSPricing
|
|
2
2
|
class RDS
|
3
3
|
#Relation Database Service pricing data
|
4
4
|
|
5
|
-
|
5
|
+
RDS_BASE_URL = '/rds/pricing/mysql/pricing-'
|
6
|
+
|
6
7
|
#Returns Hash of standard deployment pricing information
|
7
8
|
def self.standard
|
8
|
-
Base.get('
|
9
|
+
Base.get(RDS_BASE_URL + 'standard-deployments')
|
9
10
|
end
|
10
11
|
|
11
12
|
#Returns Hash of multi-availability zone deployment pricing information
|
12
13
|
def self.multi_az
|
13
|
-
Base.get('
|
14
|
+
Base.get(RDS_BASE_URL + 'multiAZ-deployments')
|
14
15
|
end
|
15
16
|
|
16
17
|
end
|
data/lib/aws-pricing/s3.rb
CHANGED
@@ -2,19 +2,21 @@ module AWSPricing
|
|
2
2
|
class S3
|
3
3
|
#Simple Storage Service pricing data
|
4
4
|
|
5
|
+
S3_BASE_URL = '/s3/pricing/pricing-'
|
6
|
+
|
5
7
|
#Returns Hash of storage pricing information
|
6
8
|
def self.storage
|
7
|
-
Base.get('
|
9
|
+
Base.get(S3_BASE_URL + 'storage')
|
8
10
|
end
|
9
11
|
|
10
12
|
#Returns Hash of data transfer pricing information
|
11
13
|
def self.data_transfer
|
12
|
-
Base.get('
|
14
|
+
Base.get(S3_BASE_URL + 'data-transfer')
|
13
15
|
end
|
14
16
|
|
15
17
|
#Returns Hash of request pricing information
|
16
18
|
def self.requests
|
17
|
-
Base.get('
|
19
|
+
Base.get(S3_BASE_URL + 'requests')
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
data/spec/aws-pricing_spec.rb
CHANGED
@@ -8,7 +8,45 @@ describe "AwsPricing" do
|
|
8
8
|
it "returns a hash of instance pricing" do
|
9
9
|
EC2.instances.class.should == Hash
|
10
10
|
end
|
11
|
+
|
12
|
+
describe "reserved instances" do
|
13
|
+
it "returns a hash of reserved linux heavy utilization instance pricing by default" do
|
14
|
+
EC2.reserved_instances.class.should == Hash
|
15
|
+
end
|
16
|
+
it "returns a hash of reserved linux light utilization instance pricing" do
|
17
|
+
EC2.reserved_instances(:os => :linux, :utilization => :light).class.should == Hash
|
18
|
+
end
|
11
19
|
|
20
|
+
it "returns a hash of reserved linux medium utilization instance pricing" do
|
21
|
+
EC2.reserved_instances(:os => :linux, :utilization => :medium).class.should == Hash
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns a hash of reserved linux heavy utlization instance pricing" do
|
25
|
+
EC2.reserved_instances(:os => :linux, :utilization => :heavy).class.should == Hash
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
it "returns a hash of reserved mswin light utilization instance pricing" do
|
30
|
+
EC2.reserved_instances(:os => :mswin, :utilization => :light).class.should == Hash
|
31
|
+
end
|
32
|
+
|
33
|
+
it "returns a hash of reserved mswin medium utilization instance pricing" do
|
34
|
+
EC2.reserved_instances(:os => :mswin, :utilization => :medium).class.should == Hash
|
35
|
+
end
|
36
|
+
|
37
|
+
it "returns a hash of reserved mswin heavy utlization instance pricing" do
|
38
|
+
EC2.reserved_instances(:os => :mswin, :utilization => :heavy).class.should == Hash
|
39
|
+
end
|
40
|
+
|
41
|
+
it "raises an error if invalid os is provided" do
|
42
|
+
lambda { EC2.reserved_instances(:os => :macosx) }.should raise_error
|
43
|
+
end
|
44
|
+
|
45
|
+
it "raises an error if invalid utilization is provided" do
|
46
|
+
lambda { EC2.reserved_instances(:utilization => :none) }.should raise_error
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
12
50
|
it "returns a hash of ebs pricing" do
|
13
51
|
EC2.ebs.class.should == Hash
|
14
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-pricing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
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: 2012-
|
12
|
+
date: 2012-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -149,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
segments:
|
151
151
|
- 0
|
152
|
-
hash:
|
152
|
+
hash: 4553429241909489593
|
153
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
154
|
none: false
|
155
155
|
requirements:
|