in source/shared-modules/dynamodb-helper/dynamodb-helper.js [269:296]
DynamoDBHelper.prototype.getDynamoDBDocumentClient = function(credentials, callback) {
try {
var creds = {
accessKeyId: credentials.claim.AccessKeyId,
secretAccessKey: credentials.claim.SecretKey,
sessionToken: credentials.claim.SessionToken,
region: configuration.aws_region
}
var docClient = new AWS.DynamoDB.DocumentClient(creds);
var ddb = new AWS.DynamoDB(creds)
if (!this.tableExists) {
this.createTable(ddb, function (error) {
if (error) {
callback(error);
} else {
this.tableExists = true;
callback(null, docClient)
}
}.bind(this));
} else {
callback(docClient);
}
} catch (error) {
callback(error);
}
}