UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 2.51 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Trigger=exports.ProviderType=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var ProviderType;(function(ProviderType2){ProviderType2.CODE_STAR_SOURCE_CONNECTION="CodeStarSourceConnection"})(ProviderType||(exports.ProviderType=ProviderType={}));class Trigger{constructor(props){this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codepipeline_TriggerProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Trigger),error}this.sourceAction=props.gitConfiguration?.sourceAction,this.validate()}validate(){if(this.props.gitConfiguration){const sourceAction=this.props.gitConfiguration.sourceAction;if(sourceAction.actionProperties.provider!=="CodeStarSourceConnection")throw new Error(`provider for actionProperties in sourceAction with name '${sourceAction.actionProperties.actionName}' must be 'CodeStarSourceConnection', got '${sourceAction.actionProperties.provider}'`);const pushFilter=this.props.gitConfiguration.pushFilter;if(pushFilter!==void 0&&pushFilter.length>3)throw new Error(`length of pushFilter for sourceAction with name '${sourceAction.actionProperties.actionName}' must be less than or equal to 3, got ${pushFilter.length}`);pushFilter?.forEach(filter=>{if(filter.tagsExcludes&&filter.tagsExcludes.length>8)throw new Error(`maximum length of tagsExcludes for sourceAction with name '${sourceAction.actionProperties.actionName}' is 8, got ${filter.tagsExcludes.length}`);if(filter.tagsIncludes&&filter.tagsIncludes.length>8)throw new Error(`maximum length of tagsIncludes for sourceAction with name '${sourceAction.actionProperties.actionName}' is 8, got ${filter.tagsIncludes.length}`)})}}_render(){let gitConfiguration;if(this.props.gitConfiguration){const sourceAction=this.props.gitConfiguration.sourceAction,push=this.props.gitConfiguration.pushFilter?.map(filter=>({tags:{excludes:filter.tagsExcludes?.length?filter.tagsExcludes:void 0,includes:filter.tagsIncludes?.length?filter.tagsIncludes:void 0}}));gitConfiguration={push:push?.length?push:void 0,sourceActionName:sourceAction.actionProperties.actionName}}return{gitConfiguration,providerType:this.props.providerType}}}exports.Trigger=Trigger,_a=JSII_RTTI_SYMBOL_1,Trigger[_a]={fqn:"aws-cdk-lib.aws_codepipeline.Trigger",version:"2.130.0"};