Skip to content
v2.277.0

AppSyncLambdaDataSourceProps Struct ​

Properties for an AppSync Lambda datasource.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_appsync as interfaces_appsync } from 'aws-cdk-lib/interfaces';

declare const apiRef: interfaces_appsync.IApiRef;
declare const function_: lambda.Function;
declare const role: iam.Role;
const appSyncLambdaDataSourceProps: appsync.AppSyncLambdaDataSourceProps = {
  api: apiRef,
  lambdaFunction: function_,

  // the properties below are optional
  description: 'description',
  name: 'name',
  serviceRole: role,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync
from aws_cdk import aws_iam as iam
from aws_cdk import aws_lambda as lambda_
from aws_cdk.interfaces import aws_appsync as interfaces_appsync

# api_ref: interfaces_appsync.IApiRef
# function_: lambda.Function
# role: iam.Role

app_sync_lambda_data_source_props = appsync.AppSyncLambdaDataSourceProps(
    api=api_ref,
    lambda_function=function_,

    # the properties below are optional
    description="description",
    name="name",
    service_role=role
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.interfaces.appsync.*;

IApiRef apiRef;
Function function_;
Role role;

AppSyncLambdaDataSourceProps appSyncLambdaDataSourceProps = AppSyncLambdaDataSourceProps.builder()
        .api(apiRef)
        .lambdaFunction(function_)

        // the properties below are optional
        .description("description")
        .name("name")
        .serviceRole(role)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.Lambda;
using Amazon.CDK.Interfaces.AppSync;

IApiRef apiRef;
Function function_;
Role role;

var appSyncLambdaDataSourceProps = new AppSyncLambdaDataSourceProps {
    Api = apiRef,
    LambdaFunction = function_,

    // the properties below are optional
    Description = "description",
    Name = "name",
    ServiceRole = role
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var apiRef IApiRef
var function_ Function
var role Role

appSyncLambdaDataSourceProps := &AppSyncLambdaDataSourceProps{
	Api: apiRef,
	LambdaFunction: function_,

	// the properties below are optional
	Description: jsii.String("description"),
	Name: jsii.String("name"),
	ServiceRole: role,
}

Properties ​

apiIApiRefapiIApiRefapiIApiRefApiIApiRefApiIApiRef required #
The API to attach this data source to.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = None #
The description of the data source.
lambdaFunctionIFunctionlambda_functionIFunctionlambdaFunctionIFunctionLambdaFunctionIFunctionLambdaFunctionIFunction required #
The Lambda function to call to interact with this data source.
nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string #
The name of the data source.

Default: id of data source

The only allowed pattern is: {[_A-Za-z][_0-9A-Za-z]*}. Any invalid characters will be automatically removed.

serviceRoleoptionalIRoleservice_roleoptionalIRoleserviceRoleoptionalIRoleServiceRoleoptionalIRoleServiceRoleoptionalIRole #
The IAM service role to be assumed by AppSync to interact with the data source.

Default: Create a new role