UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 1.5 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClusterGrants=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var aws_iam_1=()=>{var tmp=require("../../aws-iam");return aws_iam_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class ClusterGrants{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_ecs.ClusterGrants",version:"2.233.0"};static fromCluster(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_ecs_IClusterRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromCluster),error}return new ClusterGrants({resource})}resource;constructor(props){this.resource=props.resource}taskProtection(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.taskProtection),error}const actions=["ecs:UpdateTaskProtection"];return aws_iam_1().Grant.addToPrincipal({actions,grantee,resourceArns:[this.arnForTasks("*")]})}arnForTasks(keyPattern){return core_1().Stack.of(this.resource).formatArn({service:"ecs",resource:"task",resourceName:`${this.resource.clusterRef.clusterName}/${keyPattern}`,arnFormat:core_1().ArnFormat.SLASH_RESOURCE_NAME})}}exports.ClusterGrants=ClusterGrants;