UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 3.15 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommandsAction=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var codepipeline=()=>{var tmp=require("../../../aws-codepipeline");return codepipeline=()=>tmp,tmp},iam=()=>{var tmp=require("../../../aws-iam");return iam=()=>tmp,tmp},cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp},action_1=()=>{var tmp=require("../action");return action_1=()=>tmp,tmp};class CommandsAction extends action_1().Action{constructor(props){super({...props,category:codepipeline().ActionCategory.COMPUTE,provider:"Commands",artifactBounds:{minInputs:1,maxInputs:10,minOutputs:0,maxOutputs:1},inputs:[props.input,...props.extraInputs||[]],outputs:props.output?[props.output]:[],commands:props.commands,outputVariables:props.outputVariables});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codepipeline_actions_CommandsActionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CommandsAction),error}if(props.commands.length<1||props.commands.length>50)throw new(cdk()).UnscopedValidationError(`The length of the commands array must be between 1 and 50, got: ${props.commands.length}`);if(props.outputVariables!==void 0&&(props.outputVariables.length<1||props.outputVariables.length>15))throw new(cdk()).UnscopedValidationError(`The length of the outputVariables array must be between 1 and 15, got: ${props.outputVariables.length}`);this.outputVariables=props.outputVariables||[]}variable(variableName){if(!this.outputVariables.includes(variableName))throw new(cdk()).UnscopedValidationError(`Variable '${variableName}' is not exported by \`outputVariables\`, exported variables: ${this.outputVariables.join(", ")}`);return this.variableExpression(variableName)}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}const logGroupArn=cdk().Stack.of(scope).formatArn({service:"logs",resource:"log-group",resourceName:`/aws/codepipeline/${stage.pipeline.pipelineName}`,arnFormat:cdk().ArnFormat.COLON_RESOURCE_NAME}),logGroupArnWithWildcard=`${logGroupArn}:*`;return options.role.addToPrincipalPolicy(new(iam()).PolicyStatement({resources:[logGroupArn,logGroupArnWithWildcard],actions:["logs:CreateLogGroup","logs:CreateLogStream","logs:PutLogEvents"]})),options.role.addToPrincipalPolicy(new(iam()).PolicyStatement({resources:[logGroupArnWithWildcard],actions:["logs:GetLogEvents"]})),(this.actionProperties.inputs??[]).length>0&&options.bucket.grantRead(options.role),(this.actionProperties.outputs??[]).length>0&&options.bucket.grantWrite(options.role),{}}}exports.CommandsAction=CommandsAction,_a=JSII_RTTI_SYMBOL_1,CommandsAction[_a]={fqn:"aws-cdk-lib.aws_codepipeline_actions.CommandsAction",version:"2.202.0"};