Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function selectDatabase(context, inputs, clusterArn, secretArn, AWS) {
// Database Name Question
const DataApi = new AWS.RDSDataService();
const params = new DataApiParams();
params.secretArn = secretArn;
params.resourceArn = clusterArn;
params.sql = 'SHOW databases';
spinner.start('Fetching Aurora Serverless cluster...');
const dataApiResult = await DataApi.executeStatement(params).promise();
// eslint-disable-next-line prefer-destructuring
const records = dataApiResult.records;
const databaseList = [];
for (let i = 0; i < records.length; i += 1) {
const recordValue = records[i][0].stringValue;
// ignore the three meta tables that the cluster creates
if (!['information_schema', 'performance_schema', 'mysql'].includes(recordValue)) {
databaseList.push(recordValue);