"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.UnknownPrincipal=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class UnknownPrincipal{constructor(props){this.assumeRoleAction="sts:AssumeRole";try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_UnknownPrincipalProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,UnknownPrincipal),error}this.resource=props.resource,this.grantPrincipal=this}get policyFragment(){throw new Error(`Cannot get policy fragment of ${constructs_1().Node.of(this.resource).path}, resource imported without a role`)}addToPrincipalPolicy(statement){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_PolicyStatement(statement)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addToPrincipalPolicy),error}const stack=core_1().Stack.of(this.resource),repr=JSON.stringify(stack.resolve(statement));return core_1().Annotations.of(this.resource).addWarningV2("@aws-cdk/aws-iam:unknownPrincipalAddStatementToRole",`Add statement to this resource's role: ${repr}`),{statementAdded:!0,policyDependable:new(constructs_1()).DependencyGroup}}addToPolicy(statement){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_PolicyStatement(statement)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addToPolicy),error}return this.addToPrincipalPolicy(statement).statementAdded}}exports.UnknownPrincipal=UnknownPrincipal,_a=JSII_RTTI_SYMBOL_1,UnknownPrincipal[_a]={fqn:"aws-cdk-lib.aws_iam.UnknownPrincipal",version:"2.159.0"};
