Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public makeDynamoDBDataSource(tableId: string, iamRoleLogicalID: string, typeName: string, isSyncEnabled: boolean = false) {
return new AppSync.DataSource({
ApiId: Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
Name: tableId,
Type: 'AMAZON_DYNAMODB',
ServiceRoleArn: Fn.GetAtt(iamRoleLogicalID, 'Arn'),
DynamoDBConfig: {
AwsRegion: Refs.Region,
TableName: this.dynamoDBTableName(typeName),
...(isSyncEnabled && {
DeltaSyncConfig: SyncUtils.syncDataSourceConfig(),
Versioned: true,
}),
},
}).dependsOn([iamRoleLogicalID]);
}