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

awsass

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awsass - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

5

awsass.js

@@ -13,2 +13,3 @@ const { program } = require("commander");

.option("--ecr-ecs-set-revision", "sets revision for a task")
.option("--scheduled-lambda-set-revision", "sets revision for a scheduled lambda function")
.option("--ecs-run-on-fargate", "run ecs task on fargate")

@@ -38,2 +39,3 @@ .option("--ecs-task-logs", "read task logs")

.option("--cloudfront-id <cloudfront-id>", "cloudfront id")
.option("--cloudwatch-rule <cloudwatch-rule>", "cloudwatch rule")
.option("--environment-variable <keyvalue...>", "overwrite environment variable key:value")

@@ -102,2 +104,5 @@ .option("--execution-role-arn <execution-role-arn>", "execution-role-arn")

if (options["scheduledLambdaSetRevision"])
Lib.scheduledLambdaSetRevision(options["cloudwatchRule"], options["revisionString"], resultFunc);
if (options["ecrEcsEphemeralCreate"])

@@ -104,0 +109,0 @@ Lib.ecrEcsEphemeralCreate(options["executionRoleArn"], options["taskRoleArn"], options["cpuUnits"], options["memoryUnits"], resultFunc);

2

package.json
{
"name": "awsass",
"description": "AWSASS is an assistant to AWS, mostly for running better scripts.",
"version": "0.0.24",
"version": "0.0.25",
"author": "Jsonize",

@@ -6,0 +6,0 @@ "repository": "https://github.com/jsonize/awsass",

@@ -93,9 +93,3 @@ const AWS = require("aws-sdk");

let newImageIndex = -1;
switch (revisionString) {
case "-1":
newImageIndex = oldImageIndex - 1;
break;
case "+1":
newImageIndex = oldImageIndex + 1;
break;
switch (revisionString) {
case "latest":

@@ -108,3 +102,6 @@ newImageIndex = images.length - 1;

default:
newImageIndex = findImageIndex(images, revisionString);
if (isNaN(revisionString))
newImageIndex = findImageIndex(images, revisionString);
else
newImageIndex = oldImageIndex + parseInt(revisionString);
break;

@@ -124,2 +121,56 @@ }

scheduledLambdaSetRevision: function (cloudwatchRule, revisionString, callback) {
const events = new AWS.CloudWatchEvents({apiVersion: '2015-10-07'});
const lambda = new AWS.Lambda({apiVersion: '2015-03-31'});
events.listTargetsByRule({Rule: cloudwatchRule}, function (err, listTargetsByRule) {
if (err) {
callback(err);
return;
}
let target = listTargetsByRule.Targets.find(target => target.Arn.indexOf('arn:aws:lambda') === 0);
if (!target) {
callback("Cannot find lambda target");
return;
}
let arn = target.Arn;
let splt = arn.split(":");
let oldVersion = splt[7];
if (splt.length > 7) {
splt.pop();
arn = splt.join(":");
}
lambda.listVersionsByFunction({FunctionName: arn, MaxItems: 10000}, function (err, listVersionsByFunction) {
if (err) {
callback(err);
return;
}
if (!oldVersion)
oldVersion = listVersionsByFunction.Versions[listVersionsByFunction.Versions.length - 1].Version;
let newVersion = undefined;
switch (revisionString) {
case "latest":
newVersion = listVersionsByFunction.Versions[listVersionsByFunction.Versions.length - 1].Version;
break;
case "first":
newVersion = listVersionsByFunction.Versions[0].Version;
break;
default:
if (revisionString.indexOf("+") === 0 || revisionString.indexOf("-") === 0)
newVersion = (parseInt(oldVersion) + parseInt(revisionString)) + ""
else
newVersion = revisionString;
break;
}
if (listVersionsByFunction.Versions.findIndex(v => v.Version === newVersion) < 0) {
callback(`Could not find new version.`);
return;
}
if (newVersion !== listVersionsByFunction.Versions[listVersionsByFunction.Versions.length - 1].Version)
arn += ":" + newVersion;
target.Arn = arn;
events.putTargets({Rule: cloudwatchRule, Targets: [target]}, callback);
});
});
},
ecrLoginDetails: function (callback) {

@@ -126,0 +177,0 @@ const ecr = new AWS.ECR({apiVersion: '2015-09-21'});

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