add assume role .ts

This commit is contained in:
2026-03-15 00:03:34 +08:00
parent da5a7bb032
commit 2485733243
2 changed files with 34 additions and 0 deletions

25
single-scripts/assume-role.ts Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env -S deno run -A
import {args, assumeRoleByKey, exit,} from "https://script.hatter.ink/@60/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args";
const flags = parseArgs(args(), {
boolean: ["help"],
string: ["role-arn"],
});
if (flags.help) {
console.log(
"assume-role.ts --role-arn ROLE_ARN",
);
exit(0);
}
const roleArn = flags["role-arn"];
if (!roleArn) {
console.error("--role-arn is required");
exit(1);
}
console.log(await assumeRoleByKey(roleArn));