Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

feat: add config options to DdbToEsSync #108

Merged
merged 4 commits into from
Aug 30, 2021
Merged

feat: add config options to DdbToEsSync #108

merged 4 commits into from
Aug 30, 2021

Conversation

carvantes
Copy link
Contributor

@carvantes carvantes commented Aug 27, 2021

Closes: #96

Functionality for the default deployment remains unchanged

new optional config params:

  • esClient: overriding the ES client. Probably easier than having to depend on several env variables
  • disableIndexAndAliasCreation: disables index/alias creation.
  • getAliasFn: using custom alias/index names

An example using all the optional config values would be:

const ddbToEsSync = new DdbToEsSync({
        esClient: new Client({
            node: 'https://my-search-cluster.us-west-2.es.amazonaws.com',
            Connection: AmazonConnection,
            Transport: AmazonTransport,
        }),
        getAliasFn: (x: any) => ({
            alias: `${x.resourceType.toLowerCase()}-my-test-alias`,
            index: `${x.resourceType.toLowerCase()}-my-test-index`,
        }),
        disableIndexAndAliasCreation: true,
    });

Going forward, We suggest customers to not depend on handleDdbToEsEvent but rather on the new DdbToEsSync class. The original handleDdbToEsEvent was not really meant to be used other than as a lambda handler and is cumbersome to add config options to it without making breaking changes.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

config options allow:
- overriding the ES client,
- disabling index/alias creation
- using custom alias/index names
@carvantes carvantes marked this pull request as ready for review August 27, 2021 15:29
src/index.ts Outdated Show resolved Hide resolved
src/ddbToEs/index.ts Show resolved Hide resolved
src/ddbToEs/DdbToEsSync.ts Outdated Show resolved Hide resolved
src/ddbToEs/DdbToEsSync.test.ts Outdated Show resolved Hide resolved
src/ddbToEs/ddbToEsHelper.ts Show resolved Hide resolved
src/ddbToEs/DdbToEsSync.test.ts Outdated Show resolved Hide resolved
@carvantes carvantes requested a review from rsmayda August 27, 2021 16:21
@carvantes carvantes changed the title feat: add several config options to DdbToEsSync feat: add config options to DdbToEsSync Aug 30, 2021
@carvantes carvantes merged commit f9c9414 into mainline Aug 30, 2021
@carvantes carvantes deleted the dev-ddbtoes branch August 30, 2021 20:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Need ability to specify index/alias name in handleDdbToEsEvent
2 participants