-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.js
38 lines (34 loc) · 1.36 KB
/
index.js
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
let config = require("leo-config");
let cache = {};
const cloudformation = require('./lib/cloudformation');
const dynamodb = require("./lib/dynamodb");
const kms = require("./lib/kms");
const secrets = require("./lib/secretsmanager");
const sqs = require("./lib/sqs");
const AWS = require('aws-sdk');
/**
*
* @param configuration
* @returns {(function(*=)) & {region, cloudformation: {_service, getStackResources, get, runChangeSet, run, describeStackResources, waitFor, createStack}, dynamodb: {_service, get, put, update, scan, query, smartQuery, batchGetTable, batchGetHashkey, writeToTableInChunks}, kms: {_service, decrypt, encrypt}, secrets: {_service, getSecret}, profile, config: *, sqs: {_service, deleteMessage, sendMessage, receiveMessage, sendMessageBatch}}}
*/
function build(configuration) {
if (configuration.profile && !configuration.credentials) {
configuration.credentials = new AWS.SharedIniFileCredentials({
profile: configuration.profile,
role: configuration.role
});
}
return Object.assign((config) => {
return new build(config)
}, {
region: configuration.region,
cloudformation: cloudformation(configuration),
dynamodb: dynamodb(configuration),
kms: kms(configuration),
secrets: secrets(configuration),
profile: configuration.profile,
config: configuration,
sqs: sqs(configuration)
});
}
module.exports = new build(config.leoaws);