"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.RepositoryImage=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},container_image_1=()=>{var tmp=require("../container-image");return container_image_1=()=>tmp,tmp};const ECR_IMAGE_REGEX=/(^[a-zA-Z0-9][a-zA-Z0-9-_]*)\.dkr\.ecr\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.amazonaws.com(\.cn)?\/.*/;class RepositoryImage extends container_image_1().ContainerImage{constructor(imageName,props={}){super(),this.imageName=imageName,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_RepositoryImageProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,RepositoryImage),error}}bind(scope,containerDefinition){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_ContainerDefinition(containerDefinition)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}return!core_1().Token.isUnresolved(this.imageName)&&ECR_IMAGE_REGEX.test(this.imageName)&&core_1().Annotations.of(scope).addWarningV2("@aws-cdk/aws-ecs:ecrImageRequiresPolicy","Proper policies need to be attached before pulling from ECR repository, or use 'fromEcrRepository'."),this.props.credentials&&this.props.credentials.grantRead(containerDefinition.taskDefinition.obtainExecutionRole()),{imageName:this.imageName,repositoryCredentials:this.props.credentials&&{credentialsParameter:this.props.credentials.secretArn}}}}exports.RepositoryImage=RepositoryImage,_a=JSII_RTTI_SYMBOL_1,RepositoryImage[_a]={fqn:"aws-cdk-lib.aws_ecs.RepositoryImage",version:"2.148.1"};
