Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var AWS = require('aws-sdk');
var path = require('path');
/* == Globals == */
var esDomain = {
region: 'us-west-2',
endpoint: 'https://ENDPOINT_HERE',
index: 'messages',
doctype: 'message'
};
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = new AWS.EnvironmentCredentials('AWS');
/* Lambda "main": Execution begins here */
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, ' '));
event.Records.forEach(function(record) {
if (typeof record.dynamodb.NewImage != 'undefined')
{
var doc = {message: {
name: record.dynamodb.NewImage.name.S,
message: record.dynamodb.NewImage.message.S,
channel: record.dynamodb.NewImage.channel.S,
timestamp: record.dynamodb.NewImage.timestamp.N}
}
console.log('document posted to ElasticSearch: ' + JSON.stringify(doc))
"use strict";
let AWS = require('aws-sdk');
let moment = require('moment');
let _ = require('underscore');
let creds = new AWS.EnvironmentCredentials('AWS'); // Lambda provided credentials
const dynamoConfig = {
credentials: creds,
region: process.env.AWS_REGION
};
const docClient = new AWS.DynamoDB.DocumentClient(dynamoConfig);
const cloudwatchlogs = new AWS.CloudWatchLogs({
region: process.env.AWS_REGION
});
const ddbTable = 'data-lake-settings';
const logName = '/datalake/audit-log';
let logging = (function() {
let logging = function() {};
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
/**
* @author Solution Builders
*/
'use strict';
let shortid = require('shortid');
let moment = require('moment');
let _ = require('underscore');
let AWS = require('aws-sdk');
let creds = new AWS.EnvironmentCredentials('AWS'); // Lambda provided credentials
const dynamoConfig = {
credentials: creds,
region: process.env.AWS_REGION
};
const ddbTable = process.env.VEHICLE_TRIP_TBL;
/**
* Performs operations for driver safety recording and management actions interfacing primiarly with
* Amazon DynamoDB table.
*
* @class dtc
*/
let driversafety = (function() {
/**
* @class driversafety
function () { return new aws.EnvironmentCredentials('AMAZON') },
function () { return new aws.SharedIniFileCredentials({ profile }) },
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES *
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
/**
* @author Solution Builders
*/
'use strict';
let AWS = require('aws-sdk');
let creds = new AWS.EnvironmentCredentials('AWS');
/**
* Helper function to interact with S3 on behalf of a
* cfn custom resource
*
* @class s3helper
*/
let s3helper = (function() {
/**
* @class s3helper
* @constructor
*/
let s3helper = function() {};
/**
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES *
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
/**
* @author Solution Builders
*/
'use strict';
let AWS = require('aws-sdk');
let creds = new AWS.EnvironmentCredentials('AWS');
const s3Bucket = process.env.S3_BUCKET;
/**
* Uploads response data to S3
*
* @class uplaod
*/
let upload = (function() {
/**
* @class upload
* @constructor
*/
let upload = function() {};
() => new AWS.EnvironmentCredentials("AMAZON"),
() => new AWS.SharedIniFileCredentials({ profile: config.profile || "default" }),
function awsCredentials() {
return new AWS.EnvironmentCredentials('AWS');
}
() => new AWS.EnvironmentCredentials('AWS'),
() => new AWS.SharedIniFileCredentials()
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES *
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
/**
* @author Solution Builders
*/
'use strict';
let AWS = require('aws-sdk');
let upload = require('./../upload');
let creds = new AWS.EnvironmentCredentials('AWS');
const s3Bucket = process.env.S3_BUCKET;
const confidence_score = parseInt(process.env.CONFIDENCE_SCORE);
/**
* Performs operations for image recognition actions using
* Amazon Rekognition.
*
* @class image
*/
let image = (function() {
/**
* @class image
* @constructor