import Name from '../name' ; import { Options , AutoscalingConfig } from 'src/@types/types' ; export default class Target { data : AutoscalingConfig ; options : Options ; dependencies : any [ ] ; name : Name ; constructor ( options , data ) { this . options = options ; this . data = data ; this . dependencies = [ ] ; this . name = new Name ( options ) ; } toJSON ( ) { const nameTarget = this . name . target ( this . data . function ) ; const DependsOn = [ this . name . PCAliasLogicalId ( this . data . function ) ] . concat ( this . dependencies ) ; return { [ nameTarget ] : { DependsOn , Properties : { MaxCapacity : this . data . maximum , MinCapacity : this . data . minimum , ResourceId : `function:${ this . data . name }:${ this . data . alias }` , ScalableDimension : 'lambda:function:ProvisionedConcurrency' , ServiceNamespace : 'lambda' , RoleARN : { 'Fn::Sub' : 'arn:aws:iam::${AWS::AccountId}:role/aws-service-role/lambda.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_LambdaConcurrency' , } , } , Type : 'AWS::ApplicationAutoScaling::ScalableTarget' , } , } ; } }