// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { fileURLToPath } from "node:url"; // snippet-start:[iam.JavaScript.users.deleteUserV3] import { DeleteUserCommand, IAMClient } from "@aws-sdk/client-iam"; const client = new IAMClient({}); /** * * @param {string} name */ export const deleteUser = (name) => { const command = new DeleteUserCommand({ UserName: name }); return client.send(command); }; // snippet-end:[iam.JavaScript.users.deleteUserV3] // Invoke main function if this file was run directly. if (process.argv[1] === fileURLToPath(import.meta.url)) { deleteUser("USER_NAME"); }