Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
Latest commit
30 lines (25 loc) · 796 Bytes
/
Copy pathindex.js
File metadata and controls
30 lines (25 loc) · 796 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
constrequest=require('request');
exports.handler=(event,context,callback)=>{
// TODO implement
console.log(event.detail.EC2InstanceId);
varreqUrl='https://api.stackify.com:443/api/Device/RemoveServerByEC2ID/'+event.detail.EC2InstanceId;
varrequest=require('request');
varoptions={
url: reqUrl,
headers: {
'X-Stackify-Key': process.env.Stackify_ApiKey
},
method: 'POST'
};
functionstackify_callback(error,response,body){
console.log('Response: '+response.statusCode);
console.log('Body: '+body);
if(response.statusCode==200){
callback(null,"Deleted "+event.detail.EC2InstanceId);
}
else{
callback(null,"Failed to delete "+event.detail.EC2InstanceId);
}
}
request(options,stackify_callback)
};