"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StateMachineGrants=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var stepfunctions=()=>{var tmp=require("./stepfunctions.generated");return stepfunctions=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class StateMachineGrants{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_stepfunctions.StateMachineGrants",version:"2.256.1"};static fromStateMachine(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_stepfunctions_IStateMachineRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromStateMachine),error}return new StateMachineGrants({resource})}resource;constructor(props){this.resource=props.resource}taskResponse(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.taskResponse),error}const actions=["states:SendTaskSuccess","states:SendTaskFailure","states:SendTaskHeartbeat"];return iam().Grant.addToPrincipal({actions,grantee,resourceArns:[stepfunctions().CfnStateMachine.arnForStateMachine(this.resource)]})}redriveExecution(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.redriveExecution),error}const actions=["states:RedriveExecution"];return iam().Grant.addToPrincipal({actions,grantee,resourceArns:[stepfunctions().CfnStateMachine.arnForStateMachine(this.resource)+":*"]})}read(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.read),error}return iam().Grant.addToPrincipal({grantee,actions:["states:ListExecutions","states:ListStateMachines"],resourceArns:[stepfunctions().CfnStateMachine.arnForStateMachine(this.resource)]}),iam().Grant.addToPrincipal({grantee,actions:["states:DescribeExecution","states:DescribeStateMachineForExecution","states:GetExecutionHistory"],resourceArns:[this.executionArn()+":*"]}),iam().Grant.addToPrincipal({grantee,actions:["states:ListActivities","states:DescribeStateMachine","states:DescribeActivity"],resourceArns:["*"]})}startExecution(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.startExecution),error}return iam().Grant.addToPrincipal({grantee,actions:["states:StartExecution"],resourceArns:[this.resource.stateMachineRef.stateMachineArn]})}startSyncExecution(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.startSyncExecution),error}return iam().Grant.addToPrincipal({grantee,actions:["states:StartSyncExecution"],resourceArns:[this.resource.stateMachineRef.stateMachineArn]})}execution(grantee,...actions){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.execution),error}return iam().Grant.addToPrincipal({grantee,actions,resourceArns:[this.executionArn()+":*"]})}actions(identity,...actions){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(identity)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.actions),error}return iam().Grant.addToPrincipal({grantee:identity,actions,resourceArns:[this.resource.stateMachineRef.stateMachineArn]})}executionArn(){return core_1().Stack.of(this.resource).formatArn({resource:"execution",service:"states",resourceName:core_1().Arn.split(this.resource.stateMachineRef.stateMachineArn,core_1().ArnFormat.COLON_RESOURCE_NAME).resourceName,arnFormat:core_1().ArnFormat.COLON_RESOURCE_NAME})}}exports.StateMachineGrants=StateMachineGrants;
