File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,23 @@ Let’s walk through setting up a project that depends on DynamoDB from the SDK
20
20
2. Inside of the project, run: ` npm install --save @aws-sdk/client-dynamodb-v2-node@preview `
21
21
3. Create a new file called index.js, create a DynamoDB service client and send a request.
22
22
``` javascript
23
- const {DynamoDB } = require (' @aws-sdk/client-dynamodb-v2-node' );
23
+ const {DynamoDBClient } = require (' @aws-sdk/client-dynamodb-node/DynamoDBClient' );
24
+ const {ListTablesCommand } = require (' @aws-sdk/client-dynamodb-node/commands/ListTablesCommand' );
25
+ async function example () {
26
+ const client = new DynamoDBClient ({region: ' us-west-2' });
27
+ const command = new ListTablesCommand ({});
28
+ try {
29
+ const results = await client .send (command);
30
+ console .log (results .TableNames .join (' \n ' ));
31
+ } catch (err) {
32
+ console .error (err);
33
+ }
34
+ }
35
+ example ();
36
+ ```
37
+ For users want to use V2-like interfaces, you can import client with only the service name(e.g DynamoDB), and call the operation name directly from the client:
38
+ ``` javascript
39
+ const {DynamoDB } = require (' @aws-sdk/client-dynamodb-node' );
24
40
async function example () {
25
41
const client = new DynamoDB ({region: ' us-west-2' });
26
42
try {
@@ -32,6 +48,7 @@ async function example() {
32
48
}
33
49
example ();
34
50
```
51
+ Note that this client is subject to change. It might be removed with SDK V3 comes closer to production-ready.
35
52
36
53
## New features
37
54
### Modularized packages
You can’t perform that action at this time.
0 commit comments