"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cdk_1 = require("@aws-cdk/cdk");
const sns_generated_1 = require("./sns.generated");
/**
 * Applies a policy to SNS topics.
 */
class TopicPolicy extends cdk_1.Construct {
    constructor(parent, name, props) {
        super(parent, name);
        /**
         * The IAM policy document for this policy.
         */
        this.document = new cdk_1.PolicyDocument();
        new sns_generated_1.cloudformation.TopicPolicyResource(this, 'Resource', {
            policyDocument: this.document,
            topics: props.topics.map(t => t.topicArn)
        });
    }
}
exports.TopicPolicy = TopicPolicy;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9saWN5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsicG9saWN5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsc0NBQXlEO0FBQ3pELG1EQUFpRDtBQVVqRDs7R0FFRztBQUNILE1BQWEsV0FBWSxTQUFRLGVBQVM7SUFNdEMsWUFBWSxNQUFpQixFQUFFLElBQVksRUFBRSxLQUF1QjtRQUNoRSxLQUFLLENBQUMsTUFBTSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBTnhCOztXQUVHO1FBQ2EsYUFBUSxHQUFHLElBQUksb0JBQWMsRUFBRSxDQUFDO1FBSzVDLElBQUksOEJBQWMsQ0FBQyxtQkFBbUIsQ0FBQyxJQUFJLEVBQUUsVUFBVSxFQUFFO1lBQ3JELGNBQWMsRUFBRSxJQUFJLENBQUMsUUFBUTtZQUM3QixNQUFNLEVBQUUsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsUUFBUSxDQUFDO1NBQzVDLENBQUMsQ0FBQztJQUNQLENBQUM7Q0FDSjtBQWRELGtDQWNDIn0=