@aws-amplify/graphql-searchable-transformer
Advanced tools
Comparing version 0.4.1 to 0.4.2-ext.0
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.4.2-ext.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-searchable-transformer@0.3.0-ext.0...@aws-amplify/graphql-searchable-transformer@0.4.2-ext.0) (2021-08-20) | ||
**Note:** Version bump only for package @aws-amplify/graphql-searchable-transformer | ||
## [0.4.1](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-searchable-transformer@0.4.0...@aws-amplify/graphql-searchable-transformer@0.4.1) (2021-08-06) | ||
@@ -8,0 +16,0 @@ |
@@ -8,12 +8,12 @@ "use strict"; | ||
const createStackOutputs = (stack, endpoint, apiId, arn) => { | ||
const { ElasticsearchDomainArn, ElasticsearchDomainEndpoint } = graphql_transformer_common_1.ResourceConstants.OUTPUTS; | ||
new core_2.CfnOutput(stack, ElasticsearchDomainArn, { | ||
const { OpenSearchDomainArn, OpenSearchDomainEndpoint } = graphql_transformer_common_1.ResourceConstants.OUTPUTS; | ||
new core_2.CfnOutput(stack, OpenSearchDomainArn, { | ||
value: arn, | ||
description: 'Elasticsearch instance Domain ARN.', | ||
exportName: core_1.Fn.join(':', [apiId, 'GetAtt', 'Elasticsearch', 'DomainArn']).toString(), | ||
description: 'OpenSearch instance Domain ARN.', | ||
exportName: core_1.Fn.join(':', [apiId, 'GetAtt', 'OpenSearch', 'DomainArn']).toString(), | ||
}); | ||
new core_2.CfnOutput(stack, ElasticsearchDomainEndpoint, { | ||
new core_2.CfnOutput(stack, OpenSearchDomainEndpoint, { | ||
value: 'https://' + endpoint, | ||
description: 'Elasticsearch instance Domain Endpoint.', | ||
exportName: core_1.Fn.join(':', [apiId, 'GetAtt', 'Elasticsearch', 'DomainEndpoint']).toString(), | ||
description: 'OpenSearch instance Domain Endpoint.', | ||
exportName: core_1.Fn.join(':', [apiId, 'GetAtt', 'OpenSearch', 'DomainEndpoint']).toString(), | ||
}); | ||
@@ -20,0 +20,0 @@ }; |
@@ -7,14 +7,14 @@ "use strict"; | ||
function createParametersStack(stack) { | ||
const { ElasticsearchAccessIAMRoleName, ElasticsearchStreamingLambdaHandlerName, ElasticsearchStreamingLambdaRuntime, ElasticsearchStreamingFunctionName, ElasticsearchStreamBatchSize, ElasticsearchStreamMaximumBatchingWindowInSeconds, ElasticsearchStreamingIAMRoleName, ElasticsearchDebugStreamingLambda, ElasticsearchInstanceCount, ElasticsearchInstanceType, ElasticsearchEBSVolumeGB, } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
const { OpenSearchAccessIAMRoleName, OpenSearchStreamingLambdaHandlerName, OpenSearchStreamingLambdaRuntime, OpenSearchStreamingFunctionName, OpenSearchStreamBatchSize, OpenSearchStreamMaximumBatchingWindowInSeconds, OpenSearchStreamingIAMRoleName, OpenSearchDebugStreamingLambda, OpenSearchInstanceCount, OpenSearchInstanceType, OpenSearchEBSVolumeGB, } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
return new Map([ | ||
[ | ||
ElasticsearchAccessIAMRoleName, | ||
new core_1.CfnParameter(stack, ElasticsearchAccessIAMRoleName, { | ||
description: 'The name of the IAM role assumed by AppSync for Elasticsearch.', | ||
default: 'AppSyncElasticsearchRole', | ||
OpenSearchAccessIAMRoleName, | ||
new core_1.CfnParameter(stack, OpenSearchAccessIAMRoleName, { | ||
description: 'The name of the IAM role assumed by AppSync for OpenSearch.', | ||
default: 'AppSyncOpenSearchRole', | ||
}), | ||
], | ||
[ | ||
ElasticsearchStreamingLambdaHandlerName, | ||
new core_1.CfnParameter(stack, ElasticsearchStreamingLambdaHandlerName, { | ||
OpenSearchStreamingLambdaHandlerName, | ||
new core_1.CfnParameter(stack, OpenSearchStreamingLambdaHandlerName, { | ||
description: 'The name of the lambda handler.', | ||
@@ -25,4 +25,4 @@ default: 'python_streaming_function.lambda_handler', | ||
[ | ||
ElasticsearchStreamingLambdaRuntime, | ||
new core_1.CfnParameter(stack, ElasticsearchStreamingLambdaRuntime, { | ||
OpenSearchStreamingLambdaRuntime, | ||
new core_1.CfnParameter(stack, OpenSearchStreamingLambdaRuntime, { | ||
description: `The lambda runtime \ | ||
@@ -34,4 +34,4 @@ (https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Runtime)`, | ||
[ | ||
ElasticsearchStreamingFunctionName, | ||
new core_1.CfnParameter(stack, ElasticsearchStreamingFunctionName, { | ||
OpenSearchStreamingFunctionName, | ||
new core_1.CfnParameter(stack, OpenSearchStreamingFunctionName, { | ||
description: 'The name of the streaming lambda function.', | ||
@@ -42,5 +42,5 @@ default: 'DdbToEsFn', | ||
[ | ||
ElasticsearchStreamBatchSize, | ||
new core_1.CfnParameter(stack, ElasticsearchStreamBatchSize, { | ||
description: 'The maximum number of records to stream to Elasticsearch per batch.', | ||
OpenSearchStreamBatchSize, | ||
new core_1.CfnParameter(stack, OpenSearchStreamBatchSize, { | ||
description: 'The maximum number of records to stream to OpenSearch per batch.', | ||
type: 'Number', | ||
@@ -51,4 +51,4 @@ default: 100, | ||
[ | ||
ElasticsearchStreamMaximumBatchingWindowInSeconds, | ||
new core_1.CfnParameter(stack, ElasticsearchStreamMaximumBatchingWindowInSeconds, { | ||
OpenSearchStreamMaximumBatchingWindowInSeconds, | ||
new core_1.CfnParameter(stack, OpenSearchStreamMaximumBatchingWindowInSeconds, { | ||
description: 'The maximum amount of time in seconds to wait for DynamoDB stream records before sending to streaming lambda.', | ||
@@ -60,4 +60,4 @@ type: 'Number', | ||
[ | ||
ElasticsearchAccessIAMRoleName, | ||
new core_1.CfnParameter(stack, ElasticsearchStreamingIAMRoleName, { | ||
OpenSearchAccessIAMRoleName, | ||
new core_1.CfnParameter(stack, OpenSearchStreamingIAMRoleName, { | ||
description: 'The name of the streaming lambda function IAM role.', | ||
@@ -68,5 +68,5 @@ default: 'SearchableLambdaIAMRole', | ||
[ | ||
ElasticsearchDebugStreamingLambda, | ||
new core_1.CfnParameter(stack, ElasticsearchDebugStreamingLambda, { | ||
description: 'Enable debug logs for the Dynamo -> ES streaming lambda.', | ||
OpenSearchDebugStreamingLambda, | ||
new core_1.CfnParameter(stack, OpenSearchDebugStreamingLambda, { | ||
description: 'Enable debug logs for the Dynamo -> OpenSearch streaming lambda.', | ||
default: 1, | ||
@@ -78,5 +78,5 @@ type: 'Number', | ||
[ | ||
ElasticsearchInstanceCount, | ||
new core_1.CfnParameter(stack, ElasticsearchInstanceCount, { | ||
description: 'The number of instances to launch into the Elasticsearch domain.', | ||
OpenSearchInstanceCount, | ||
new core_1.CfnParameter(stack, OpenSearchInstanceCount, { | ||
description: 'The number of instances to launch into the OpenSearch domain.', | ||
default: 1, | ||
@@ -87,5 +87,5 @@ type: 'Number', | ||
[ | ||
ElasticsearchInstanceType, | ||
new core_1.CfnParameter(stack, ElasticsearchInstanceType, { | ||
description: 'The type of instance to launch into the Elasticsearch domain.', | ||
OpenSearchInstanceType, | ||
new core_1.CfnParameter(stack, OpenSearchInstanceType, { | ||
description: 'The type of instance to launch into the OpenSearch domain.', | ||
default: 't2.small.elasticsearch', | ||
@@ -132,4 +132,4 @@ allowedValues: [ | ||
[ | ||
ElasticsearchEBSVolumeGB, | ||
new core_1.CfnParameter(stack, ElasticsearchEBSVolumeGB, { | ||
OpenSearchEBSVolumeGB, | ||
new core_1.CfnParameter(stack, OpenSearchEBSVolumeGB, { | ||
description: 'The size in GB of the EBS volumes that contain our data.', | ||
@@ -136,0 +136,0 @@ default: 10, |
@@ -34,11 +34,11 @@ "use strict"; | ||
assert_1.default(region); | ||
const { ElasticsearchStreamingLambdaFunctionLogicalID } = graphql_transformer_common_1.ResourceConstants.RESOURCES; | ||
const { ElasticsearchStreamingLambdaHandlerName, ElasticsearchDebugStreamingLambda } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
const { OpenSearchStreamingLambdaFunctionLogicalID } = graphql_transformer_common_1.ResourceConstants.RESOURCES; | ||
const { OpenSearchStreamingLambdaHandlerName, OpenSearchDebugStreamingLambda } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
const enviroment = { | ||
ES_ENDPOINT: 'https://' + endpoint, | ||
ES_REGION: region, | ||
DEBUG: parameterMap.get(ElasticsearchDebugStreamingLambda).valueAsString, | ||
ES_USE_EXTERNAL_VERSIONING: isProjectUsingDataStore.toString(), | ||
OPENSEARCH_ENDPOINT: 'https://' + endpoint, | ||
OPENSEARCH_REGION: region, | ||
DEBUG: parameterMap.get(OpenSearchDebugStreamingLambda).valueAsString, | ||
OPENSEARCH_USE_EXTERNAL_VERSIONING: isProjectUsingDataStore.toString(), | ||
}; | ||
return apiGraphql.host.addLambdaFunction(ElasticsearchStreamingLambdaFunctionLogicalID, 'functions/' + ElasticsearchStreamingLambdaFunctionLogicalID + '.zip', parameterMap.get(ElasticsearchStreamingLambdaHandlerName).valueAsString, path.resolve(__dirname, '..', '..', 'lib', 'streaming-lambda.zip'), aws_lambda_1.Runtime.PYTHON_3_6, [ | ||
return apiGraphql.host.addLambdaFunction(OpenSearchStreamingLambdaFunctionLogicalID, 'functions/' + OpenSearchStreamingLambdaFunctionLogicalID + '.zip', parameterMap.get(OpenSearchStreamingLambdaHandlerName).valueAsString, path.resolve(__dirname, '..', '..', 'lib', 'streaming-lambda.zip'), aws_lambda_1.Runtime.PYTHON_3_6, [ | ||
aws_lambda_1.LayerVersion.fromLayerVersionArn(stack, 'LambdaLayerVersion', core_1.Fn.findInMap('LayerResourceMapping', core_1.Fn.ref('AWS::Region'), 'layerRegion')), | ||
@@ -50,7 +50,7 @@ ], lambdaRole, enviroment, undefined, stack); | ||
var _a; | ||
const { ElasticsearchStreamingLambdaIAMRoleLogicalID } = graphql_transformer_common_1.ResourceConstants.RESOURCES; | ||
const { ElasticsearchStreamingIAMRoleName } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
const role = new aws_iam_1.Role(stack, ElasticsearchStreamingLambdaIAMRoleLogicalID, { | ||
const { OpenSearchStreamingLambdaIAMRoleLogicalID } = graphql_transformer_common_1.ResourceConstants.RESOURCES; | ||
const { OpenSearchStreamingIAMRoleName } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
const role = new aws_iam_1.Role(stack, OpenSearchStreamingLambdaIAMRoleLogicalID, { | ||
assumedBy: new aws_iam_1.ServicePrincipal('lambda.amazonaws.com'), | ||
roleName: (_a = parameterMap.get(ElasticsearchStreamingIAMRoleName)) === null || _a === void 0 ? void 0 : _a.valueAsString, | ||
roleName: (_a = parameterMap.get(OpenSearchStreamingIAMRoleName)) === null || _a === void 0 ? void 0 : _a.valueAsString, | ||
}); | ||
@@ -70,3 +70,3 @@ role.attachInlinePolicy(new aws_iam_1.Policy(stack, 'CloudwatchLogsAccess', { | ||
const createEventSourceMapping = (stack, type, target, parameterMap, tableStreamArn) => { | ||
const { ElasticsearchStreamBatchSize, ElasticsearchStreamMaximumBatchingWindowInSeconds } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
const { OpenSearchStreamBatchSize, OpenSearchStreamMaximumBatchingWindowInSeconds } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
assert_1.default(tableStreamArn); | ||
@@ -76,4 +76,4 @@ return new aws_lambda_1.EventSourceMapping(stack, graphql_transformer_common_1.SearchableResourceIDs.SearchableEventSourceMappingID(type), { | ||
target, | ||
batchSize: parameterMap.get(ElasticsearchStreamBatchSize).valueAsNumber, | ||
maxBatchingWindow: core_1.Duration.seconds(parameterMap.get(ElasticsearchStreamMaximumBatchingWindowInSeconds).valueAsNumber), | ||
batchSize: parameterMap.get(OpenSearchStreamBatchSize).valueAsNumber, | ||
maxBatchingWindow: core_1.Duration.seconds(parameterMap.get(OpenSearchStreamMaximumBatchingWindowInSeconds).valueAsNumber), | ||
enabled: true, | ||
@@ -80,0 +80,0 @@ startingPosition: aws_lambda_1.StartingPosition.LATEST, |
@@ -25,3 +25,3 @@ "use strict"; | ||
]), | ||
graphql_mapping_template_1.ElasticsearchMappingTemplate.searchTemplate({ | ||
graphql_mapping_template_1.SearchableMappingTemplate.searchTemplate({ | ||
path: graphql_mapping_template_1.str('$indexPath'), | ||
@@ -28,0 +28,0 @@ size: graphql_mapping_template_1.ifElse(graphql_mapping_template_1.ref('context.args.limit'), graphql_mapping_template_1.ref('context.args.limit'), graphql_mapping_template_1.int(graphql_transformer_common_1.ResourceConstants.DEFAULT_SEARCHABLE_PAGE_LIMIT), true), |
@@ -16,4 +16,4 @@ "use strict"; | ||
const create_layer_cfnMapping_1 = require("./cdk/create-layer-cfnMapping"); | ||
const create_es_domain_1 = require("./cdk/create-es-domain"); | ||
const create_es_datasource_1 = require("./cdk/create-es-datasource"); | ||
const create_searchable_domain_1 = require("./cdk/create-searchable-domain"); | ||
const create_searchable_datasource_1 = require("./cdk/create-searchable-datasource"); | ||
const create_streaming_lambda_1 = require("./cdk/create-streaming-lambda"); | ||
@@ -44,6 +44,6 @@ const create_cfnOutput_1 = require("./cdk/create-cfnOutput"); | ||
const parameterMap = create_cfnParameters_1.createParametersStack(stack); | ||
const domain = create_es_domain_1.createEsDomain(stack, parameterMap, context.api.apiId); | ||
const elasticsearchRole = create_es_domain_1.createEsDomainRole(stack, parameterMap, context.api.apiId, envParam); | ||
domain.grantReadWrite(elasticsearchRole); | ||
const datasource = create_es_datasource_1.createEsDataSource(stack, context.api, domain.domainEndpoint, elasticsearchRole, stack.parseArn(domain.domainArn).region); | ||
const domain = create_searchable_domain_1.createSearchableDomain(stack, parameterMap, context.api.apiId); | ||
const openSearchRole = create_searchable_domain_1.createSearchableDomainRole(stack, parameterMap, context.api.apiId, envParam); | ||
domain.grantReadWrite(openSearchRole); | ||
const datasource = create_searchable_datasource_1.createSearchableDataSource(stack, context.api, domain.domainEndpoint, openSearchRole, stack.parseArn(domain.domainArn).region); | ||
const lambdaRole = create_streaming_lambda_1.createLambdaRole(stack, parameterMap); | ||
@@ -50,0 +50,0 @@ domain.grantWrite(lambdaRole); |
{ | ||
"name": "@aws-amplify/graphql-searchable-transformer", | ||
"version": "0.4.1", | ||
"version": "0.4.2-ext.0", | ||
"description": "Amplfy GraphQL @searchable transformer", | ||
@@ -30,8 +30,8 @@ "repository": { | ||
"dependencies": { | ||
"@aws-amplify/graphql-transformer-core": "0.8.1", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.8.1", | ||
"@aws-amplify/graphql-transformer-core": "0.8.2-ext.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.8.2-ext.0", | ||
"@aws-cdk/aws-appsync": "~1.72.0", | ||
"@aws-cdk/aws-dynamodb": "~1.72.0", | ||
"@aws-cdk/aws-ec2": "~1.72.0", | ||
"@aws-cdk/aws-elasticsearch": "1.72.0", | ||
"@aws-cdk/aws-elasticsearch": "~1.72.0", | ||
"@aws-cdk/aws-iam": "~1.72.0", | ||
@@ -41,4 +41,4 @@ "@aws-cdk/aws-lambda": "~1.72.0", | ||
"graphql": "^14.5.8", | ||
"graphql-mapping-template": "4.18.2", | ||
"graphql-transformer-common": "4.19.7" | ||
"graphql-mapping-template": "4.18.3-ext.0", | ||
"graphql-transformer-common": "4.19.8-ext.0" | ||
}, | ||
@@ -66,3 +66,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "254e137af2617b38d7704df996cbf598b5583dc2" | ||
"gitHead": "6d0282a77f5e4a200d8b2b76e227863d21ec9d33" | ||
} |
@@ -7,4 +7,4 @@ # GraphQL @searchable Transformer | ||
The `@searchable` directive handles streaming the data of an `@model` object type to | ||
Elasticsearch and configures search resolvers that search that information. | ||
The `@searchable` directive handles streaming the data of an `@model` object type | ||
and configures search resolvers that search that information. | ||
@@ -14,3 +14,3 @@ #### Definition | ||
```graphql | ||
# Streams data from dynamodb into elasticsearch and exposes search capabilities. | ||
# Streams data from dynamodb into opensearch and exposes search capabilities. | ||
directive @searchable(queries: SearchableQueryMap) on OBJECT | ||
@@ -17,0 +17,0 @@ input SearchableQueryMap { |
@@ -207,3 +207,3 @@ import { GraphQLTransform } from '@aws-amplify/graphql-transformer-core'; | ||
}, | ||
Name: 'ElasticSearchDataSource', | ||
Name: 'OpenSearchDataSource', | ||
Type: 'AMAZON_ELASTICSEARCH', | ||
@@ -218,3 +218,3 @@ ElasticsearchConfig: { | ||
{ | ||
'Fn::GetAtt': ['ElasticSearchDomain', 'Arn'], | ||
'Fn::GetAtt': ['OpenSearchDomain', 'Arn'], | ||
}, | ||
@@ -231,3 +231,3 @@ ], | ||
{ | ||
'Fn::GetAtt': ['ElasticSearchDomain', 'DomainEndpoint'], | ||
'Fn::GetAtt': ['OpenSearchDomain', 'DomainEndpoint'], | ||
}, | ||
@@ -239,3 +239,3 @@ ], | ||
ServiceRoleArn: { | ||
'Fn::GetAtt': ['ElasticSearchAccessIAMRoleAAA3FF0B', 'Arn'], | ||
'Fn::GetAtt': ['OpenSearchAccessIAMRole6A1D9CC5', 'Arn'], | ||
}, | ||
@@ -270,3 +270,3 @@ }), | ||
{ | ||
'Fn::GetAtt': ['ElasticSearchDomain', 'DomainEndpoint'], | ||
'Fn::GetAtt': ['OpenSearchDomain', 'DomainEndpoint'], | ||
}, | ||
@@ -273,0 +273,0 @@ '"))\n$util.toJson({})', |
@@ -6,13 +6,13 @@ import { Construct, Fn } from '@aws-cdk/core'; | ||
export const createStackOutputs = (stack: Construct, endpoint: string, apiId: string, arn: string): void => { | ||
const { ElasticsearchDomainArn, ElasticsearchDomainEndpoint } = ResourceConstants.OUTPUTS; | ||
new CfnOutput(stack, ElasticsearchDomainArn, { | ||
const { OpenSearchDomainArn, OpenSearchDomainEndpoint } = ResourceConstants.OUTPUTS; | ||
new CfnOutput(stack, OpenSearchDomainArn, { | ||
value: arn, | ||
description: 'Elasticsearch instance Domain ARN.', | ||
exportName: Fn.join(':', [apiId, 'GetAtt', 'Elasticsearch', 'DomainArn']).toString(), | ||
description: 'OpenSearch instance Domain ARN.', | ||
exportName: Fn.join(':', [apiId, 'GetAtt', 'OpenSearch', 'DomainArn']).toString(), | ||
}); | ||
new CfnOutput(stack, ElasticsearchDomainEndpoint, { | ||
new CfnOutput(stack, OpenSearchDomainEndpoint, { | ||
value: 'https://' + endpoint, | ||
description: 'Elasticsearch instance Domain Endpoint.', | ||
exportName: Fn.join(':', [apiId, 'GetAtt', 'Elasticsearch', 'DomainEndpoint']).toString(), | ||
description: 'OpenSearch instance Domain Endpoint.', | ||
exportName: Fn.join(':', [apiId, 'GetAtt', 'OpenSearch', 'DomainEndpoint']).toString(), | ||
}); | ||
}; |
@@ -6,20 +6,20 @@ import { ResourceConstants } from 'graphql-transformer-common'; | ||
const { | ||
ElasticsearchAccessIAMRoleName, | ||
ElasticsearchStreamingLambdaHandlerName, | ||
ElasticsearchStreamingLambdaRuntime, | ||
ElasticsearchStreamingFunctionName, | ||
ElasticsearchStreamBatchSize, | ||
ElasticsearchStreamMaximumBatchingWindowInSeconds, | ||
ElasticsearchStreamingIAMRoleName, | ||
ElasticsearchDebugStreamingLambda, | ||
ElasticsearchInstanceCount, | ||
ElasticsearchInstanceType, | ||
ElasticsearchEBSVolumeGB, | ||
OpenSearchAccessIAMRoleName, | ||
OpenSearchStreamingLambdaHandlerName, | ||
OpenSearchStreamingLambdaRuntime, | ||
OpenSearchStreamingFunctionName, | ||
OpenSearchStreamBatchSize, | ||
OpenSearchStreamMaximumBatchingWindowInSeconds, | ||
OpenSearchStreamingIAMRoleName, | ||
OpenSearchDebugStreamingLambda, | ||
OpenSearchInstanceCount, | ||
OpenSearchInstanceType, | ||
OpenSearchEBSVolumeGB, | ||
} = ResourceConstants.PARAMETERS; | ||
return new Map<string, CfnParameter>([ | ||
[ | ||
ElasticsearchAccessIAMRoleName, | ||
new CfnParameter(stack, ElasticsearchAccessIAMRoleName, { | ||
description: 'The name of the IAM role assumed by AppSync for Elasticsearch.', | ||
default: 'AppSyncElasticsearchRole', | ||
OpenSearchAccessIAMRoleName, | ||
new CfnParameter(stack, OpenSearchAccessIAMRoleName, { | ||
description: 'The name of the IAM role assumed by AppSync for OpenSearch.', | ||
default: 'AppSyncOpenSearchRole', | ||
}), | ||
@@ -29,4 +29,4 @@ ], | ||
[ | ||
ElasticsearchStreamingLambdaHandlerName, | ||
new CfnParameter(stack, ElasticsearchStreamingLambdaHandlerName, { | ||
OpenSearchStreamingLambdaHandlerName, | ||
new CfnParameter(stack, OpenSearchStreamingLambdaHandlerName, { | ||
description: 'The name of the lambda handler.', | ||
@@ -38,4 +38,4 @@ default: 'python_streaming_function.lambda_handler', | ||
[ | ||
ElasticsearchStreamingLambdaRuntime, | ||
new CfnParameter(stack, ElasticsearchStreamingLambdaRuntime, { | ||
OpenSearchStreamingLambdaRuntime, | ||
new CfnParameter(stack, OpenSearchStreamingLambdaRuntime, { | ||
description: `The lambda runtime \ | ||
@@ -48,4 +48,4 @@ (https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Runtime)`, | ||
[ | ||
ElasticsearchStreamingFunctionName, | ||
new CfnParameter(stack, ElasticsearchStreamingFunctionName, { | ||
OpenSearchStreamingFunctionName, | ||
new CfnParameter(stack, OpenSearchStreamingFunctionName, { | ||
description: 'The name of the streaming lambda function.', | ||
@@ -57,5 +57,5 @@ default: 'DdbToEsFn', | ||
[ | ||
ElasticsearchStreamBatchSize, | ||
new CfnParameter(stack, ElasticsearchStreamBatchSize, { | ||
description: 'The maximum number of records to stream to Elasticsearch per batch.', | ||
OpenSearchStreamBatchSize, | ||
new CfnParameter(stack, OpenSearchStreamBatchSize, { | ||
description: 'The maximum number of records to stream to OpenSearch per batch.', | ||
type: 'Number', | ||
@@ -67,4 +67,4 @@ default: 100, | ||
[ | ||
ElasticsearchStreamMaximumBatchingWindowInSeconds, | ||
new CfnParameter(stack, ElasticsearchStreamMaximumBatchingWindowInSeconds, { | ||
OpenSearchStreamMaximumBatchingWindowInSeconds, | ||
new CfnParameter(stack, OpenSearchStreamMaximumBatchingWindowInSeconds, { | ||
description: 'The maximum amount of time in seconds to wait for DynamoDB stream records before sending to streaming lambda.', | ||
@@ -77,4 +77,4 @@ type: 'Number', | ||
[ | ||
ElasticsearchAccessIAMRoleName, | ||
new CfnParameter(stack, ElasticsearchStreamingIAMRoleName, { | ||
OpenSearchAccessIAMRoleName, | ||
new CfnParameter(stack, OpenSearchStreamingIAMRoleName, { | ||
description: 'The name of the streaming lambda function IAM role.', | ||
@@ -86,5 +86,5 @@ default: 'SearchableLambdaIAMRole', | ||
[ | ||
ElasticsearchDebugStreamingLambda, | ||
new CfnParameter(stack, ElasticsearchDebugStreamingLambda, { | ||
description: 'Enable debug logs for the Dynamo -> ES streaming lambda.', | ||
OpenSearchDebugStreamingLambda, | ||
new CfnParameter(stack, OpenSearchDebugStreamingLambda, { | ||
description: 'Enable debug logs for the Dynamo -> OpenSearch streaming lambda.', | ||
default: 1, | ||
@@ -97,5 +97,5 @@ type: 'Number', | ||
[ | ||
ElasticsearchInstanceCount, | ||
new CfnParameter(stack, ElasticsearchInstanceCount, { | ||
description: 'The number of instances to launch into the Elasticsearch domain.', | ||
OpenSearchInstanceCount, | ||
new CfnParameter(stack, OpenSearchInstanceCount, { | ||
description: 'The number of instances to launch into the OpenSearch domain.', | ||
default: 1, | ||
@@ -107,5 +107,5 @@ type: 'Number', | ||
[ | ||
ElasticsearchInstanceType, | ||
new CfnParameter(stack, ElasticsearchInstanceType, { | ||
description: 'The type of instance to launch into the Elasticsearch domain.', | ||
OpenSearchInstanceType, | ||
new CfnParameter(stack, OpenSearchInstanceType, { | ||
description: 'The type of instance to launch into the OpenSearch domain.', | ||
default: 't2.small.elasticsearch', | ||
@@ -153,4 +153,4 @@ allowedValues: [ | ||
[ | ||
ElasticsearchEBSVolumeGB, | ||
new CfnParameter(stack, ElasticsearchEBSVolumeGB, { | ||
OpenSearchEBSVolumeGB, | ||
new CfnParameter(stack, OpenSearchEBSVolumeGB, { | ||
description: 'The size in GB of the EBS volumes that contain our data.', | ||
@@ -157,0 +157,0 @@ default: 10, |
@@ -19,15 +19,15 @@ import { GraphQLAPIProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
assert(region); | ||
const { ElasticsearchStreamingLambdaFunctionLogicalID } = ResourceConstants.RESOURCES; | ||
const { ElasticsearchStreamingLambdaHandlerName, ElasticsearchDebugStreamingLambda } = ResourceConstants.PARAMETERS; | ||
const { OpenSearchStreamingLambdaFunctionLogicalID } = ResourceConstants.RESOURCES; | ||
const { OpenSearchStreamingLambdaHandlerName, OpenSearchDebugStreamingLambda } = ResourceConstants.PARAMETERS; | ||
const enviroment: { [key: string]: string } = { | ||
ES_ENDPOINT: 'https://' + endpoint, | ||
ES_REGION: region, | ||
DEBUG: parameterMap.get(ElasticsearchDebugStreamingLambda)!.valueAsString, | ||
ES_USE_EXTERNAL_VERSIONING: isProjectUsingDataStore.toString(), | ||
OPENSEARCH_ENDPOINT: 'https://' + endpoint, | ||
OPENSEARCH_REGION: region, | ||
DEBUG: parameterMap.get(OpenSearchDebugStreamingLambda)!.valueAsString, | ||
OPENSEARCH_USE_EXTERNAL_VERSIONING: isProjectUsingDataStore.toString(), | ||
}; | ||
return apiGraphql.host.addLambdaFunction( | ||
ElasticsearchStreamingLambdaFunctionLogicalID, | ||
'functions/' + ElasticsearchStreamingLambdaFunctionLogicalID + '.zip', | ||
parameterMap.get(ElasticsearchStreamingLambdaHandlerName)!.valueAsString, | ||
OpenSearchStreamingLambdaFunctionLogicalID, | ||
'functions/' + OpenSearchStreamingLambdaFunctionLogicalID + '.zip', | ||
parameterMap.get(OpenSearchStreamingLambdaHandlerName)!.valueAsString, | ||
path.resolve(__dirname, '..', '..', 'lib', 'streaming-lambda.zip'), | ||
@@ -50,7 +50,7 @@ Runtime.PYTHON_3_6, | ||
export const createLambdaRole = (stack: Construct, parameterMap: Map<string, CfnParameter>): IRole => { | ||
const { ElasticsearchStreamingLambdaIAMRoleLogicalID } = ResourceConstants.RESOURCES; | ||
const { ElasticsearchStreamingIAMRoleName } = ResourceConstants.PARAMETERS; | ||
const role = new Role(stack, ElasticsearchStreamingLambdaIAMRoleLogicalID, { | ||
const { OpenSearchStreamingLambdaIAMRoleLogicalID } = ResourceConstants.RESOURCES; | ||
const { OpenSearchStreamingIAMRoleName } = ResourceConstants.PARAMETERS; | ||
const role = new Role(stack, OpenSearchStreamingLambdaIAMRoleLogicalID, { | ||
assumedBy: new ServicePrincipal('lambda.amazonaws.com'), | ||
roleName: parameterMap.get(ElasticsearchStreamingIAMRoleName)?.valueAsString, | ||
roleName: parameterMap.get(OpenSearchStreamingIAMRoleName)?.valueAsString, | ||
}); | ||
@@ -79,3 +79,3 @@ role.attachInlinePolicy( | ||
): EventSourceMapping => { | ||
const { ElasticsearchStreamBatchSize, ElasticsearchStreamMaximumBatchingWindowInSeconds } = ResourceConstants.PARAMETERS; | ||
const { OpenSearchStreamBatchSize, OpenSearchStreamMaximumBatchingWindowInSeconds } = ResourceConstants.PARAMETERS; | ||
assert(tableStreamArn); | ||
@@ -85,4 +85,4 @@ return new EventSourceMapping(stack, SearchableResourceIDs.SearchableEventSourceMappingID(type), { | ||
target, | ||
batchSize: parameterMap.get(ElasticsearchStreamBatchSize)!.valueAsNumber, | ||
maxBatchingWindow: Duration.seconds(parameterMap.get(ElasticsearchStreamMaximumBatchingWindowInSeconds)!.valueAsNumber), | ||
batchSize: parameterMap.get(OpenSearchStreamBatchSize)!.valueAsNumber, | ||
maxBatchingWindow: Duration.seconds(parameterMap.get(OpenSearchStreamMaximumBatchingWindowInSeconds)!.valueAsNumber), | ||
enabled: true, | ||
@@ -89,0 +89,0 @@ startingPosition: StartingPosition.LATEST, |
import { | ||
ElasticsearchMappingTemplate, | ||
SearchableMappingTemplate, | ||
print, | ||
@@ -67,3 +67,3 @@ str, | ||
]), | ||
ElasticsearchMappingTemplate.searchTemplate({ | ||
SearchableMappingTemplate.searchTemplate({ | ||
path: str('$indexPath'), | ||
@@ -70,0 +70,0 @@ size: ifElse(ref('context.args.limit'), ref('context.args.limit'), int(ResourceConstants.DEFAULT_SEARCHABLE_PAGE_LIMIT), true), |
@@ -43,4 +43,4 @@ import { TransformerPluginBase, InvalidDirectiveError, MappingTemplate, DirectiveWrapper } from '@aws-amplify/graphql-transformer-core'; | ||
import { setMappings } from './cdk/create-layer-cfnMapping'; | ||
import { createEsDomain, createEsDomainRole } from './cdk/create-es-domain'; | ||
import { createEsDataSource } from './cdk/create-es-datasource'; | ||
import { createSearchableDomain, createSearchableDomainRole } from './cdk/create-searchable-domain'; | ||
import { createSearchableDataSource } from './cdk/create-searchable-datasource'; | ||
import { createEventSourceMapping, createLambda, createLambdaRole } from './cdk/create-streaming-lambda'; | ||
@@ -88,13 +88,13 @@ import { createStackOutputs } from './cdk/create-cfnOutput'; | ||
const domain = createEsDomain(stack, parameterMap, context.api.apiId); | ||
const domain = createSearchableDomain(stack, parameterMap, context.api.apiId); | ||
const elasticsearchRole = createEsDomainRole(stack, parameterMap, context.api.apiId, envParam); | ||
const openSearchRole = createSearchableDomainRole(stack, parameterMap, context.api.apiId, envParam); | ||
domain.grantReadWrite(elasticsearchRole); | ||
domain.grantReadWrite(openSearchRole); | ||
const datasource = createEsDataSource( | ||
const datasource = createSearchableDataSource( | ||
stack, | ||
context.api, | ||
domain.domainEndpoint, | ||
elasticsearchRole, | ||
openSearchRole, | ||
stack.parseArn(domain.domainArn).region, | ||
@@ -101,0 +101,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
977142
+ Added@aws-amplify/graphql-transformer-core@0.8.2-ext.0(transitive)
+ Added@aws-amplify/graphql-transformer-interfaces@1.8.2-ext.0(transitive)
+ Addedgraphql-mapping-template@4.18.3-ext.0(transitive)
+ Addedgraphql-transformer-common@4.19.8-ext.0(transitive)
- Removed@aws-amplify/graphql-transformer-core@0.8.1(transitive)
- Removed@aws-amplify/graphql-transformer-interfaces@1.8.1(transitive)
- Removedgraphql-mapping-template@4.18.2(transitive)
- Removedgraphql-transformer-common@4.19.7(transitive)
Updated@aws-amplify/graphql-transformer-interfaces@1.8.2-ext.0