sumomo 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5afe976ced95ce2651431c9125cf3cb98bcb2dc2
4
- data.tar.gz: 5013187886398f934a3bd239e7daca669c0d1006
3
+ metadata.gz: 4255d512423fee95d9245af4dc38370a92be5758
4
+ data.tar.gz: 48e6ecfb8f7e195e5cc097767a907623d879daca
5
5
  SHA512:
6
- metadata.gz: 2e869be9ae97deaa9022d783e690710a233bed41a2e0599c93b04592ade931b834943397b90da1ee7ab9eaf30b7cd422a5ed417480ff8682d65eecbbde9f2670
7
- data.tar.gz: 1fe0ba94f74065bf35148ed131a492e22d98fdb60f7e44ec47e188fc7e3467c42248c8ea4590842d1b653a0ed5a3e1b99a1476e6cdf80aa27766a6b462a32dd9
6
+ metadata.gz: 8c4218acfc12a12d273e47191c3462f948ca3f3f89ac0d4ff15baecfb095c2113fe006840c7a42f8ed1392b1a22217ae34449d6faa1c5205099b676d2e5b916c
7
+ data.tar.gz: dd1cee341e3307686caff94e04000098a132149435137d10eb027c2dc4104dc39e8867a577f7ae5b9e8726376294d70d198fafcc9fec648229b0a3d26f4018ee
@@ -75,11 +75,47 @@ function Storage()
75
75
  });
76
76
  }
77
77
 
78
+ this.list = function(prefix, start_after, onComplete, onError)
79
+ {
80
+ var params = {
81
+ Bucket: "{{ BUCKET }}",
82
+ Prefix: "data/{{ STORE_PREFIX }}/" + prefix
83
+ }
84
+
85
+ if (start_after)
86
+ {
87
+ params.StartAfter = start_after;
88
+ }
89
+
90
+ s3.listObjectsV2(params, function(err, data) {
91
+ if (err)
92
+ {
93
+ if (onError)
94
+ {
95
+ onError(err);
96
+ }
97
+ }
98
+ else
99
+ {
100
+ if (onComplete)
101
+ {
102
+ onComplete(data.Contents.map(function(x){ return x.Key; }));
103
+ }
104
+ }
105
+ });
106
+ }
107
+
78
108
  return this;
79
109
  }
80
110
 
81
111
  var Store = new Storage();
82
112
 
113
+ function decode_component(str) {
114
+ str = str.replace(/\+/g, '%20');
115
+ str = decodeURIComponent(str);
116
+ return str;
117
+ }
118
+
83
119
  function parseQuery(queryString) {
84
120
  try
85
121
  {
@@ -91,7 +127,7 @@ function parseQuery(queryString) {
91
127
  var pairs = queryString.split('&');
92
128
  for (var i = 0; i < pairs.length; i++) {
93
129
  var pair = pairs[i].split('=');
94
- query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
130
+ query[decode_component(pair[0])] = decode_component(pair[1] || '');
95
131
  }
96
132
  return query;
97
133
  }
@@ -12,50 +12,81 @@ var fs = require('fs')
12
12
  // Simulated store
13
13
  function Storage()
14
14
  {
15
- var store = {}
16
-
17
- try
18
- {
19
- var store_contents = fs.readFileSync(".store")
20
- store = JSON.parse(store_contents)
21
- }
22
- catch (e)
23
- {
24
- console.log("Error reading .store; will start with blank store")
25
- console.log(e)
26
- }
27
-
28
- this.get = function(key, onComplete, onError)
29
- {
30
- if (store[key] === undefined)
31
- {
32
- if (onError)
33
- {
34
- onError({err: "no_such_key"});
35
- }
36
- }
37
- else
38
- {
39
- if (onComplete)
40
- {
41
- onComplete(store[key]);
42
- }
43
- }
44
- }
45
-
46
- this.set = function(key, value, onComplete, onError)
47
- {
48
- store[key] = value;
49
- fs.writeFile(".store", JSON.stringify(store), function()
50
- {
51
- if (onComplete)
52
- {
53
- onComplete(key);
54
- }
55
- })
56
- }
57
-
58
- return this;
15
+ var store = {}
16
+
17
+ try
18
+ {
19
+ var store_contents = fs.readFileSync(".store")
20
+ store = JSON.parse(store_contents)
21
+ }
22
+ catch (e)
23
+ {
24
+ console.log("Error reading .store; will start with blank store")
25
+ console.log(e)
26
+ }
27
+
28
+ this.get = function(key, onComplete, onError)
29
+ {
30
+ if (store[key] === undefined)
31
+ {
32
+ if (onError)
33
+ {
34
+ onError({err: "no_such_key"});
35
+ }
36
+ }
37
+ else
38
+ {
39
+ if (onComplete)
40
+ {
41
+ onComplete(store[key]);
42
+ }
43
+ }
44
+ }
45
+
46
+ this.set = function(key, value, onComplete, onError)
47
+ {
48
+ store[key] = value;
49
+ fs.writeFile(".store", JSON.stringify(store), function()
50
+ {
51
+ if (onComplete)
52
+ {
53
+ onComplete(key);
54
+ }
55
+ })
56
+ }
57
+
58
+ this.list = function(prefix, start_after, onComplete, onError)
59
+ {
60
+ var result = [];
61
+ var start = true;
62
+ if (start_after)
63
+ {
64
+ start = false;
65
+ }
66
+ var count = 0;
67
+ var keys = Object.keys(store);
68
+ for (var i in keys)
69
+ {
70
+ var x = keys[i];
71
+ if (x === start_after)
72
+ {
73
+ start = true;
74
+ }
75
+
76
+ if (start && x.indexOf(prefix) === 0)
77
+ {
78
+ result.push(x);
79
+ count += 1;
80
+ }
81
+ };
82
+
83
+ if (onComplete)
84
+ {
85
+ onComplete(result);
86
+ }
87
+ }
88
+
89
+ return this;
59
90
  }
60
91
 
61
92
  var Store = new Storage();
@@ -66,34 +97,40 @@ var response_sent = false;
66
97
 
67
98
  var server = http.createServer(function(req, res) {
68
99
 
69
- var request = {
70
- _native_req: req,
71
- url: req.url,
72
- method: req.method,
73
- params: {}
74
- }
100
+ var request = {
101
+ _native_req: req,
102
+ url: req.url,
103
+ method: req.method,
104
+ params: {}
105
+ }
75
106
 
76
- router(request, res, function(err) {
107
+ router(request, res, function(err) {
77
108
 
78
- res.statusCode = 404;
79
- res.end(JSON.stringify({message: "File not found"}));
80
- });
109
+ res.statusCode = 404;
110
+ res.end(JSON.stringify({message: "File not found"}));
111
+ });
81
112
  });
82
113
 
114
+ function decode_component(str) {
115
+ str = str.replace(/\+/g, '%20');
116
+ str = decodeURIComponent(str);
117
+ return str;
118
+ }
119
+
83
120
  function parseQuery(queryString) {
84
- try
85
- {
86
- var res = JSON.parse(queryString)
87
- return res;
88
- }
89
- catch(e) { }
90
- var query = {};
91
- var pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&');
92
- for (var i = 0; i < pairs.length; i++) {
93
- var pair = pairs[i].split('=');
94
- query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
95
- }
96
- return query;
121
+ try
122
+ {
123
+ var res = JSON.parse(queryString)
124
+ return res;
125
+ }
126
+ catch(e) { }
127
+ var query = {};
128
+ var pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&');
129
+ for (var i = 0; i < pairs.length; i++) {
130
+ var pair = pairs[i].split('=');
131
+ query[decode_component(pair[0])] = decode_component(pair[1] || '');
132
+ }
133
+ return query;
97
134
  }
98
135
 
99
136
  {{ SCRIPT }}
@@ -101,114 +138,114 @@ function parseQuery(queryString) {
101
138
  // Simulate API Gateway Lambda Proxy Event
102
139
  function prepare(handler)
103
140
  {
104
- return function(request, res)
105
- {
106
- var body = [];
107
- var req = request._native_req;
108
-
109
- function callback(exception, response)
110
- {
111
- if (response.headers)
112
- {
113
- for (var key in response.headers)
114
- {
115
- res.setHeader(key, response.headers[key]);
116
- }
117
- }
118
- res.statusCode = response.statusCode || 404;
119
- res.end(response.body || null);
120
- }
121
-
122
- req.on('data', function(chunk) {
123
- body.push(chunk);
124
-
125
- }).on('end', function() {
126
-
127
- var completed_body = Buffer.concat(body).toString();
128
-
129
- var parsed_url = url.parse(req.url, true);
130
-
131
- var headers = {};
132
-
133
- headers["Accept"] = "*/*";
134
- headers["CloudFront-Forwarded-Proto"] = "https";
135
- headers["CloudFront-Is-Desktop-Viewer"] = "true";
136
- headers["CloudFront-Is-Mobile-Viewer"] = "false";
137
- headers["CloudFront-Is-SmartTV-Viewer"] = "false";
138
- headers["CloudFront-Is-Tablet-Viewer"] = "false";
139
- headers["CloudFront-Viewer-Country"] = "US";
140
- headers["Content-Type"] = "";
141
- headers["Host"] = "";
142
- headers["User-Agent"] = "";
143
- headers["Via"] = "1.1 1234567890abcdefghijklmnopqrstuv.cloudfront.net (CloudFront)";
144
- headers["X-Amz-Cf-Id"] = "0000000000000000000000000-000000000-000000000000000000==";
145
- headers["X-Amzn-Trace-Id"] = "Root=1-00000000-ffffffffffffffffffffffff";
146
- headers["X-Forwarded-For"] = req.connection.remoteAddress;
147
- headers["X-Forwarded-Port"] = "443";
148
- headers["X-Forwarded-Proto"] = "https";
149
-
150
- for(var key in req.headers)
151
- {
152
- var uppercased = key.replace(/(^|-)[a-z]/g, function(text){ return text.toUpperCase(); });
153
-
154
- headers[uppercased] = req.headers[key];
155
- }
156
-
157
- var request_event = {
158
- resource: "/{proxy+}",
159
- path: parsed_url.pathname,
160
- httpMethod: req.method,
161
- headers: headers,
162
- queryStringParameters: url.parse(req.url, true).query,
163
- pathParameters: request.params,
164
- stageVariables: null,
165
- requestContext: {
166
- path: parsed_url.pathname,
167
- accountId: "000000000000",
168
- resourceId: "123abc",
169
- stage: "test",
170
- requestId: "00000000-0000-0000-0000-000000000000",
171
- identity: {
172
- cognitoIdentityId: null,
173
- accountId: null,
174
- cognitoIdentityId: null,
175
- caller: null,
176
- apiKey: "",
177
- sourceIp: req.connection.remoteAddress,
178
- accessKey: null,
179
- cognitoAuthenticationType: null,
180
- cognitoAuthenticationProvider: null,
181
- userArn: null,
182
- userAgent: headers["User-Agent"],
183
- user: null
184
-
185
- },
186
- resourcePath: "/{proxy+}",
187
- httpMethod: req.method,
188
- apiId: "12345abcde"
189
- },
190
-
191
- body: completed_body,
192
- isBase64Encoded: false
193
-
194
- };
195
-
196
- req._native_req = undefined;
197
-
198
- try
199
- {
200
- handler(request_event, callback);
201
- }
202
- catch (e)
203
- {
204
- console.log(e);
205
- callback(e, {
206
- statusCode: 500,
207
- body: JSON.stringify({message: "Internal Server Error"}, null, 2)
208
- });
209
- }
210
- });
211
- };
141
+ return function(request, res)
142
+ {
143
+ var body = [];
144
+ var req = request._native_req;
145
+
146
+ function callback(exception, response)
147
+ {
148
+ if (response.headers)
149
+ {
150
+ for (var key in response.headers)
151
+ {
152
+ res.setHeader(key, response.headers[key]);
153
+ }
154
+ }
155
+ res.statusCode = response.statusCode || 404;
156
+ res.end(response.body || null);
157
+ }
158
+
159
+ req.on('data', function(chunk) {
160
+ body.push(chunk);
161
+
162
+ }).on('end', function() {
163
+
164
+ var completed_body = Buffer.concat(body).toString();
165
+
166
+ var parsed_url = url.parse(req.url, true);
167
+
168
+ var headers = {};
169
+
170
+ headers["Accept"] = "*/*";
171
+ headers["CloudFront-Forwarded-Proto"] = "https";
172
+ headers["CloudFront-Is-Desktop-Viewer"] = "true";
173
+ headers["CloudFront-Is-Mobile-Viewer"] = "false";
174
+ headers["CloudFront-Is-SmartTV-Viewer"] = "false";
175
+ headers["CloudFront-Is-Tablet-Viewer"] = "false";
176
+ headers["CloudFront-Viewer-Country"] = "US";
177
+ headers["Content-Type"] = "";
178
+ headers["Host"] = "";
179
+ headers["User-Agent"] = "";
180
+ headers["Via"] = "1.1 1234567890abcdefghijklmnopqrstuv.cloudfront.net (CloudFront)";
181
+ headers["X-Amz-Cf-Id"] = "0000000000000000000000000-000000000-000000000000000000==";
182
+ headers["X-Amzn-Trace-Id"] = "Root=1-00000000-ffffffffffffffffffffffff";
183
+ headers["X-Forwarded-For"] = req.connection.remoteAddress;
184
+ headers["X-Forwarded-Port"] = "443";
185
+ headers["X-Forwarded-Proto"] = "https";
186
+
187
+ for(var key in req.headers)
188
+ {
189
+ var uppercased = key.replace(/(^|-)[a-z]/g, function(text){ return text.toUpperCase(); });
190
+
191
+ headers[uppercased] = req.headers[key];
192
+ }
193
+
194
+ var request_event = {
195
+ resource: "/{proxy+}",
196
+ path: parsed_url.pathname,
197
+ httpMethod: req.method,
198
+ headers: headers,
199
+ queryStringParameters: url.parse(req.url, true).query,
200
+ pathParameters: request.params,
201
+ stageVariables: null,
202
+ requestContext: {
203
+ path: parsed_url.pathname,
204
+ accountId: "000000000000",
205
+ resourceId: "123abc",
206
+ stage: "test",
207
+ requestId: "00000000-0000-0000-0000-000000000000",
208
+ identity: {
209
+ cognitoIdentityId: null,
210
+ accountId: null,
211
+ cognitoIdentityId: null,
212
+ caller: null,
213
+ apiKey: "",
214
+ sourceIp: req.connection.remoteAddress,
215
+ accessKey: null,
216
+ cognitoAuthenticationType: null,
217
+ cognitoAuthenticationProvider: null,
218
+ userArn: null,
219
+ userAgent: headers["User-Agent"],
220
+ user: null
221
+
222
+ },
223
+ resourcePath: "/{proxy+}",
224
+ httpMethod: req.method,
225
+ apiId: "12345abcde"
226
+ },
227
+
228
+ body: completed_body,
229
+ isBase64Encoded: false
230
+
231
+ };
232
+
233
+ req._native_req = undefined;
234
+
235
+ try
236
+ {
237
+ handler(request_event, callback);
238
+ }
239
+ catch (e)
240
+ {
241
+ console.log(e);
242
+ callback(e, {
243
+ statusCode: 500,
244
+ body: JSON.stringify({message: "Internal Server Error"}, null, 2)
245
+ });
246
+ }
247
+ });
248
+ };
212
249
  }
213
250
 
214
251
  // {{ ROUTES }}
@@ -1,59 +1,147 @@
1
1
 
2
2
  var typeToArch = {
3
- "t1.micro" : "PV64" ,
4
- "t2.nano" : "HVM64",
5
- "t2.micro" : "HVM64",
6
- "t2.small" : "HVM64",
7
- "t2.medium" : "HVM64",
8
- "t2.large" : "HVM64",
9
- "m1.small" : "PV64" ,
10
- "m1.medium" : "PV64" ,
11
- "m1.large" : "PV64" ,
12
- "m1.xlarge" : "PV64" ,
13
- "m2.xlarge" : "PV64" ,
14
- "m2.2xlarge" : "PV64" ,
15
- "m2.4xlarge" : "PV64" ,
16
- "m3.medium" : "HVM64",
17
- "m3.large" : "HVM64",
18
- "m3.xlarge" : "HVM64",
19
- "m3.2xlarge" : "HVM64",
20
- "m4.large" : "HVM64",
21
- "m4.xlarge" : "HVM64",
22
- "m4.2xlarge" : "HVM64",
23
- "m4.4xlarge" : "HVM64",
24
- "m4.10xlarge" : "HVM64",
25
- "c1.medium" : "PV64" ,
26
- "c1.xlarge" : "PV64" ,
27
- "c3.large" : "HVM64",
28
- "c3.xlarge" : "HVM64",
29
- "c3.2xlarge" : "HVM64",
30
- "c3.4xlarge" : "HVM64",
31
- "c3.8xlarge" : "HVM64",
32
- "c4.large" : "HVM64",
33
- "c4.xlarge" : "HVM64",
34
- "c4.2xlarge" : "HVM64",
35
- "c4.4xlarge" : "HVM64",
36
- "c4.8xlarge" : "HVM64",
37
- "g2.2xlarge" : "HVMG2",
38
- "g2.8xlarge" : "HVMG2",
39
- "r3.large" : "HVM64",
40
- "r3.xlarge" : "HVM64",
41
- "r3.2xlarge" : "HVM64",
42
- "r3.4xlarge" : "HVM64",
43
- "r3.8xlarge" : "HVM64",
44
- "i2.xlarge" : "HVM64",
45
- "i2.2xlarge" : "HVM64",
46
- "i2.4xlarge" : "HVM64",
47
- "i2.8xlarge" : "HVM64",
48
- "d2.xlarge" : "HVM64",
49
- "d2.2xlarge" : "HVM64",
50
- "d2.4xlarge" : "HVM64",
51
- "d2.8xlarge" : "HVM64",
52
- "hi1.4xlarge" : "HVM64",
53
- "hs1.8xlarge" : "HVM64",
54
- "cr1.8xlarge" : "HVM64",
55
- "cc2.8xlarge" : "HVM64"
56
- }
3
+ "c1.medium": "PV64",
4
+ "c1.xlarge": "PV64",
5
+ "c3.2xlarge": "HVM64",
6
+ "c3.4xlarge": "HVM64",
7
+ "c3.8xlarge": "HVM64",
8
+ "c3.large": "HVM64",
9
+ "c3.xlarge": "HVM64",
10
+ "c4.2xlarge": "HVM64",
11
+ "c4.4xlarge": "HVM64",
12
+ "c4.8xlarge": "HVM64",
13
+ "c4.large": "HVM64",
14
+ "c4.xlarge": "HVM64",
15
+ "c5.18xlarge": "HVM64",
16
+ "c5.2xlarge": "HVM64",
17
+ "c5.4xlarge": "HVM64",
18
+ "c5.9xlarge": "HVM64",
19
+ "c5.large": "HVM64",
20
+ "c5.xlarge": "HVM64",
21
+ "c5d.18xlarge": "HVM64",
22
+ "c5d.2xlarge": "HVM64",
23
+ "c5d.4xlarge": "HVM64",
24
+ "c5d.9xlarge": "HVM64",
25
+ "c5d.large": "HVM64",
26
+ "c5d.xlarge": "HVM64",
27
+ "cc2.8xlarge": "HVM64",
28
+ "cr1.8xlarge": "HVM64",
29
+ "d2.2xlarge": "HVM64",
30
+ "d2.4xlarge": "HVM64",
31
+ "d2.8xlarge": "HVM64",
32
+ "d2.xlarge": "HVM64",
33
+ "f1.16xlarge": "HVM64",
34
+ "f1.2xlarge": "HVM64",
35
+ "f1.4xlarge": "HVM64",
36
+ "g2.2xlarge": "HVMG2",
37
+ "g2.8xlarge": "HVMG2",
38
+ "g3.16xlarge": "HVMG2",
39
+ "g3.4xlarge": "HVMG2",
40
+ "g3.8xlarge": "HVMG2",
41
+ "h1.16xlarge": "HVM64",
42
+ "h1.2xlarge": "HVM64",
43
+ "h1.4xlarge": "HVM64",
44
+ "h1.8xlarge": "HVM64",
45
+ "hs1.8xlarge": "HVM64",
46
+ "i2.2xlarge": "HVM64",
47
+ "i2.4xlarge": "HVM64",
48
+ "i2.8xlarge": "HVM64",
49
+ "i2.xlarge": "HVM64",
50
+ "i3.16xlarge": "HVM64",
51
+ "i3.2xlarge": "HVM64",
52
+ "i3.4xlarge": "HVM64",
53
+ "i3.8xlarge": "HVM64",
54
+ "i3.large": "HVM64",
55
+ "i3.metal": "HVM64",
56
+ "i3.xlarge": "HVM64",
57
+ "m1.large": "PV64",
58
+ "m1.medium": "PV64",
59
+ "m1.small": "PV64",
60
+ "m1.xlarge": "PV64",
61
+ "m2.2xlarge": "PV64",
62
+ "m2.4xlarge": "PV64",
63
+ "m2.xlarge": "PV64",
64
+ "m3.2xlarge": "HVM64",
65
+ "m3.large": "HVM64",
66
+ "m3.medium": "HVM64",
67
+ "m3.xlarge": "HVM64",
68
+ "m4.10xlarge": "HVM64",
69
+ "m4.16xlarge": "HVM64",
70
+ "m4.2xlarge": "HVM64",
71
+ "m4.4xlarge": "HVM64",
72
+ "m4.large": "HVM64",
73
+ "m4.xlarge": "HVM64",
74
+ "m5.12xlarge": "HVM64",
75
+ "m5.24xlarge": "HVM64",
76
+ "m5.2xlarge": "HVM64",
77
+ "m5.4xlarge": "HVM64",
78
+ "m5.large": "HVM64",
79
+ "m5.xlarge": "HVM64",
80
+ "m5d.12xlarge": "HVM64",
81
+ "m5d.24xlarge": "HVM64",
82
+ "m5d.2xlarge": "HVM64",
83
+ "m5d.4xlarge": "HVM64",
84
+ "m5d.large": "HVM64",
85
+ "m5d.xlarge": "HVM64",
86
+ "p2.16xlarge": "HVM64",
87
+ "p2.8xlarge": "HVM64",
88
+ "p2.xlarge": "HVM64",
89
+ "p3.16xlarge": "HVM64",
90
+ "p3.2xlarge": "HVM64",
91
+ "p3.8xlarge": "HVM64",
92
+ "r3.2xlarge": "HVM64",
93
+ "r3.4xlarge": "HVM64",
94
+ "r3.8xlarge": "HVM64",
95
+ "r3.large": "HVM64",
96
+ "r3.xlarge": "HVM64",
97
+ "r4.16xlarge": "HVM64",
98
+ "r4.2xlarge": "HVM64",
99
+ "r4.4xlarge": "HVM64",
100
+ "r4.8xlarge": "HVM64",
101
+ "r4.large": "HVM64",
102
+ "r4.xlarge": "HVM64",
103
+ "r5.12xlarge": "HVM64",
104
+ "r5.24xlarge": "HVM64",
105
+ "r5.2xlarge": "HVM64",
106
+ "r5.4xlarge": "HVM64",
107
+ "r5.large": "HVM64",
108
+ "r5.xlarge": "HVM64",
109
+ "r5d.12xlarge": "HVM64",
110
+ "r5d.24xlarge": "HVM64",
111
+ "r5d.2xlarge": "HVM64",
112
+ "r5d.4xlarge": "HVM64",
113
+ "r5d.large": "HVM64",
114
+ "r5d.xlarge": "HVM64",
115
+ "t1.micro": "PV64",
116
+ "t2.2xlarge": "HVM64",
117
+ "t2.large": "HVM64",
118
+ "t2.medium": "HVM64",
119
+ "t2.micro": "HVM64",
120
+ "t2.nano": "HVM64",
121
+ "t2.small": "HVM64",
122
+ "t2.xlarge": "HVM64",
123
+ "t3.2xlarge": "HVM64",
124
+ "t3.large": "HVM64",
125
+ "t3.medium": "HVM64",
126
+ "t3.micro": "HVM64",
127
+ "t3.nano": "HVM64",
128
+ "t3.small": "HVM64",
129
+ "t3.xlarge": "HVM64",
130
+ "x1.16xlarge": "HVM64",
131
+ "x1.32xlarge": "HVM64",
132
+ "x1e.16xlarge": "HVM64",
133
+ "x1e.2xlarge": "HVM64",
134
+ "x1e.32xlarge": "HVM64",
135
+ "x1e.4xlarge": "HVM64",
136
+ "x1e.8xlarge": "HVM64",
137
+ "x1e.xlarge": "HVM64",
138
+ "z1d.12xlarge": "HVM64",
139
+ "z1d.2xlarge": "HVM64",
140
+ "z1d.3xlarge": "HVM64",
141
+ "z1d.6xlarge": "HVM64",
142
+ "z1d.large": "HVM64",
143
+ "z1d.xlarge": "HVM64",
144
+ }
57
145
 
58
146
  var archToAMINamePattern = {
59
147
  "PV64": "amzn-ami-pv*.x86_64-ebs",
@@ -15,60 +15,148 @@ var want_to_pay = request.ResourceProperties.TargetPrice;
15
15
  var exclude = exclude_string.split(",")
16
16
 
17
17
  var typeToCapability = {
18
- "t1.micro" : { cpu: 1024, memory: 1024, gen: 1, ecu: 1024},
19
- "t2.nano" : { cpu: 1024, memory: 512, gen: 2, ecu: 1024},
20
- "t2.micro" : { cpu: 1024, memory: 1024, gen: 2, ecu: 1024},
21
- "t2.small" : { cpu: 1024, memory: 2048, gen: 2, ecu: 1024},
22
- "t2.medium" : { cpu: 2048, memory: 4096, gen: 2, ecu: 2048},
23
- "t2.large" : { cpu: 2048, memory: 8192, gen: 2, ecu: 2048},
24
- "m1.small" : { cpu: 1024, memory: 1740, gen: 1, ecu: 1024},
25
- "m1.medium" : { cpu: 1024, memory: 3840, gen: 1, ecu: 2048},
26
- "m1.large" : { cpu: 2048, memory: 7680, gen: 1, ecu: 4096},
27
- "m1.xlarge" : { cpu: 4096, memory: 15360, gen: 1, ecu: 8192},
28
- "m2.xlarge" : { cpu: 2048, memory: 17510, gen: 2, ecu: 6656},
29
- "m2.2xlarge" : { cpu: 4096, memory: 35020, gen: 2, ecu: 13312},
30
- "m2.4xlarge" : { cpu: 8192, memory: 70040, gen: 2, ecu: 26624},
31
- "m3.medium" : { cpu: 1024, memory: 3840, gen: 3, ecu: 3072},
32
- "m3.large" : { cpu: 2048, memory: 7680, gen: 3, ecu: 6656},
33
- "m3.xlarge" : { cpu: 4096, memory: 15360, gen: 3, ecu: 13312},
34
- "m3.2xlarge" : { cpu: 8192, memory: 30720, gen: 3, ecu: 26624},
35
- "m4.large" : { cpu: 2048, memory: 8192, gen: 4, ecu: 6656},
36
- "m4.xlarge" : { cpu: 4096, memory: 16384, gen: 4, ecu: 13312},
37
- "m4.2xlarge" : { cpu: 8192, memory: 32768, gen: 4, ecu: 26624},
38
- "m4.4xlarge" : { cpu: 16384, memory: 65536, gen: 4, ecu: 54784},
39
- "m4.10xlarge" : { cpu: 40960, memory:163840, gen: 4, ecu: 127488},
40
- "c1.medium" : { cpu: 2048, memory: 1740, gen: 1, ecu: 5120},
41
- "c1.xlarge" : { cpu: 8192, memory: 7168, gen: 1, ecu: 20480},
42
- "c3.large" : { cpu: 2048, memory: 3840, gen: 3, ecu: 7168},
43
- "c3.xlarge" : { cpu: 4096, memory: 7680, gen: 3, ecu: 14336},
44
- "c3.2xlarge" : { cpu: 8192, memory: 15360, gen: 3, ecu: 28672},
45
- "c3.4xlarge" : { cpu: 16384, memory: 30720, gen: 3, ecu: 56320},
46
- "c3.8xlarge" : { cpu: 32768, memory: 61440, gen: 3, ecu: 110592},
47
- "c4.large" : { cpu: 2048, memory: 3840, gen: 4, ecu: 8192},
48
- "c4.xlarge" : { cpu: 4096, memory: 7680, gen: 4, ecu: 16384},
49
- "c4.2xlarge" : { cpu: 8192, memory: 15360, gen: 4, ecu: 31744},
50
- "c4.4xlarge" : { cpu: 16384, memory: 30720, gen: 4, ecu: 63488},
51
- "c4.8xlarge" : { cpu: 36864, memory: 61440, gen: 4, ecu: 135168},
52
- "g2.2xlarge" : { cpu: 8192, memory: 15360, gen: 2, ecu: 26624},
53
- "g2.8xlarge" : { cpu: 32768, memory: 61440, gen: 2, ecu: 106496},
54
- "r3.large" : { cpu: 2048, memory: 15616, gen: 3, ecu: 6656},
55
- "r3.xlarge" : { cpu: 4096, memory: 31232, gen: 3, ecu: 13312},
56
- "r3.2xlarge" : { cpu: 8192, memory: 62464, gen: 3, ecu: 26624},
57
- "r3.4xlarge" : { cpu: 16384, memory:124928, gen: 3, ecu: 53248},
58
- "r3.8xlarge" : { cpu: 32768, memory:249856, gen: 3, ecu: 106496},
59
- "i2.xlarge" : { cpu: 4096, memory: 31232, gen: 2, ecu: 14336},
60
- "i2.2xlarge" : { cpu: 8192, memory: 62464, gen: 2, ecu: 27648},
61
- "i2.4xlarge" : { cpu: 16384, memory:124928, gen: 2, ecu: 54272},
62
- "i2.8xlarge" : { cpu: 32768, memory:249856, gen: 2, ecu: 106496},
63
- "d2.xlarge" : { cpu: 4096, memory: 31232, gen: 2, ecu: 14336},
64
- "d2.2xlarge" : { cpu: 8192, memory: 62464, gen: 2, ecu: 28672},
65
- "d2.4xlarge" : { cpu: 16384, memory:124928, gen: 2, ecu: 57344},
66
- "d2.8xlarge" : { cpu: 32768, memory:249856, gen: 2, ecu: 118784},
67
- "hi1.4xlarge" : { cpu: 16384, memory: 61952, gen: 1, ecu: 35840},
68
- "hs1.8xlarge" : { cpu: 16384, memory:119808, gen: 1, ecu: 35840},
69
- "cr1.8xlarge" : { cpu: 32768, memory:249856, gen: 1, ecu: 90112},
70
- "cc2.8xlarge" : { cpu: 32768, memory: 62464, gen: 1, ecu: 90112}
71
- }
18
+ "c1.medium": { cpu: 2048, memory: 1740, gen: 1, ecu: 5120 },
19
+ "c1.xlarge": { cpu: 8192, memory: 7168, gen: 1, ecu: 20480 },
20
+ "c3.2xlarge": { cpu: 8192, memory: 15360, gen: 3, ecu: 28672 },
21
+ "c3.4xlarge": { cpu: 16384, memory: 30720, gen: 3, ecu: 56320 },
22
+ "c3.8xlarge": { cpu: 32768, memory: 61440, gen: 3, ecu: 110592 },
23
+ "c3.large": { cpu: 2048, memory: 3840, gen: 3, ecu: 7168 },
24
+ "c3.xlarge": { cpu: 4096, memory: 7680, gen: 3, ecu: 14336 },
25
+ "c4.2xlarge": { cpu: 8192, memory: 15360, gen: 4, ecu: 36864 },
26
+ "c4.4xlarge": { cpu: 16384, memory: 30720, gen: 4, ecu: 73728 },
27
+ "c4.8xlarge": { cpu: 36864, memory: 61440, gen: 4, ecu: 165888 },
28
+ "c4.large": { cpu: 2048, memory: 3840, gen: 4, ecu: 9216 },
29
+ "c4.xlarge": { cpu: 4096, memory: 7680, gen: 4, ecu: 18432 },
30
+ "c5.18xlarge": { cpu: 73728, memory: 147456, gen: 5, ecu: 368640 },
31
+ "c5.2xlarge": { cpu: 8192, memory: 16384, gen: 5, ecu: 40960 },
32
+ "c5.4xlarge": { cpu: 16384, memory: 32768, gen: 5, ecu: 81920 },
33
+ "c5.9xlarge": { cpu: 36864, memory: 73728, gen: 5, ecu: 184320 },
34
+ "c5.large": { cpu: 2048, memory: 4096, gen: 5, ecu: 10240 },
35
+ "c5.xlarge": { cpu: 4096, memory: 8192, gen: 5, ecu: 20480 },
36
+ "c5d.18xlarge": { cpu: 73728, memory: 147456, gen: 5, ecu: 368640 },
37
+ "c5d.2xlarge": { cpu: 8192, memory: 16384, gen: 5, ecu: 40960 },
38
+ "c5d.4xlarge": { cpu: 16384, memory: 32768, gen: 5, ecu: 81920 },
39
+ "c5d.9xlarge": { cpu: 36864, memory: 73728, gen: 5, ecu: 184320 },
40
+ "c5d.large": { cpu: 2048, memory: 4096, gen: 5, ecu: 10240 },
41
+ "c5d.xlarge": { cpu: 4096, memory: 8192, gen: 5, ecu: 20480 },
42
+ "cc2.8xlarge": { cpu: 32768, memory: 62464, gen: 1, ecu: 90112 },
43
+ "cr1.8xlarge": { cpu: 32768, memory: 249856, gen: 1, ecu: 90112 },
44
+ "d2.2xlarge": { cpu: 8192, memory: 62464, gen: 2, ecu: 24576 },
45
+ "d2.4xlarge": { cpu: 16384, memory: 124928, gen: 2, ecu: 49152 },
46
+ "d2.8xlarge": { cpu: 36864, memory: 249856, gen: 2, ecu: 110592 },
47
+ "d2.xlarge": { cpu: 4096, memory: 31232, gen: 2, ecu: 12288 },
48
+ "f1.16xlarge": { cpu: 65536, memory: 999424, gen: 1, ecu: 163840 },
49
+ "f1.2xlarge": { cpu: 8192, memory: 124928, gen: 1, ecu: 20480 },
50
+ "f1.4xlarge": { cpu: 16384, memory: 249856, gen: 1, ecu: 40960 },
51
+ "g2.2xlarge": { cpu: 8192, memory: 15360, gen: 2, ecu: 26624 },
52
+ "g2.8xlarge": { cpu: 32768, memory: 61440, gen: 2, ecu: 106496 },
53
+ "g3.16xlarge": { cpu: 65536, memory: 499712, gen: 3, ecu: 229376 },
54
+ "g3.4xlarge": { cpu: 16384, memory: 124928, gen: 3, ecu: 57344 },
55
+ "g3.8xlarge": { cpu: 32768, memory: 249856, gen: 3, ecu: 114688 },
56
+ "h1.16xlarge": { cpu: 65536, memory: 262144, gen: 1, ecu: 163840 },
57
+ "h1.2xlarge": { cpu: 8192, memory: 32768, gen: 1, ecu: 20480 },
58
+ "h1.4xlarge": { cpu: 16384, memory: 65536, gen: 1, ecu: 40960 },
59
+ "h1.8xlarge": { cpu: 32768, memory: 131072, gen: 1, ecu: 81920 },
60
+ "hs1.8xlarge": { cpu: 16384, memory: 119808, gen: 1, ecu: 35840 },
61
+ "i2.2xlarge": { cpu: 8192, memory: 62464, gen: 2, ecu: 27648 },
62
+ "i2.4xlarge": { cpu: 16384, memory: 124928, gen: 2, ecu: 54272 },
63
+ "i2.8xlarge": { cpu: 32768, memory: 249856, gen: 2, ecu: 106496 },
64
+ "i2.xlarge": { cpu: 4096, memory: 31232, gen: 2, ecu: 14336 },
65
+ "i3.16xlarge": { cpu: 65536, memory: 499712, gen: 3, ecu: 294912 },
66
+ "i3.2xlarge": { cpu: 8192, memory: 62464, gen: 3, ecu: 36864 },
67
+ "i3.4xlarge": { cpu: 16384, memory: 124928, gen: 3, ecu: 73728 },
68
+ "i3.8xlarge": { cpu: 32768, memory: 249856, gen: 3, ecu: 147456 },
69
+ "i3.large": { cpu: 2048, memory: 15616, gen: 3, ecu: 9216 },
70
+ "i3.metal": { cpu: 73728, memory: 524288, gen: 3, ecu: 331776 },
71
+ "i3.xlarge": { cpu: 4096, memory: 31232, gen: 3, ecu: 18432 },
72
+ "m1.large": { cpu: 2048, memory: 7680, gen: 1, ecu: 4096 },
73
+ "m1.medium": { cpu: 1024, memory: 3840, gen: 1, ecu: 2048 },
74
+ "m1.small": { cpu: 1024, memory: 1740, gen: 1, ecu: 1024 },
75
+ "m1.xlarge": { cpu: 4096, memory: 15360, gen: 1, ecu: 8192 },
76
+ "m2.2xlarge": { cpu: 4096, memory: 35020, gen: 2, ecu: 13312 },
77
+ "m2.4xlarge": { cpu: 8192, memory: 70040, gen: 2, ecu: 26624 },
78
+ "m2.xlarge": { cpu: 2048, memory: 17510, gen: 2, ecu: 6656 },
79
+ "m3.2xlarge": { cpu: 8192, memory: 30720, gen: 3, ecu: 26624 },
80
+ "m3.large": { cpu: 2048, memory: 7680, gen: 3, ecu: 6656 },
81
+ "m3.medium": { cpu: 1024, memory: 3840, gen: 3, ecu: 3072 },
82
+ "m3.xlarge": { cpu: 4096, memory: 15360, gen: 3, ecu: 13312 },
83
+ "m4.10xlarge": { cpu: 40960, memory: 163840, gen: 4, ecu: 163840 },
84
+ "m4.16xlarge": { cpu: 65536, memory: 262144, gen: 4, ecu: 262144 },
85
+ "m4.2xlarge": { cpu: 8192, memory: 32768, gen: 4, ecu: 32768 },
86
+ "m4.4xlarge": { cpu: 16384, memory: 65536, gen: 4, ecu: 65536 },
87
+ "m4.large": { cpu: 2048, memory: 8192, gen: 4, ecu: 8192 },
88
+ "m4.xlarge": { cpu: 4096, memory: 16384, gen: 4, ecu: 16384 },
89
+ "m5.12xlarge": { cpu: 49152, memory: 196608, gen: 5, ecu: 221184 },
90
+ "m5.24xlarge": { cpu: 98304, memory: 393216, gen: 5, ecu: 442368 },
91
+ "m5.2xlarge": { cpu: 8192, memory: 32768, gen: 5, ecu: 36864 },
92
+ "m5.4xlarge": { cpu: 16384, memory: 65536, gen: 5, ecu: 73728 },
93
+ "m5.large": { cpu: 2048, memory: 8192, gen: 5, ecu: 9216 },
94
+ "m5.xlarge": { cpu: 4096, memory: 16384, gen: 5, ecu: 18432 },
95
+ "m5d.12xlarge": { cpu: 49152, memory: 196608, gen: 5, ecu: 221184 },
96
+ "m5d.24xlarge": { cpu: 98304, memory: 393216, gen: 5, ecu: 442368 },
97
+ "m5d.2xlarge": { cpu: 8192, memory: 32768, gen: 5, ecu: 36864 },
98
+ "m5d.4xlarge": { cpu: 16384, memory: 65536, gen: 5, ecu: 73728 },
99
+ "m5d.large": { cpu: 2048, memory: 8192, gen: 5, ecu: 9216 },
100
+ "m5d.xlarge": { cpu: 4096, memory: 16384, gen: 5, ecu: 18432 },
101
+ "p2.16xlarge": { cpu: 65536, memory: 749568, gen: 2, ecu: 196608 },
102
+ "p2.8xlarge": { cpu: 32768, memory: 499712, gen: 2, ecu: 98304 },
103
+ "p2.xlarge": { cpu: 4096, memory: 62464, gen: 2, ecu: 12288 },
104
+ "p3.16xlarge": { cpu: 65536, memory: 499712, gen: 3, ecu: 229376 },
105
+ "p3.2xlarge": { cpu: 8192, memory: 62464, gen: 3, ecu: 28672 },
106
+ "p3.8xlarge": { cpu: 32768, memory: 249856, gen: 3, ecu: 114688 },
107
+ "r3.2xlarge": { cpu: 8192, memory: 62464, gen: 3, ecu: 26624 },
108
+ "r3.4xlarge": { cpu: 16384, memory: 124928, gen: 3, ecu: 53248 },
109
+ "r3.8xlarge": { cpu: 32768, memory: 249856, gen: 3, ecu: 106496 },
110
+ "r3.large": { cpu: 2048, memory: 15616, gen: 3, ecu: 6656 },
111
+ "r3.xlarge": { cpu: 4096, memory: 31232, gen: 3, ecu: 13312 },
112
+ "r4.16xlarge": { cpu: 65536, memory: 499712, gen: 4, ecu: 262144 },
113
+ "r4.2xlarge": { cpu: 8192, memory: 62464, gen: 4, ecu: 32768 },
114
+ "r4.4xlarge": { cpu: 16384, memory: 124928, gen: 4, ecu: 65536 },
115
+ "r4.8xlarge": { cpu: 32768, memory: 249856, gen: 4, ecu: 131072 },
116
+ "r4.large": { cpu: 2048, memory: 15616, gen: 4, ecu: 8192 },
117
+ "r4.xlarge": { cpu: 4096, memory: 31232, gen: 4, ecu: 16384 },
118
+ "r5.12xlarge": { cpu: 49152, memory: 393216, gen: 5, ecu: 221184 },
119
+ "r5.24xlarge": { cpu: 98304, memory: 786432, gen: 5, ecu: 442368 },
120
+ "r5.2xlarge": { cpu: 8192, memory: 65536, gen: 5, ecu: 36864 },
121
+ "r5.4xlarge": { cpu: 16384, memory: 131072, gen: 5, ecu: 73728 },
122
+ "r5.large": { cpu: 2048, memory: 16384, gen: 5, ecu: 9216 },
123
+ "r5.xlarge": { cpu: 4096, memory: 32768, gen: 5, ecu: 18432 },
124
+ "r5d.12xlarge": { cpu: 49152, memory: 393216, gen: 5, ecu: 221184 },
125
+ "r5d.24xlarge": { cpu: 98304, memory: 786432, gen: 5, ecu: 442368 },
126
+ "r5d.2xlarge": { cpu: 8192, memory: 65536, gen: 5, ecu: 36864 },
127
+ "r5d.4xlarge": { cpu: 16384, memory: 131072, gen: 5, ecu: 73728 },
128
+ "r5d.large": { cpu: 2048, memory: 16384, gen: 5, ecu: 9216 },
129
+ "r5d.xlarge": { cpu: 4096, memory: 32768, gen: 5, ecu: 18432 },
130
+ "t1.micro": { cpu: 1024, memory: 1024, gen: 1, ecu: 1024 },
131
+ "t2.2xlarge": { cpu: 8192, memory: 32768, gen: 2, ecu: 16384 },
132
+ "t2.large": { cpu: 2048, memory: 8192, gen: 2, ecu: 4096 },
133
+ "t2.medium": { cpu: 2048, memory: 4096, gen: 2, ecu: 4096 },
134
+ "t2.micro": { cpu: 1024, memory: 1024, gen: 2, ecu: 2048 },
135
+ "t2.nano": { cpu: 1024, memory: 512, gen: 2, ecu: 2048 },
136
+ "t2.small": { cpu: 1024, memory: 2048, gen: 2, ecu: 2048 },
137
+ "t2.xlarge": { cpu: 4096, memory: 16384, gen: 2, ecu: 8192 },
138
+ "t3.2xlarge": { cpu: 8192, memory: 32768, gen: 3, ecu: 20480 },
139
+ "t3.large": { cpu: 2048, memory: 8192, gen: 3, ecu: 5120 },
140
+ "t3.medium": { cpu: 2048, memory: 4096, gen: 3, ecu: 5120 },
141
+ "t3.micro": { cpu: 1024, memory: 1024, gen: 3, ecu: 2560 },
142
+ "t3.nano": { cpu: 1024, memory: 512, gen: 3, ecu: 2560 },
143
+ "t3.small": { cpu: 1024, memory: 2048, gen: 3, ecu: 2560 },
144
+ "t3.xlarge": { cpu: 4096, memory: 16384, gen: 3, ecu: 10240 },
145
+ "x1.16xlarge": { cpu: 65536, memory: 999424, gen: 1, ecu: 163840 },
146
+ "x1.32xlarge": { cpu: 131072, memory: 1024, gen: 1, ecu: 327680 },
147
+ "x1e.16xlarge": { cpu: 65536, memory: 1024, gen: 1, ecu: 163840 },
148
+ "x1e.2xlarge": { cpu: 8192, memory: 249856, gen: 1, ecu: 20480 },
149
+ "x1e.32xlarge": { cpu: 131072, memory: 3072, gen: 1, ecu: 327680 },
150
+ "x1e.4xlarge": { cpu: 16384, memory: 499712, gen: 1, ecu: 40960 },
151
+ "x1e.8xlarge": { cpu: 32768, memory: 999424, gen: 1, ecu: 81920 },
152
+ "x1e.xlarge": { cpu: 4096, memory: 124928, gen: 1, ecu: 10240 },
153
+ "z1d.12xlarge": { cpu: 49152, memory: 393216, gen: 1, ecu: 122880 },
154
+ "z1d.2xlarge": { cpu: 8192, memory: 65536, gen: 1, ecu: 20480 },
155
+ "z1d.3xlarge": { cpu: 12288, memory: 98304, gen: 1, ecu: 30720 },
156
+ "z1d.6xlarge": { cpu: 24576, memory: 196608, gen: 1, ecu: 61440 },
157
+ "z1d.large": { cpu: 2048, memory: 16384, gen: 1, ecu: 5120 },
158
+ "z1d.xlarge": { cpu: 4096, memory: 32768, gen: 1, ecu: 10240 },
159
+ }
72
160
 
73
161
  function pick_lowest_prices(prices)
74
162
  {
@@ -1,3 +1,3 @@
1
1
  module Sumomo
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sumomo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-30 00:00:00.000000000 Z
11
+ date: 2018-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -2558,7 +2558,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2558
2558
  version: '0'
2559
2559
  requirements: []
2560
2560
  rubyforge_project:
2561
- rubygems_version: 2.6.14
2561
+ rubygems_version: 2.6.11
2562
2562
  signing_key:
2563
2563
  specification_version: 4
2564
2564
  summary: An advanced infrastructure description language for AWS