-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Expand file tree
/
Copy pathcreate-matching-workflow.js
More file actions
78 lines (69 loc) · 2.11 KB
/
create-matching-workflow.js
File metadata and controls
78 lines (69 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// snippet-start:[entity-resolution.JavaScriptv3.create-matching-workflow]
//The default inputs for this demo are read from the ../inputs.json.
import { fileURLToPath } from "node:url";
import {
CreateMatchingWorkflowCommand,
EntityResolutionClient,
} from "@aws-sdk/client-entityresolution";
import data from "../inputs.json" with { type: "json" };
const region = "eu-west-1";
const erClient = new EntityResolutionClient({ region: region });
export const main = async () => {
const createMatchingWorkflowParams = {
roleArn: `${data.inputs.roleArn}`,
workflowName: `${data.inputs.workflowName}`,
description: "Created by using the AWS SDK for JavaScript (v3).",
inputSourceConfig: [
{
inputSourceARN: `${data.inputs.JSONinputSourceARN}`,
schemaName: `${data.inputs.schemaNameJson}`,
applyNormalization: false,
},
{
inputSourceARN: `${data.inputs.CSVinputSourceARN}`,
schemaName: `${data.inputs.schemaNameCSV}`,
applyNormalization: false,
},
],
outputSourceConfig: [
{
outputS3Path: `s3://${data.inputs.myBucketName}/eroutput`,
output: [
{
name: "id",
},
{
name: "name",
},
{
name: "email",
},
{
name: "phone",
},
],
applyNormalization: false,
},
],
resolutionTechniques: { resolutionType: "ML_MATCHING" },
};
try {
const command = new CreateMatchingWorkflowCommand(
createMatchingWorkflowParams,
);
const response = await erClient.send(command);
console.log(
`Workflow created successfully.\n The workflow ARN is: ${response.workflowArn}`,
);
} catch (caught) {
console.error(caught.message);
throw caught;
}
};
// snippet-end:[entity-resolution.JavaScriptv3.create-matching-workflow]
// Invoke main function if this file was run directly.
if (process.argv[1] === fileURLToPath(import.meta.url)) {
main();
}