forked from amirams/spotinst-functions-examples
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathGenerator.js
More file actions
34 lines (26 loc) · 680 Bytes
/
Copy pathGenerator.js
File metadata and controls
34 lines (26 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const rp = require("request")
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
module.exports.main = function main (event, context, callback) {
let suit, value
let output = `[`
let loopvalue = getRandomInt(process.env['size'])
console.log(loopvalue)
while(loopvalue>0){
suit = getRandomInt(4)+1
value = getRandomInt(13)+1
console.log(`{${suit}: ${value}},`)
output+=`{"${suit}": "${value}"},`
loopvalue -= 1
}
output = output.slice(0,-1) + `]`
let options = {
uri: {Function URL for Splitter},
method: 'POST',
qs:{data:output},
json:true
}
rp(options)
callback(null, {statusCode: 200, body: "Success"});
};