Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dynamodb-backup-restore

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamodb-backup-restore - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

29

gulpfile.js

@@ -69,12 +69,21 @@ 'use strict';

let config = {
S3Bucket: 'jobsheet.backup.us-east-1',
S3Region: 'us-east-1',
S3Prefix: 'test',
DbTable: 'ImpoLite-dev',
DbRegion: 'us-west-2',
LambdaName: 'test1',
LambdaRegion: 'us-west-2',
LambdaAlias: 'dev',
LambdaRoleName: 'backup-role',
LambdaSourcePath: 'D:\ddbbackup'
S3Bucket: argv.s3bucket,
S3Prefix: argv.s3prefix,
S3Region: argv.s3region,
DbTable: argv.dbtable,
DbRegion: argv.dbregion,
LambdaName: argv.LambdaName,
LambdaRegion: argv.LambdaRegion,
LambdaAlias: argv.LambdaAlias,
LambdaRoleName: argv.LambdaRoleName
// S3Bucket: 'jobsheet.backup.us-east-1',
// S3Region: 'us-east-1',
// S3Prefix: 'test',
// DbTable: 'ImpoLite-dev',
// DbRegion: 'us-west-2',
// LambdaName: 'test1',
// LambdaRegion: 'us-west-2',
// LambdaAlias: 'dev',
// LambdaRoleName: 'backup-role'
};

@@ -81,0 +90,0 @@

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -6,4 +6,4 @@ {

"dependencies": {
"dynamodb-backup-restore ": "0.0.8"
"dynamodb-backup-restore ": "0.0.10"
}
}

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

'use strict';
const AWS = require('aws-sdk');
const gulp = require('gulp');
//const lambda = require('gulp-awslambda');
//const zip = require('gulp-zip');
const util = require('util');

@@ -25,6 +22,5 @@ const exec = require('child_process').exec;

this.DbRegion = config.DbRegion;
this.LambdaSourcePath = config.LambdaSourcePath;
}
configureLambdaRole() {
configureRole() {
return this.getRole()

@@ -139,32 +135,18 @@ .then(role => {

// deployLambda(roleArn) {
// return new Promise((resolve, reject) => {
// let lambda_params = {
// FunctionName: this.LambdaName,
// Description: 'Backup Lambda',
// Role: roleArn,
// Handler: 'index.handler',
// Timeout: 6,
// MemorySize: 128
// };
// return gulp.src(['./lambda/*', './lambda/**/*', '!./lambda/handler.zip'],
// { 'base': './lambda' })
// .pipe(zip('./lambda/handler.zip', { compress: false }))
// .pipe(lambda(lambda_params, { region: this.LambdaRegion }))
// .pipe(gulp.dest('.'));
// });
// }
deployLambda(roleArn) {
deploy(roleArn) {
return this.getArchive()
.then(zip => {
return this.updateLambdaConfiguration(roleArn)
.then(() => {
console.log(zip);
return this.updateLambdaCode(zip);
})
.then(() => {
return this.isFunctionExists();
})
.then(isExists => {
if (isExists) {
return this.updateConfiguration(roleArn)
.then(() => {
return this.updateCode();
})
}
else {
return this.create(roleArn);
}
})
.catch(err => {

@@ -175,3 +157,2 @@ throw err;

getArchive() {

@@ -182,5 +163,4 @@ let _this = this;

fse.walk('./lambda')
.on('data', function (item) {
.on('data', item => {
let symbolicLink = item.stats.isSymbolicLink() && fs.existsSync(item.path);
if (item.stats.isFile() || symbolicLink) {

@@ -194,7 +174,7 @@ let name = path.relative('./lambda', item.path);

})
.on('end', function () {
.on('end', () => {
resolve();
})
})
.then(function () {
.then(() => {
_this.zipName = `${_this.LambdaName}_${_this.LambdaAlias}_${_this.LambdaRegion}.zip`;

@@ -211,13 +191,23 @@ _this.zipBuffer = zip.generate({

fs.writeFileSync(_this.pathCompressed, _this.zipBuffer);
});
}
isFunctionExists() {
return new Promise(resolve => {
let lambda = new AWS.Lambda({ region: this.LambdaRegion });
let params = {
FunctionName: this.LambdaName
};
lambda.getFunction(params, err => {
return resolve(!err);
});
});
}
createLambda(buffer, roleArn) {
create(roleArn) {
return new Promise((resolve, reject) => {
let lambda = new AWS.Lambda({ region: this.LambdaRegion });
let params = {
Code: {
ZipFile: buffer
ZipFile: this.zipBuffer
},

@@ -241,5 +231,4 @@ FunctionName: this.LambdaName,

updateLambdaConfiguration(roleArn) {
updateConfiguration(roleArn) {
return new Promise((resolve, reject) => {
let lambda = new AWS.Lambda({ region: this.LambdaRegion });

@@ -263,5 +252,4 @@ let params = {

updateLambdaCode(buffer) {
updateCode() {
return new Promise((resolve, reject) => {
let lambda = new AWS.Lambda({ region: this.LambdaRegion });

@@ -281,3 +269,3 @@ let params = {

configureLambda() {
configure() {
return this.publishVersion()

@@ -303,3 +291,2 @@ .then(params => {

if (err) {
console.log(err);
return reject(err);

@@ -369,3 +356,3 @@ }

setLambdaEventSource(streamArn) {
setEventSource(streamArn) {
return this.getEventSources(streamArn)

@@ -481,3 +468,3 @@ .then(eventSources => {

setLambdaParams() {
setParams() {
return new Promise((resolve, reject) => {

@@ -484,0 +471,0 @@ let config = {

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -25,12 +25,12 @@ 'use strict';

.then(() => {
return this.lambdaInfrastructure.setLambdaParams();
return this.lambdaInfrastructure.setParams();
})
.then(() => {
return this.lambdaInfrastructure.configureLambdaRole()
return this.lambdaInfrastructure.configureRole()
})
.then(roleArn => {
return this.lambdaInfrastructure.deployLambda(roleArn)
return this.lambdaInfrastructure.deploy(roleArn)
})
.then(() => {
return this.lambdaInfrastructure.configureLambda()
return this.lambdaInfrastructure.configure()
})

@@ -45,3 +45,3 @@ .catch(err => {

.then(streamArn => {
return this.lambdaInfrastructure.setLambdaEventSource(streamArn)
return this.lambdaInfrastructure.setEventSource(streamArn)
})

@@ -48,0 +48,0 @@ .catch(err => {

@@ -0,0 +0,0 @@ 'use strict';

{
"name": "dynamodb-backup-restore",
"version": "0.0.9",
"version": "0.0.10",
"description": "AWS DynamoDb tool for full, incremental backup and restore",

@@ -20,2 +20,3 @@ "homepage": "https://github.com/Purple-Unicorns/DynamoDbBackUp",

"lambda",
"dynamo",
"dynamodb",

@@ -28,3 +29,2 @@ "dynamodbstream",

"dependencies": {
"aws-sdk": "^2.4.7",
"lodash": "^4.13.1",

@@ -35,2 +35,3 @@ "node-zip": "^1.1.0",

"devDependencies": {
"aws-sdk": "^2.4.7",
"gulp-jasmine": "^2.4.0",

@@ -37,0 +38,0 @@ "yargs": "^4.6.0",

@@ -0,0 +0,0 @@ #dynamodb-backup-restore

@@ -0,0 +0,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc