-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetSatellite.js
More file actions
42 lines (34 loc) · 1.22 KB
/
GetSatellite.js
File metadata and controls
42 lines (34 loc) · 1.22 KB
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
35
36
37
38
39
40
41
42
// Lambda Satellite NodeJS code
'use strict';
console.log('Loading function');
exports.handler = (SatelliteUpdateId, context, callback) => {
console.log('Starting Lambda Method call!');
console.log('SatelliteUpdateId =', SatelliteUpdateId.SatelliteUpdateId);
console.log('Obtaining SDK...');
var AWS = require("aws-sdk");
console.log('SDK obtained!');
console.log('Creating client...');
var docClient = new AWS.DynamoDB.DocumentClient();
console.log('Client created!');
console.log('Setting up params...');
var params = {
TableName: "SatelliteUpdates",
KeyConditionExpression: "SatelliteId = :satelliteUpdateId",
ExpressionAttributeValues: {
":satelliteUpdateId": Number(SatelliteUpdateId.SatelliteUpdateId)
}
};
console.log('Params setup!');
console.log('Running query...');
docClient.query(params, function(err, data)
{
if (err)
console.log(JSON.stringify(err, null, 2));
else
{
console.log(JSON.stringify(data, null, 2));
context.done(null, data);
}
});
console.log('Lambda Method call complete!');
};