aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 1.68 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBusGrants=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var events=()=>{var tmp=require("./events.generated");return events=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp};class EventBusGrants{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_events.EventBusGrants",version:"2.248.0"};static fromEventBus(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_events_IEventBusRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromEventBus),error}return new EventBusGrants({resource})}resource;constructor(props){this.resource=props.resource}actions(grantee,actions,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee),jsiiDeprecationWarnings().aws_cdk_lib_PermissionsOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.actions),error}return iam().Grant.addToPrincipal({actions,grantee,resourceArns:options.resourceArns??[events().CfnEventBus.arnForEventBus(this.resource)]})}allPutEvents(grantee){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.allPutEvents),error}const actions=["events:PutEvents"];return this.actions(grantee,actions,{resourceArns:["*"]})}}exports.EventBusGrants=EventBusGrants;