constructor()

in source/constructs/lib/common-resources/common-resources-construct.ts [36:81]


  constructor(scope: Construct, id: string, props: CommonResourcesProps) {
    super(scope, id);

    this.conditions = {
      deployUICondition: new CfnCondition(this, 'DeployDemoUICondition', {
        expression: Fn.conditionEquals(props.deployUI, 'Yes')
      }),
      enableSignatureCondition: new CfnCondition(this, 'EnableSignatureCondition', {
        expression: Fn.conditionEquals(props.enableSignature, 'Yes')
      }),
      enableDefaultFallbackImageCondition: new CfnCondition(this, 'EnableDefaultFallbackImageCondition', {
        expression: Fn.conditionEquals(props.enableDefaultFallbackImage, 'Yes')
      }),
      enableCorsCondition: new CfnCondition(this, 'EnableCorsCondition', {
        expression: Fn.conditionEquals(props.corsEnabled, 'Yes')
      })
    };

    this.secretsManagerPolicy = new Policy(this, 'SecretsManagerPolicy', {
      statements: [
        new PolicyStatement({
          actions: ['secretsmanager:GetSecretValue'],
          resources: [
            Stack.of(this).formatArn({
              partition: Aws.PARTITION,
              service: 'secretsmanager',
              region: Aws.REGION,
              account: Aws.ACCOUNT_ID,
              resource: 'secret',
              resourceName: `${props.secretsManager}*`,
              arnFormat: ArnFormat.COLON_RESOURCE_NAME
            })
          ]
        })
      ]
    });
    addCfnCondition(this.secretsManagerPolicy, this.conditions.enableSignatureCondition);

    this.customResources = new CustomResourcesConstruct(this, 'CustomResources', {
      conditions: this.conditions,
      secretsManagerPolicy: this.secretsManagerPolicy,
      ...props
    });

    this.logsBucket = this.customResources.createLogBucket();
  }