({ documentName })
| 10 | * @param {{ documentName: string }} |
| 11 | */ |
| 12 | export const main = async ({ documentName }) => { |
| 13 | const client = new SSMClient({}); |
| 14 | try { |
| 15 | await client.send( |
| 16 | new SendCommandCommand({ |
| 17 | DocumentName: documentName, |
| 18 | }), |
| 19 | ); |
| 20 | console.log("Command sent successfully."); |
| 21 | return { Success: true }; |
| 22 | } catch (caught) { |
| 23 | if (caught instanceof Error && caught.name === "ValidationError") { |
| 24 | console.warn(`${caught.message}. Did you provide a valid document name?`); |
| 25 | } else { |
| 26 | throw caught; |
| 27 | } |
| 28 | } |
| 29 | }; |
| 30 | // snippet-end:[ssm.JavaScript.Basics.sendCommand] |
| 31 | import { fileURLToPath } from "node:url"; |
| 32 | // Call function if run directly |
no test coverage detected