aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 3.66 kB
JavaScript
var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ManualApprovalAction=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var action_1=()=>{var tmp=require("./action");return action_1=()=>tmp,tmp},codepipeline=()=>{var tmp=require("../../aws-codepipeline");return codepipeline=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},sns=()=>{var tmp=require("../../aws-sns");return sns=()=>tmp,tmp},subs=()=>{var tmp=require("../../aws-sns-subscriptions");return subs=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class ManualApprovalAction extends action_1().Action{constructor(props){super({...props,category:codepipeline().ActionCategory.APPROVAL,provider:"Manual",artifactBounds:{minInputs:0,maxInputs:0,minOutputs:0,maxOutputs:0}});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codepipeline_actions_ManualApprovalActionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ManualApprovalAction),error}if(props.timeout&&(props.timeout.toMinutes()<5||props.timeout.toMinutes()>86400))throw new(core_1()).UnscopedValidationError(`timeout must be between 5 minutes and 86400 minutes (60 days), got ${props.timeout.toMinutes()} minutes`);this.props=props}get notificationTopic(){return this._notificationTopic}grantManualApproval(grantable){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantable)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grantManualApproval),error}if(!this.stage)throw new(core_1()).UnscopedValidationError("Cannot grant permissions before binding action to a stage");grantable.grantPrincipal.addToPrincipalPolicy(new(iam()).PolicyStatement({actions:["codepipeline:ListPipelines"],resources:["*"]})),grantable.grantPrincipal.addToPrincipalPolicy(new(iam()).PolicyStatement({actions:["codepipeline:GetPipeline","codepipeline:GetPipelineState","codepipeline:GetPipelineExecution"],resources:[this.stage.pipeline.pipelineArn]})),grantable.grantPrincipal.addToPrincipalPolicy(new(iam()).PolicyStatement({actions:["codepipeline:PutApprovalResult"],resources:[`${this.stage.pipeline.pipelineArn}/${this.stage.stageName}/${this.props.actionName}`]}))}bound(scope,stage,options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codepipeline_IStage(stage),jsiiDeprecationWarnings().aws_cdk_lib_aws_codepipeline_ActionBindOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bound),error}if(this.props.notificationTopic?this._notificationTopic=this.props.notificationTopic:(this.props.notifyEmails||[]).length>0&&(this._notificationTopic=new(sns()).Topic(scope,"TopicResource")),this._notificationTopic){this._notificationTopic.grantPublish(options.role);for(const notifyEmail of this.props.notifyEmails||[])this._notificationTopic.addSubscription(new(subs()).EmailSubscription(notifyEmail))}return this.stage=stage,{configuration:undefinedIfAllValuesAreEmpty({NotificationArn:this._notificationTopic?.topicArn,CustomData:this.props.additionalInformation,ExternalEntityLink:this.props.externalEntityLink})}}}exports.ManualApprovalAction=ManualApprovalAction,_a=JSII_RTTI_SYMBOL_1,ManualApprovalAction[_a]={fqn:"aws-cdk-lib.aws_codepipeline_actions.ManualApprovalAction",version:"2.202.0"};function undefinedIfAllValuesAreEmpty(object){return Object.values(object).some(v=>v!==void 0)?object:void 0}
;