Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
generateDimensionResources(mode, config, tableResourceName, indexName = null) {
const modeCapitalized = capitalize.call(mode);
const resourceNamePrefix = `${ tableResourceName }${ resolveIndexToken(indexName) }${
modeCapitalized
}`;
const targetResourceName = `${ resourceNamePrefix }ScalableTarget`;
const policyResourceName = `${ resourceNamePrefix }ScalingPolicy`;
const resourceAddress = ["table", { Ref: tableResourceName }];
if (indexName) resourceAddress.push("index", indexName);
const roleARN = this.pluginConfig.iamRoleArn || {
"Fn::GetAtt": `${ this.iamRoleResourceId }.Arn`
};
const resources = {
[targetResourceName]: {
Type: "AWS::ApplicationAutoScaling::ScalableTarget",
module.exports = (mode, config, tableResourceName, indexName = null) => {
const modeCapitalized = capitalize.call(mode);
const resourceNamePrefix = `${ tableResourceName }${ resolveIndexToken(
indexName
) }${ modeCapitalized }`;
const targetResourceName = `${ resourceNamePrefix }ScalableTarget`;
const policyResourceName = `${ resourceNamePrefix }ScalingPolicy`;
const resourceAddress = ["table", { Ref: tableResourceName }];
if (indexName) resourceAddress.push("index", indexName);
const resources = {
[targetResourceName]: {
Type: "AWS::ApplicationAutoScaling::ScalableTarget",
Properties: {
MaxCapacity: config.maxCapacity,
MinCapacity: config.minCapacity,
ResourceId: { "Fn::Join": ["/", resourceAddress] },