UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 745 B
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AttachedPolicies=exports.LITERAL_STRING_KEY=void 0;var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};exports.LITERAL_STRING_KEY="LiteralString";class AttachedPolicies{policies=new Array;attach(policy){if(!this.policies.find(p=>p===policy)){if(this.policies.find(p=>p.policyName===policy.policyName))throw new(core_1()).ValidationError((0,literal_string_1().lit)`PolicyNamedAlreadyAttached`,`A policy named "${policy.policyName}" is already attached`,policy);this.policies.push(policy)}}}exports.AttachedPolicies=AttachedPolicies;