@aws-cdk/aws-iam
Version:
CDK routines for easily assigning correct and minimal IAM permissions
21 lines • 2.15 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.MutatingPolicyDocumentAdapter = void 0;
const policy_document_1 = require("../policy-document");
/**
* A PolicyDocument adapter that can modify statements flowing through it
*/
class MutatingPolicyDocumentAdapter extends policy_document_1.PolicyDocument {
constructor(wrapped, mutator) {
super();
this.wrapped = wrapped;
this.mutator = mutator;
}
addStatements(...statements) {
for (const st of statements) {
this.wrapped.addStatements(this.mutator(st));
}
}
}
exports.MutatingPolicyDocumentAdapter = MutatingPolicyDocumentAdapter;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9saWN5ZG9jLWFkYXB0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJwb2xpY3lkb2MtYWRhcHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSx3REFBb0Q7QUFHcEQ7O0dBRUc7QUFDSCxNQUFhLDZCQUE4QixTQUFRLGdDQUFjO0lBQy9ELFlBQTZCLE9BQXVCLEVBQW1CLE9BQWdEO1FBQ3JILEtBQUssRUFBRSxDQUFDO1FBRG1CLFlBQU8sR0FBUCxPQUFPLENBQWdCO1FBQW1CLFlBQU8sR0FBUCxPQUFPLENBQXlDO0tBRXRIO0lBRU0sYUFBYSxDQUFDLEdBQUcsVUFBNkI7UUFDbkQsS0FBSyxNQUFNLEVBQUUsSUFBSSxVQUFVLEVBQUU7WUFDM0IsSUFBSSxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDO1NBQzlDO0tBQ0Y7Q0FDRjtBQVZELHNFQVVDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgUG9saWN5RG9jdW1lbnQgfSBmcm9tICcuLi9wb2xpY3ktZG9jdW1lbnQnO1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