"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.EcrSourceAction=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),codepipeline=require("../../../aws-codepipeline"),targets=require("../../../aws-events-targets"),iam=require("../../../aws-iam"),core_1=require("../../../core"),action_1=require("../action"),common_1=require("../common");class EcrSourceAction extends action_1.Action{constructor(props){super({...props,resource:props.repository,category:codepipeline.ActionCategory.SOURCE,provider:"ECR",artifactBounds:common_1.sourceArtifactBounds(),outputs:[props.output]});jsiiDeprecationWarnings.aws_cdk_lib_aws_codepipeline_actions_EcrSourceActionProps(props),this.props=props}get variables(){return{registryId:this.variableExpression("RegistryId"),repositoryName:this.variableExpression("RepositoryName"),imageDigest:this.variableExpression("ImageDigest"),imageTag:this.variableExpression("ImageTag"),imageUri:this.variableExpression("ImageURI")}}bound(_scope,stage,options){var _b;return jsiiDeprecationWarnings.aws_cdk_lib_aws_codepipeline_IStage(stage),jsiiDeprecationWarnings.aws_cdk_lib_aws_codepipeline_ActionBindOptions(options),options.role.addToPolicy(new iam.PolicyStatement({actions:["ecr:DescribeImages"],resources:[this.props.repository.repositoryArn]})),this.props.repository.onCloudTrailImagePushed(core_1.Names.nodeUniqueId(stage.pipeline.node)+"SourceEventRule",{target:new targets.CodePipeline(stage.pipeline),imageTag:this.props.imageTag===""?void 0:(_b=this.props.imageTag)!==null&&_b!==void 0?_b:"latest"}),options.bucket.grantWrite(options.role),{configuration:{RepositoryName:this.props.repository.repositoryName,ImageTag:this.props.imageTag?this.props.imageTag:void 0}}}}exports.EcrSourceAction=EcrSourceAction,_a=JSII_RTTI_SYMBOL_1,EcrSourceAction[_a]={fqn:"aws-cdk-lib.aws_codepipeline_actions.EcrSourceAction",version:"2.13.0"};
//# sourceMappingURL=source-action.js.map
