Comparing version 0.0.26 to 0.0.27
@@ -14,2 +14,3 @@ const { program } = require("commander"); | ||
.option("--ecs-list-revision", "lists all ecs revisions") | ||
.option("--scheduled-lambda-list-revision", "lists all lambda revisions") | ||
.option("--scheduled-lambda-set-revision", "sets revision for a scheduled lambda function") | ||
@@ -89,2 +90,5 @@ .option("--ecs-run-on-fargate", "run ecs task on fargate") | ||
if (options["scheduledLambdaListRevision"]) | ||
Lib.scheduledLambdaListRevision(resultFunc); | ||
if (options["ecsRunOnFargate"]) | ||
@@ -91,0 +95,0 @@ Lib.ecsRunOnFargate(options["taskDefinition"], options["clusterName"], options["environmentVariable"], resultFunc); |
{ | ||
"name": "awsass", | ||
"description": "AWSASS is an assistant to AWS, mostly for running better scripts.", | ||
"version": "0.0.26", | ||
"version": "0.0.27", | ||
"author": "Jsonize", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/jsonize/awsass", |
@@ -86,3 +86,52 @@ const AWS = require("aws-sdk"); | ||
nextTokenHelper: function (obj, func, opts, callback, acc) { | ||
func.call(obj, opts, function (err, data) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
if (acc) { | ||
for (var key in data) { | ||
if (key in acc) { | ||
if (acc[key].concat) | ||
acc[key] = acc[key].concat(data[key]); | ||
} else | ||
acc.key = data[key]; | ||
} | ||
} else | ||
acc = data; | ||
if (data.NextToken) { | ||
opts.NextToken = data.NextToken; | ||
Module.nextTokenHelper(obj, func, opts, callback, acc); | ||
} else | ||
callback(undefined, acc); | ||
}); | ||
}, | ||
scheduledLambdaListRevision: function (callback) { | ||
const events = new AWS.CloudWatchEvents({apiVersion: '2015-10-07'}); | ||
Module.nextTokenHelper(events, events.listRules, {Limit:100}, function (err, listRules) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
let result = []; | ||
let iter = function (idx) { | ||
if (idx >= listRules.Rules.length) | ||
callback(undefined, result); | ||
events.listTargetsByRule({Rule: listRules.Rules[idx].Name}, function (err, listTargetsByRule) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
let target = listTargetsByRule.Targets.find(target => target.Arn.indexOf('arn:aws:lambda') === 0); | ||
if (target) | ||
result.push(target.Arn); | ||
iter(idx+1); | ||
}); | ||
} | ||
iter(0); | ||
}); | ||
}, | ||
ecrEcsSetRevision: function (taskDefinition, containerName, revisionString, callback) { | ||
@@ -89,0 +138,0 @@ let findImageIndex = function (images, searchString) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43831
872