awscosts 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_linux.yml +1280 -705
  2. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_rhel.yml +1280 -719
  3. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_sles.yml +1280 -719
  4. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows.yml +1280 -429
  5. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows_with_sql.yml +1280 -429
  6. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows_with_sql_web.yml +1280 -429
  7. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_linux.yml +2595 -1595
  8. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_rhel.yml +2595 -1595
  9. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_sles.yml +2581 -1581
  10. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_windows.yml +2582 -1582
  11. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_windows_with_sql.yml +2538 -1538
  12. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_windows_with_sql_web.yml +2569 -1569
  13. data/fixtures/vcr_cassettes/AWSCosts_ElasticIPs.yml +227 -0
  14. data/lib/awscosts/cache.rb +2 -2
  15. data/lib/awscosts/ec2_on_demand.rb +4 -3
  16. data/lib/awscosts/ec2_reserved_instances.rb +2 -2
  17. data/lib/awscosts/version.rb +1 -1
  18. metadata +9 -8
  19. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_linux.yml +0 -1810
  20. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_rhel.yml +0 -1810
  21. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_sles.yml +0 -1810
  22. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_windows.yml +0 -1609
  23. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_windows_with_sql.yml +0 -1810
  24. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_windows_with_sql_web.yml +0 -1810
@@ -0,0 +1,227 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://aws.amazon.com/ec2/pricing/pricing-elastic-ips.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ connection:
11
+ - close
12
+ response:
13
+ status:
14
+ code: 301
15
+ message: Moved Permanently
16
+ headers:
17
+ date:
18
+ - Sat, 22 Mar 2014 23:41:33 GMT
19
+ server:
20
+ - Server
21
+ x-frame-options:
22
+ - SAMEORIGIN
23
+ x-amz-id-1:
24
+ - 1TDQCBW8CHADJ5PQS91Z
25
+ x-amz-id-2:
26
+ - I3OMEZAOHQLTXwCScZ7RpQ7Bp90AZrZdhgi9p+Sp+/NKHnUjuCzRNUs5dL6pOKXLV3zUma/1PC4K
27
+ rsZUHV+c7SjBaoCFvjab
28
+ location:
29
+ - /ec2/pricing/pricing-elastic-ips.json/
30
+ cache-control:
31
+ - no-store, no-cache, must-revalidate
32
+ content-length:
33
+ - '0'
34
+ content-type:
35
+ - text/plain
36
+ vary:
37
+ - User-Agent
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ''
41
+ http_version: '1.1'
42
+ recorded_at: Sat, 22 Mar 2014 23:41:33 GMT
43
+ - request:
44
+ method: get
45
+ uri: http://aws.amazon.com/ec2/pricing/pricing-elastic-ips.json/
46
+ body:
47
+ encoding: US-ASCII
48
+ string: ''
49
+ headers:
50
+ connection:
51
+ - close
52
+ response:
53
+ status:
54
+ code: 301
55
+ message: Moved Permanently
56
+ headers:
57
+ date:
58
+ - Sat, 22 Mar 2014 23:41:34 GMT
59
+ server:
60
+ - Server
61
+ x-frame-options:
62
+ - SAMEORIGIN
63
+ x-amz-id-1:
64
+ - 1Z3MEHBEPZ8HYZQHPAT8
65
+ x-amz-id-2:
66
+ - Y2VF4nAnt893b3ZMEhAaX+ojt8QS9VEKKn2OTgJMPfdcFVnjtklktxl/OXNLukEyxS2QbwoLtu1C
67
+ XdLP8+7fhugPY/ZBtaWU
68
+ location:
69
+ - https://a0.awsstatic.com/pricing/1/deprecated/ec2/pricing-elastic-ips.json
70
+ content-type:
71
+ - text/html;charset=UTF-8
72
+ content-language:
73
+ - en-US
74
+ content-length:
75
+ - '0'
76
+ set-cookie:
77
+ - aws_lang=en; Domain=.amazon.com; Path=/
78
+ vary:
79
+ - User-Agent
80
+ body:
81
+ encoding: US-ASCII
82
+ string: ''
83
+ http_version: '1.1'
84
+ recorded_at: Sat, 22 Mar 2014 23:41:34 GMT
85
+ - request:
86
+ method: get
87
+ uri: https://a0.awsstatic.com/pricing/1/deprecated/ec2/pricing-elastic-ips.json
88
+ body:
89
+ encoding: US-ASCII
90
+ string: ''
91
+ headers:
92
+ cookie:
93
+ - aws_lang=en
94
+ connection:
95
+ - close
96
+ response:
97
+ status:
98
+ code: 200
99
+ message: OK
100
+ headers:
101
+ content-type:
102
+ - application/json; charset=utf-8
103
+ content-length:
104
+ - '7444'
105
+ connection:
106
+ - close
107
+ date:
108
+ - Sat, 22 Mar 2014 23:41:37 GMT
109
+ cache-control:
110
+ - max-age=3600
111
+ last-modified:
112
+ - Thu, 13 Mar 2014 05:27:08 GMT
113
+ etag:
114
+ - ! '"89224941c6de47b6a122b4684a5fbe63"'
115
+ accept-ranges:
116
+ - bytes
117
+ server:
118
+ - AmazonS3
119
+ x-cache:
120
+ - Miss from cloudfront
121
+ via:
122
+ - 1.1 74ee1cbac8fd3a028c779d817d709eb3.cloudfront.net (CloudFront)
123
+ x-amz-cf-id:
124
+ - UjO_ahAD11MaSEhpWGX-fzI9Id3JNMeh_jKiKjcPy67MPnNYtaiAqA==
125
+ body:
126
+ encoding: US-ASCII
127
+ string: ! "{\n \"vers\": 0.01,\n \"config\": {\n \"currencies\": [\n \"USD\"\n
128
+ \ ],\n \"rate\": \"perGB\",\n \"regions\": [\n {\n \"region\":
129
+ \"us-east\",\n \"types\": [\n {\n \"values\": [\n
130
+ \ {\n \"prices\": {\n \"USD\":
131
+ \"0.00\"\n },\n \"rate\": \"oneEIP\"\n },\n
132
+ \ {\n \"prices\": {\n \"USD\":
133
+ \"0.005\"\n },\n \"rate\": \"perAdditionalEIPPerHour\"\n
134
+ \ },\n {\n \"prices\": {\n \"USD\":
135
+ \"0.005\"\n },\n \"rate\": \"perNonAttachedPerHour\"\n
136
+ \ },\n {\n \"prices\": {\n \"USD\":
137
+ \"0.00\"\n },\n \"rate\": \"perRemapFirst100\"\n
138
+ \ },\n {\n \"prices\": {\n \"USD\":
139
+ \"0.10\"\n },\n \"rate\": \"perRemapOver100\"\n
140
+ \ }\n ]\n }\n ]\n },\n {\n
141
+ \ \"region\": \"us-west-2\",\n \"types\": [\n {\n \"values\":
142
+ [\n {\n \"prices\": {\n \"USD\":
143
+ \"0.00\"\n },\n \"rate\": \"oneEIP\"\n },\n
144
+ \ {\n \"prices\": {\n \"USD\":
145
+ \"0.005\"\n },\n \"rate\": \"perAdditionalEIPPerHour\"\n
146
+ \ },\n {\n \"prices\": {\n \"USD\":
147
+ \"0.005\"\n },\n \"rate\": \"perNonAttachedPerHour\"\n
148
+ \ },\n {\n \"prices\": {\n \"USD\":
149
+ \"0.00\"\n },\n \"rate\": \"perRemapFirst100\"\n
150
+ \ },\n {\n \"prices\": {\n \"USD\":
151
+ \"0.10\"\n },\n \"rate\": \"perRemapOver100\"\n
152
+ \ }\n ]\n }\n ]\n },\n {\n
153
+ \ \"region\": \"us-west\",\n \"types\": [\n {\n \"values\":
154
+ [\n {\n \"prices\": {\n \"USD\":
155
+ \"0.00\"\n },\n \"rate\": \"oneEIP\"\n },\n
156
+ \ {\n \"prices\": {\n \"USD\":
157
+ \"0.005\"\n },\n \"rate\": \"perAdditionalEIPPerHour\"\n
158
+ \ },\n {\n \"prices\": {\n \"USD\":
159
+ \"0.005\"\n },\n \"rate\": \"perNonAttachedPerHour\"\n
160
+ \ },\n {\n \"prices\": {\n \"USD\":
161
+ \"0.00\"\n },\n \"rate\": \"perRemapFirst100\"\n
162
+ \ },\n {\n \"prices\": {\n \"USD\":
163
+ \"0.10\"\n },\n \"rate\": \"perRemapOver100\"\n
164
+ \ }\n ]\n }\n ]\n },\n {\n
165
+ \ \"region\": \"eu-ireland\",\n \"types\": [\n {\n \"values\":
166
+ [\n {\n \"prices\": {\n \"USD\":
167
+ \"0.00\"\n },\n \"rate\": \"oneEIP\"\n },\n
168
+ \ {\n \"prices\": {\n \"USD\":
169
+ \"0.005\"\n },\n \"rate\": \"perAdditionalEIPPerHour\"\n
170
+ \ },\n {\n \"prices\": {\n \"USD\":
171
+ \"0.005\"\n },\n \"rate\": \"perNonAttachedPerHour\"\n
172
+ \ },\n {\n \"prices\": {\n \"USD\":
173
+ \"0.00\"\n },\n \"rate\": \"perRemapFirst100\"\n
174
+ \ },\n {\n \"prices\": {\n \"USD\":
175
+ \"0.10\"\n },\n \"rate\": \"perRemapOver100\"\n
176
+ \ }\n ]\n }\n ]\n },\n {\n
177
+ \ \"region\": \"apac-sin\",\n \"types\": [\n {\n \"values\":
178
+ [\n {\n \"prices\": {\n \"USD\":
179
+ \"0.00\"\n },\n \"rate\": \"oneEIP\"\n },\n
180
+ \ {\n \"prices\": {\n \"USD\":
181
+ \"0.005\"\n },\n \"rate\": \"perAdditionalEIPPerHour\"\n
182
+ \ },\n {\n \"prices\": {\n \"USD\":
183
+ \"0.005\"\n },\n \"rate\": \"perNonAttachedPerHour\"\n
184
+ \ },\n {\n \"prices\": {\n \"USD\":
185
+ \"0.00\"\n },\n \"rate\": \"perRemapFirst100\"\n
186
+ \ },\n {\n \"prices\": {\n \"USD\":
187
+ \"0.10\"\n },\n \"rate\": \"perRemapOver100\"\n
188
+ \ }\n ]\n }\n ]\n },\n {\n
189
+ \ \"region\": \"apac-tokyo\",\n \"types\": [\n {\n \"values\":
190
+ [\n {\n \"prices\": {\n \"USD\":
191
+ \"0.00\"\n },\n \"rate\": \"oneEIP\"\n },\n
192
+ \ {\n \"prices\": {\n \"USD\":
193
+ \"0.005\"\n },\n \"rate\": \"perAdditionalEIPPerHour\"\n
194
+ \ },\n {\n \"prices\": {\n \"USD\":
195
+ \"0.005\"\n },\n \"rate\": \"perNonAttachedPerHour\"\n
196
+ \ },\n {\n \"prices\": {\n \"USD\":
197
+ \"0.00\"\n },\n \"rate\": \"perRemapFirst100\"\n
198
+ \ },\n {\n \"prices\": {\n \"USD\":
199
+ \"0.10\"\n },\n \"rate\": \"perRemapOver100\"\n
200
+ \ }\n ]\n }\n ]\n },\n {\n
201
+ \ \"region\": \"apac-syd\",\n \"types\": [\n {\n \"values\":
202
+ [\n {\n \"prices\": {\n \"USD\":
203
+ \"0.00\"\n },\n \"rate\": \"oneEIP\"\n },\n
204
+ \ {\n \"prices\": {\n \"USD\":
205
+ \"0.005\"\n },\n \"rate\": \"perAdditionalEIPPerHour\"\n
206
+ \ },\n {\n \"prices\": {\n \"USD\":
207
+ \"0.005\"\n },\n \"rate\": \"perNonAttachedPerHour\"\n
208
+ \ },\n {\n \"prices\": {\n \"USD\":
209
+ \"0.00\"\n },\n \"rate\": \"perRemapFirst100\"\n
210
+ \ },\n {\n \"prices\": {\n \"USD\":
211
+ \"0.10\"\n },\n \"rate\": \"perRemapOver100\"\n
212
+ \ }\n ]\n }\n ]\n },\n {\n
213
+ \ \"region\": \"sa-east-1\",\n \"types\": [\n {\n \"values\":
214
+ [\n {\n \"prices\": {\n \"USD\":
215
+ \"0.00\"\n },\n \"rate\": \"oneEIP\"\n },\n
216
+ \ {\n \"prices\": {\n \"USD\":
217
+ \"0.005\"\n },\n \"rate\": \"perAdditionalEIPPerHour\"\n
218
+ \ },\n {\n \"prices\": {\n \"USD\":
219
+ \"0.005\"\n },\n \"rate\": \"perNonAttachedPerHour\"\n
220
+ \ },\n {\n \"prices\": {\n \"USD\":
221
+ \"0.00\"\n },\n \"rate\": \"perRemapFirst100\"\n
222
+ \ },\n {\n \"prices\": {\n \"USD\":
223
+ \"0.10\"\n },\n \"rate\": \"perRemapOver100\"\n
224
+ \ }\n ]\n }\n ]\n }\n ]\n }\n}\n"
225
+ http_version: '1.1'
226
+ recorded_at: Sat, 22 Mar 2014 23:41:36 GMT
227
+ recorded_with: VCR 2.0.1
@@ -6,9 +6,9 @@ module AWSCosts::Cache
6
6
 
7
7
  BASE_URI = "http://aws.amazon.com"
8
8
 
9
- def get uri, &block
9
+ def get uri, base_uri = BASE_URI, &block
10
10
  cache[uri] ||= begin
11
- yield JSON.parse(HTTParty.get("#{BASE_URI}#{uri}").body)
11
+ yield JSON.parse(HTTParty.get("#{base_uri}#{uri}").body)
12
12
  end
13
13
  end
14
14
 
@@ -30,7 +30,7 @@ class AWSCosts::EC2OnDemand
30
30
  end
31
31
 
32
32
  def self.fetch type, region
33
- transformed= AWSCosts::Cache.get("/ec2/pricing/json/#{type}-od.json") do |data|
33
+ transformed= AWSCosts::Cache.get("/pricing/1/deprecated/ec2/#{type}-od.json", 'https://a0.awsstatic.com') do |data|
34
34
  result = {}
35
35
  data['config']['regions'].each do |region|
36
36
  platforms = {}
@@ -44,7 +44,7 @@ class AWSCosts::EC2OnDemand
44
44
 
45
45
  platform_cost.each_pair do |p,v|
46
46
  platforms[p] = {} unless platforms.key?(p)
47
- platforms[p][TYPE_TRANSLATION["#{instance_type['type']}.#{size}"]] = v
47
+ platforms[p][size] = v
48
48
  end
49
49
  end
50
50
  end
@@ -52,7 +52,8 @@ class AWSCosts::EC2OnDemand
52
52
  end
53
53
  result
54
54
  end
55
- type == 'sles' ? self.new(transformed[region]['linux']) :self.new(transformed[region][type])
55
+ #type == 'sles' ? self.new(transformed[region]['linux']) :
56
+ self.new(transformed[region][type])
56
57
  end
57
58
 
58
59
  end
@@ -44,7 +44,7 @@ class AWSCosts::EC2ReservedInstances
44
44
 
45
45
 
46
46
  def self.fetch type, utilisation, region
47
- transformed= AWSCosts::Cache.get("/ec2/pricing/json/#{type}-ri-#{utilisation}.json") do |data|
47
+ transformed= AWSCosts::Cache.get("/pricing/1/deprecated/ec2/#{type}-ri-#{utilisation}.json", 'https://a0.awsstatic.com') do |data|
48
48
  result = {}
49
49
  data['config']['regions'].each do |region|
50
50
  platforms = {}
@@ -59,7 +59,7 @@ class AWSCosts::EC2ReservedInstances
59
59
 
60
60
  platform_cost.each_pair do |p,v|
61
61
  platforms[p] = {} unless platforms.key?(p)
62
- platforms[p][TYPE_TRANSLATION["#{instance_type['type']}.#{size}"]] = v
62
+ platforms[p][size] = v
63
63
  end
64
64
  end
65
65
  end
@@ -1,3 +1,3 @@
1
1
  module AWSCosts
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awscosts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
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: 2013-09-24 00:00:00.000000000 Z
12
+ date: 2014-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -128,12 +128,6 @@ files:
128
128
  - fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows.yml
129
129
  - fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows_with_sql.yml
130
130
  - fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows_with_sql_web.yml
131
- - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_linux.yml
132
- - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_rhel.yml
133
- - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_sles.yml
134
- - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_windows.yml
135
- - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_windows_with_sql.yml
136
- - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/EC2_type_of_windows_with_sql_web.yml
137
131
  - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_linux.yml
138
132
  - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_rhel.yml
139
133
  - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_sles.yml
@@ -142,6 +136,7 @@ files:
142
136
  - fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_windows_with_sql_web.yml
143
137
  - fixtures/vcr_cassettes/AWSCosts_ELB.yml
144
138
  - fixtures/vcr_cassettes/AWSCosts_EMR.yml
139
+ - fixtures/vcr_cassettes/AWSCosts_ElasticIPs.yml
145
140
  - fixtures/vcr_cassettes/AWSCosts_S3DataTransfer.yml
146
141
  - fixtures/vcr_cassettes/AWSCosts_S3Requests.yml
147
142
  - fixtures/vcr_cassettes/AWSCosts_S3Storage.yml
@@ -185,12 +180,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
180
  - - ! '>='
186
181
  - !ruby/object:Gem::Version
187
182
  version: '0'
183
+ segments:
184
+ - 0
185
+ hash: -374550561017871658
188
186
  required_rubygems_version: !ruby/object:Gem::Requirement
189
187
  none: false
190
188
  requirements:
191
189
  - - ! '>='
192
190
  - !ruby/object:Gem::Version
193
191
  version: '0'
192
+ segments:
193
+ - 0
194
+ hash: -374550561017871658
194
195
  requirements: []
195
196
  rubyforge_project:
196
197
  rubygems_version: 1.8.23