UNPKG

ask-cli-x

Version:

Alexa Skills Kit (ASK) Command Line Interfaces

21 lines (20 loc) 817 B
"use strict"; const aws = require("aws-sdk"); const CONSTANTS = require("../../utils/constants"); const stringUtils = require("../../utils/string-utils"); module.exports = class AbstractAwsClient { constructor(configuration) { const { awsProfile, awsRegion } = configuration; if (!stringUtils.isNonBlankString(awsProfile) || !stringUtils.isNonBlankString(awsRegion)) { throw new Error("Invalid awsProfile or Invalid awsRegion"); } if (awsProfile !== CONSTANTS.PLACEHOLDER.ENVIRONMENT_VAR.AWS_CREDENTIALS) { aws.config.credentials = new aws.SharedIniFileCredentials({ profile: awsProfile, }); } this.awsRegion = awsRegion; this.awsProfile = awsProfile; aws.config.region = this.awsRegion; } };