AppsyncFunctionProps Struct
the CDK properties for AppSync Functions.
Example
ts
declare const api: appsync.GraphqlApi;
const appsyncFunction = new appsync.AppsyncFunction(this, 'function', {
name: 'appsync_function',
api,
dataSource: api.addNoneDataSource('none'),
requestMappingTemplate: appsync.MappingTemplate.fromFile('request.vtl'),
responseMappingTemplate: appsync.MappingTemplate.fromFile('response.vtl'),
});
python
# api: appsync.GraphqlApi
appsync_function = appsync.AppsyncFunction(self, "function",
name="appsync_function",
api=api,
data_source=api.add_none_data_source("none"),
request_mapping_template=appsync.MappingTemplate.from_file("request.vtl"),
response_mapping_template=appsync.MappingTemplate.from_file("response.vtl")
)
java
GraphqlApi api;
AppsyncFunction appsyncFunction = AppsyncFunction.Builder.create(this, "function")
.name("appsync_function")
.api(api)
.dataSource(api.addNoneDataSource("none"))
.requestMappingTemplate(MappingTemplate.fromFile("request.vtl"))
.responseMappingTemplate(MappingTemplate.fromFile("response.vtl"))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
GraphqlApi api;
var appsyncFunction = new AppsyncFunction(this, "function", new AppsyncFunctionProps {
Name = "appsync_function",
Api = api,
DataSource = api.AddNoneDataSource("none"),
RequestMappingTemplate = MappingTemplate.FromFile("request.vtl"),
ResponseMappingTemplate = MappingTemplate.FromFile("response.vtl")
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var api GraphqlApi
appsyncFunction := appsync.NewAppsyncFunction(this, jsii.String("function"), &AppsyncFunctionProps{
Name: jsii.String("appsync_function"),
Api: Api,
DataSource: api.AddNoneDataSource(jsii.String("none")),
RequestMappingTemplate: appsync.MappingTemplate_FromFile(jsii.String("request.vtl")),
ResponseMappingTemplate: appsync.MappingTemplate_*FromFile(jsii.String("response.vtl")),
})
Properties
the GraphQL Api linked to this AppSync Function.
The function code.
Default: no code is used
dataSourceBaseDataSourcedata_sourceBaseDataSourcedataSourceBaseDataSourceDataSourceBaseDataSourceDataSourceBaseDataSourcerequired#the data source linked to this AppSync Function.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#the description for this AppSync Function.
Default: no description
maxBatchSizeoptionalnumbermax_batch_sizeoptionalint | floatmaxBatchSizeoptionalNumberMaxBatchSizeoptionaldoubleMaxBatchSizeoptional*float64#The maximum number of resolver request inputs that will be sent to a single AWS Lambda function in a BatchInvoke operation.
Default: No max batch size
Can only be set when using LambdaDataSource.
the name of the AppSync Function.
requestMappingTemplateoptionalMappingTemplaterequest_mapping_templateoptionalMappingTemplaterequestMappingTemplateoptionalMappingTemplateRequestMappingTemplateoptionalMappingTemplateRequestMappingTemplateoptionalMappingTemplate#the request mapping template for the AppSync Function.
Default: no request mapping template
responseMappingTemplateoptionalMappingTemplateresponse_mapping_templateoptionalMappingTemplateresponseMappingTemplateoptionalMappingTemplateResponseMappingTemplateoptionalMappingTemplateResponseMappingTemplateoptionalMappingTemplate#the response mapping template for the AppSync Function.
Default: no response mapping template
runtimeoptionalFunctionRuntimeruntimeoptionalFunctionRuntimeruntimeoptionalFunctionRuntimeRuntimeoptionalFunctionRuntimeRuntimeoptionalFunctionRuntime#The functions runtime.
Default: no function runtime, VTL mapping templates used