/
ses_listidentities.js
34 lines (27 loc) · 1.18 KB
/
ses_listidentities.js
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
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/*
ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3),
which is available at https://github.com/aws/aws-sdk-js-v3. This example is in the 'AWS SDK for JavaScript v3 Developer Guide' at
https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/ses-examples-managing-identities.html.
Purpose:
ses_listidentities.js demonstrates how to list all the identities for an AWS account.
Running the code:
node ses_listidentities.js
*/
// snippet-start:[ses.JavaScript.identities.listIdentitiesV3]
import { ListIdentitiesCommand } from "@aws-sdk/client-ses";
import { sesClient } from "./libs/sesClient.js";
const createListIdentitiesCommand = () =>
new ListIdentitiesCommand({ IdentityType: "EmailAddress", MaxItems: 10 });
const run = async () => {
const listIdentitiesCommand = createListIdentitiesCommand();
try {
return await sesClient.send(listIdentitiesCommand);
} catch (err) {
console.log("Failed to list identities.", err);
return err;
}
};
// snippet-end:[ses.JavaScript.identities.listIdentitiesV3]
export { run };