amazon-pricing 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,6 +36,15 @@ module AwsPricing
36
36
  @_regions.values
37
37
  end
38
38
 
39
+ # Type = :on_demand or :reserved
40
+ # reserved_usage_type = :light, :medium, :heavy
41
+ def get_instance_type(availability_zone, type, api_name, reserved_usage_type = :medium)
42
+ region_name = @@Availability_Zone_Lookup[availability_zone]
43
+ raise "Region not found for availability zone #{availability_zone}" if region_name.nil?
44
+ region = get_region(region_name)
45
+ region.get_instance_type(type, api_name, reserved_usage_type)
46
+ end
47
+
39
48
  protected
40
49
 
41
50
  attr_accessor :_regions
@@ -101,5 +110,14 @@ module AwsPricing
101
110
  EC2_RESERVED_INSTANCE_MEDIUM_PRICING_URL = 'http://aws.amazon.com/ec2/pricing/pricing-reserved-instances.json'
102
111
  EC2_RESERVED_INSTANCE_HEAVY_PRICING_URL = 'http://aws.amazon.com/ec2/pricing/pricing-reserved-instances-high-utilization.json'
103
112
 
113
+ @@Availability_Zone_Lookup = {
114
+ 'us-east-1a' => 'us-east', 'us-east-1b' => 'us-east', 'us-east-1c' => 'us-east',
115
+ 'us-east-1d' => 'us-east', 'us-east-1e' => 'us-east', 'us-west-1a' => 'us-west',
116
+ 'us-west-1b' => 'us-west', 'us-west-1c' => 'us-west', 'us-west-2a' => 'us-west-2',
117
+ 'us-west-2b' => 'us-west-2', 'eu-west-1a' => 'eu-ireland', 'eu-west-1b' => 'eu-ireland',
118
+ 'eu-west-1c' => 'eu-ireland', 'ap-southeast-1a' => 'apac-sin', 'ap-southeast-1b' => 'apac-sin',
119
+ 'ap-northeast-1a' => 'apac-tokyo', 'ap-northeast-1b' => 'apac-tokyo', 'sa-east-1a' => 'sa-east-1',
120
+ 'sa-east-1b' => 'sa-east-1'
121
+ }
104
122
  end
105
123
  end
@@ -8,5 +8,5 @@
8
8
  # Home:: http://github.com/sonian/amazon-pricing
9
9
  #++
10
10
  module AwsPricing
11
- VERSION = '0.0.2'
11
+ VERSION = '0.0.3'
12
12
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-pricing
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joe Kinsella