aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.44 kB
JavaScript
;var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppsyncFunction=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var appsync_generated_1=()=>{var tmp=require("./appsync.generated");return appsync_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class AppsyncFunction extends core_1().Resource{static fromAppsyncFunctionAttributes(scope,id,attrs){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_AppsyncFunctionAttributes(attrs)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromAppsyncFunctionAttributes),error}class Import extends core_1().Resource{constructor(s,i){super(s,i),this.functionId=core_1().Lazy.stringValue({produce:()=>core_1().Fn.select(3,core_1().Fn.split("/",attrs.functionArn))}),this.functionArn=attrs.functionArn}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_AppsyncFunctionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,AppsyncFunction),error}if(props.runtime&&!props.code)throw new Error("Code is required when specifying a runtime");if(props.code&&(props.requestMappingTemplate||props.responseMappingTemplate))throw new Error("Mapping templates cannot be used alongside code");const code=props.code?.bind(this);this.function=new(appsync_generated_1()).CfnFunctionConfiguration(this,"Resource",{name:props.name,description:props.description,apiId:props.api.apiId,dataSourceName:props.dataSource.name,runtime:props.runtime?.toProperties(),codeS3Location:code?.s3Location,code:code?.inlineCode,functionVersion:"2018-05-29",requestMappingTemplate:props.requestMappingTemplate?.renderTemplate(),responseMappingTemplate:props.responseMappingTemplate?.renderTemplate()}),this.functionName=this.function.attrName,this.functionArn=this.function.attrFunctionArn,this.functionId=this.function.attrFunctionId,this.dataSource=props.dataSource,this.function.addDependency(this.dataSource.ds),props.api.addSchemaDependency(this.function)}}exports.AppsyncFunction=AppsyncFunction,_a=JSII_RTTI_SYMBOL_1,AppsyncFunction[_a]={fqn:"aws-cdk-lib.aws_appsync.AppsyncFunction",version:"2.130.0"};