Skip to content

Commit

Permalink
upgraded aws-sdk in delete-secrets cli scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerre committed Nov 1, 2023
1 parent ad0132c commit c28239c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions bin/delete-secrets.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const argv = require('minimist')(process.argv.slice(2));
const {inspect} = require('util');
const AWS = require('aws-sdk');
const { SecretsManager } = require("@aws-sdk/client-secrets-manager");

Check failure on line 5 in bin/delete-secrets.js

View workflow job for this annotation

GitHub Actions / release

Strings must use singlequote
const readline = require('readline');
const readln = readline.createInterface({
input: process.stdin,
Expand All @@ -19,7 +19,7 @@ const verbose = argv.v || argv.verbose;
const env = argv.e || argv.env || ENV;
const namespace = argv.n || argv.namespace;
const region = argv.r || argv.region || process.env.AWS_REGION || REGION;
const secretsmanager = new AWS.SecretsManager({region:region});
const secretsmanager = new SecretsManager({ region:region });


function showHelp () {
Expand Down Expand Up @@ -81,7 +81,7 @@ async function listSecrets () {
}

try {
res = await secretsmanager.listSecrets(params).promise();
res = await secretsmanager.listSecrets(params);
} catch (err) {
return Promise.reject(err);
}
Expand Down Expand Up @@ -122,19 +122,17 @@ async function listSecrets () {

function deleteSecrets (list) {

let promises = [];
const promises = [];

for (let item of list) {

let params = {
SecretId: item.ARN,
};
const params = { SecretId: item.ARN };

if (force) {
params.ForceDeleteWithoutRecovery = true;
}

let promise = secretsmanager.deleteSecret(params).promise();
const promise = secretsmanager.deleteSecret(params);
promises.push(promise);

}
Expand Down

0 comments on commit c28239c

Please sign in to comment.