@mtndev/cli 0.0.0-dev-20260626045346 → 0.0.0-dev-20260914234436
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +86 -1
- package/cjs/__chunks/2FSYDFUV.cjs +146 -0
- package/cjs/__chunks/3A5ZYU5M.cjs +105 -0
- package/cjs/__chunks/3NOHGUCF.cjs +9 -0
- package/cjs/__chunks/3T2LXW7J.cjs +387 -0
- package/cjs/__chunks/4XT5JEAS.cjs +1 -0
- package/cjs/__chunks/AZEB4H4I.cjs +208 -0
- package/cjs/__chunks/B5ENMOCD.cjs +288 -0
- package/cjs/__chunks/B6XM5KSF.cjs +338 -0
- package/cjs/__chunks/BDU2UCE5.cjs +1 -0
- package/cjs/__chunks/BLMSMR5E.cjs +46 -0
- package/cjs/__chunks/CMUD7LLN.cjs +47 -0
- package/cjs/__chunks/DTQ2LB3I.cjs +49 -0
- package/cjs/__chunks/FM5MVRQF.cjs +23 -0
- package/cjs/__chunks/FRHST54J.cjs +135 -0
- package/cjs/__chunks/FU4VP2LN.cjs +1 -0
- package/cjs/__chunks/G5K4PVIL.cjs +26 -0
- package/cjs/__chunks/{NSRFG4DF.cjs → GU3R54MK.cjs} +45 -18
- package/cjs/__chunks/GUL36IFZ.cjs +61 -0
- package/cjs/__chunks/GZMTNK5N.cjs +1 -0
- package/cjs/__chunks/H74JSDBU.cjs +30 -0
- package/cjs/__chunks/{EMMC33QA.cjs → JB7T7PKQ.cjs} +170 -33
- package/cjs/__chunks/JSL2JDMW.cjs +1 -0
- package/cjs/__chunks/K4QNHRTP.cjs +163 -0
- package/cjs/__chunks/KU76LC42.cjs +192 -0
- package/cjs/__chunks/LFDSHANP.cjs +34 -0
- package/cjs/__chunks/LHE24ECK.cjs +192 -0
- package/cjs/__chunks/LIKQ3SI4.cjs +1 -0
- package/cjs/__chunks/LXDF5QVZ.cjs +313 -0
- package/cjs/__chunks/LXOOJR2R.cjs +74 -0
- package/cjs/__chunks/N5MXFOQZ.cjs +167 -0
- package/cjs/__chunks/N7D56LPP.cjs +25 -0
- package/cjs/__chunks/NFXQNOQH.cjs +393 -0
- package/cjs/__chunks/NLKJIUEX.cjs +126 -0
- package/cjs/__chunks/NT2XXAI6.cjs +89 -0
- package/cjs/__chunks/NWZGFHKH.cjs +121 -0
- package/cjs/__chunks/R3GUC7O7.cjs +110 -0
- package/cjs/__chunks/RPVAXPJ4.cjs +1 -0
- package/cjs/__chunks/S3LVCWPN.cjs +23 -0
- package/cjs/__chunks/SBBNW2BF.cjs +249 -0
- package/cjs/__chunks/T2A7TN4F.cjs +81 -0
- package/cjs/__chunks/TKNNDDIB.cjs +97 -0
- package/cjs/__chunks/TNSRDJPR.cjs +1 -0
- package/cjs/__chunks/UWHPE2GI.cjs +20 -0
- package/cjs/__chunks/W6K7BV74.cjs +1 -0
- package/cjs/__chunks/WBOQ6AUN.cjs +320 -0
- package/cjs/__chunks/WHGN5PZI.cjs +299 -0
- package/cjs/__chunks/WOYF2L6T.cjs +11 -0
- package/cjs/__chunks/X26XY2N6.cjs +18 -0
- package/cjs/__chunks/XMKOKRXZ.cjs +16 -0
- package/cjs/__chunks/XTJPQ3EX.cjs +1 -0
- package/cjs/__chunks/YRHFKTW2.cjs +63 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.cjs +12 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
- package/cjs/commands/aws/ec2/allow-ip/index.cjs +55 -0
- package/cjs/commands/aws/ec2/allow-ip/index.d.ts +3 -0
- package/cjs/commands/aws/ec2/allow-ip/schema.cjs +13 -0
- package/cjs/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
- package/cjs/commands/aws/ec2/allow-ip/utils.cjs +39 -0
- package/cjs/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
- package/cjs/commands/aws/iam/admin-group.cjs +15 -0
- package/cjs/commands/aws/iam/admin-group.d.ts +55 -0
- package/cjs/commands/aws/iam/break-glass/handler.cjs +12 -0
- package/cjs/commands/aws/iam/break-glass/handler.d.ts +7 -0
- package/cjs/commands/aws/iam/break-glass/index.cjs +19 -0
- package/cjs/commands/aws/iam/break-glass/index.d.ts +2 -0
- package/cjs/commands/aws/iam/break-glass/schema.cjs +12 -0
- package/cjs/commands/aws/iam/break-glass/schema.d.ts +25 -0
- package/cjs/commands/aws/iam/check-admin/handler.cjs +10 -0
- package/cjs/commands/aws/iam/check-admin/handler.d.ts +5 -0
- package/cjs/commands/aws/iam/check-admin/index.cjs +17 -0
- package/cjs/commands/aws/iam/check-admin/index.d.ts +2 -0
- package/cjs/commands/aws/iam/check-admin/schema.cjs +12 -0
- package/cjs/commands/aws/iam/check-admin/schema.d.ts +19 -0
- package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.cjs +28 -0
- package/cjs/commands/aws/iam/policies/sts-federation.cjs +19 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-list.cjs +183 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.cjs +49 -0
- package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.cjs +64 -0
- package/cjs/commands/aws/iam/policies/user-admins-write-list.cjs +125 -0
- package/cjs/commands/aws/iam/remove-admin/handler.cjs +11 -0
- package/cjs/commands/aws/iam/remove-admin/handler.d.ts +6 -0
- package/cjs/commands/aws/iam/remove-admin/index.cjs +18 -0
- package/cjs/commands/aws/iam/remove-admin/index.d.ts +2 -0
- package/cjs/commands/aws/iam/remove-admin/schema.cjs +12 -0
- package/cjs/commands/aws/iam/remove-admin/schema.d.ts +28 -0
- package/cjs/commands/aws/iam/setup-acl/handler.cjs +14 -0
- package/cjs/commands/aws/iam/setup-acl/handler.d.ts +6 -0
- package/cjs/commands/aws/iam/setup-acl/index.cjs +33 -0
- package/cjs/commands/aws/iam/setup-acl/index.d.ts +3 -0
- package/cjs/commands/aws/iam/setup-acl/schema.cjs +7 -0
- package/cjs/commands/aws/iam/setup-acl/schema.d.ts +24 -0
- package/cjs/commands/aws/iam/setup-acl/utils.cjs +20 -0
- package/cjs/commands/aws/iam/setup-acl/utils.d.ts +61 -0
- package/cjs/commands/aws/iam/users/handler.cjs +12 -0
- package/cjs/commands/aws/iam/users/handler.d.ts +5 -0
- package/cjs/commands/aws/iam/users/index.cjs +41 -0
- package/cjs/commands/aws/iam/users/index.d.ts +3 -0
- package/cjs/commands/aws/iam/users/schema.cjs +7 -0
- package/cjs/commands/aws/iam/users/schema.d.ts +18 -0
- package/cjs/commands/aws/iam/users/utils.cjs +30 -0
- package/cjs/commands/aws/iam/users/utils.d.ts +119 -0
- package/cjs/commands/aws/index.cjs +229 -0
- package/cjs/commands/aws/index.d.ts +14 -0
- package/cjs/commands/aws/route53/add-record/handler.cjs +18 -0
- package/cjs/commands/aws/route53/add-record/handler.d.ts +36 -0
- package/cjs/commands/aws/route53/add-record/index.cjs +57 -0
- package/cjs/commands/aws/route53/add-record/index.d.ts +3 -0
- package/cjs/commands/aws/route53/add-record/schema.cjs +11 -0
- package/cjs/commands/aws/route53/add-record/schema.d.ts +45 -0
- package/cjs/commands/aws/route53/add-record/utils.cjs +37 -0
- package/cjs/commands/aws/route53/add-record/utils.d.ts +216 -0
- package/cjs/commands/aws/route53/remove-record/handler.cjs +14 -0
- package/cjs/commands/aws/route53/remove-record/handler.d.ts +6 -0
- package/cjs/commands/aws/route53/remove-record/index.cjs +18 -0
- package/cjs/commands/aws/route53/remove-record/index.d.ts +2 -0
- package/cjs/commands/aws/route53/remove-record/schema.cjs +8 -0
- package/cjs/commands/aws/route53/remove-record/schema.d.ts +30 -0
- package/cjs/commands/aws/schema.cjs +10 -0
- package/cjs/commands/aws/schema.d.ts +13 -0
- package/cjs/commands/aws/ses/send-email/handler.cjs +12 -0
- package/cjs/commands/aws/ses/send-email/handler.d.ts +5 -0
- package/cjs/commands/aws/ses/send-email/index.cjs +23 -0
- package/cjs/commands/aws/ses/send-email/index.d.ts +3 -0
- package/cjs/commands/aws/ses/send-email/schema.cjs +7 -0
- package/cjs/commands/aws/ses/send-email/schema.d.ts +39 -0
- package/cjs/commands/aws/ses/send-email/utils.cjs +11 -0
- package/cjs/commands/aws/ses/send-email/utils.d.ts +47 -0
- package/cjs/commands/aws/ses/smtp-password.cjs +10 -0
- package/cjs/commands/aws/ses/smtp-password.d.ts +21 -0
- package/cjs/commands/aws/utils/exec-aws.cjs +16 -0
- package/cjs/commands/aws/utils/exec-aws.d.ts +79 -0
- package/cjs/commands/aws/utils/resolve-policy-path.cjs +6 -0
- package/cjs/commands/aws/utils/resolve-policy-path.d.ts +8 -0
- package/cjs/commands/aws/utils/resolve-profile.cjs +11 -0
- package/cjs/commands/aws/utils/resolve-profile.d.ts +28 -0
- package/cjs/commands/aws/utils/tty.cjs +10 -0
- package/cjs/commands/aws/utils/tty.d.ts +24 -0
- package/cjs/commands/db/create-readonly-user/handler.cjs +11 -0
- package/cjs/commands/db/create-readonly-user/handler.d.ts +5 -0
- package/cjs/commands/db/create-readonly-user/index.cjs +40 -0
- package/cjs/commands/db/create-readonly-user/index.d.ts +3 -0
- package/cjs/commands/db/create-readonly-user/mysql.cjs +9 -0
- package/cjs/commands/db/create-readonly-user/mysql.d.ts +33 -0
- package/cjs/commands/db/create-readonly-user/postgres.cjs +9 -0
- package/cjs/commands/db/create-readonly-user/postgres.d.ts +31 -0
- package/cjs/commands/db/create-readonly-user/schema.cjs +12 -0
- package/cjs/commands/db/create-readonly-user/schema.d.ts +55 -0
- package/cjs/commands/db/create-readonly-user/utils.cjs +22 -0
- package/cjs/commands/db/create-readonly-user/utils.d.ts +112 -0
- package/cjs/commands/db/index.cjs +44 -0
- package/cjs/commands/db/index.d.ts +6 -0
- package/cjs/commands/doppler/handler.cjs +6 -4
- package/cjs/commands/doppler/index.cjs +32 -5
- package/cjs/commands/doppler/index.d.ts +1 -0
- package/cjs/commands/doppler/schema.cjs +10 -2
- package/cjs/commands/doppler/schema.d.ts +233 -17
- package/cjs/commands/doppler/set-secret.cjs +19 -0
- package/cjs/commands/doppler/set-secret.d.ts +113 -0
- package/cjs/commands/doppler/utils.cjs +6 -2
- package/cjs/commands/doppler/utils.d.ts +32 -8
- package/cjs/commands/icons/schema.d.ts +1 -1
- package/cjs/commands/index.cjs +91 -12
- package/esm/__chunks/2FTTEFEK.js +97 -0
- package/esm/__chunks/33UYMUQD.js +338 -0
- package/esm/__chunks/3BKWTHLJ.js +25 -0
- package/esm/__chunks/3HE4BEJX.js +105 -0
- package/esm/__chunks/3QLI5BDL.js +387 -0
- package/esm/__chunks/5GIUAFXL.js +89 -0
- package/esm/__chunks/73BJG53F.js +11 -0
- package/esm/__chunks/7VF4Q43Q.js +0 -0
- package/esm/__chunks/AEDEAYF5.js +0 -0
- package/esm/__chunks/AZCP3SFJ.js +0 -0
- package/esm/__chunks/B2DVQ2UL.js +61 -0
- package/esm/__chunks/CVQVHLW5.js +0 -0
- package/esm/__chunks/D62SPZXC.js +0 -0
- package/esm/__chunks/DLEJ25GZ.js +121 -0
- package/esm/__chunks/DMYFNF54.js +192 -0
- package/esm/__chunks/DNFTUMGD.js +23 -0
- package/esm/__chunks/DVKD6YSR.js +49 -0
- package/esm/__chunks/EMSH4P76.js +20 -0
- package/esm/__chunks/FFKFVMIE.js +167 -0
- package/esm/__chunks/FNXUONAV.js +110 -0
- package/esm/__chunks/G4NJHFFU.js +320 -0
- package/esm/__chunks/IEOGAQYI.js +46 -0
- package/esm/__chunks/IZFGBYGE.js +34 -0
- package/esm/__chunks/J34UVKLA.js +26 -0
- package/esm/__chunks/JZPBBBIG.js +74 -0
- package/esm/__chunks/KWUJP5MG.js +135 -0
- package/esm/__chunks/M35URMT4.js +313 -0
- package/esm/__chunks/NF3M2L6C.js +81 -0
- package/esm/__chunks/PNPPDYKC.js +299 -0
- package/esm/__chunks/QFXN4EHM.js +393 -0
- package/esm/__chunks/QKDDLIWD.js +146 -0
- package/esm/__chunks/QSE66AKY.js +208 -0
- package/esm/__chunks/QUF7PS4R.js +18 -0
- package/esm/__chunks/S7IJPJ4R.js +126 -0
- package/esm/__chunks/SD3E3EPH.js +163 -0
- package/esm/__chunks/T3TTUHTW.js +30 -0
- package/esm/__chunks/TIOVE6HR.js +0 -0
- package/esm/__chunks/TXKMEIDQ.js +0 -0
- package/esm/__chunks/U7HAE2RF.js +288 -0
- package/esm/__chunks/UXWY7BYE.js +63 -0
- package/esm/__chunks/VKAKISRG.js +192 -0
- package/esm/__chunks/WD2YR6I7.js +0 -0
- package/esm/__chunks/WOZFZKFY.js +0 -0
- package/esm/__chunks/XI7GZDE2.js +0 -0
- package/esm/__chunks/XOUWDB3T.js +249 -0
- package/esm/__chunks/XQN2TA4S.js +23 -0
- package/esm/__chunks/XXK32TIM.js +16 -0
- package/esm/__chunks/{O262GK4B.js → YGWTVPZE.js} +164 -27
- package/esm/__chunks/{6L5RNR7G.js → YRG7PT33.js} +44 -17
- package/esm/__chunks/ZHKVJO2U.js +47 -0
- package/esm/__chunks/ZO55YUSY.js +9 -0
- package/esm/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
- package/esm/commands/aws/ec2/allow-ip/handler.js +12 -0
- package/esm/commands/aws/ec2/allow-ip/index.d.ts +3 -0
- package/esm/commands/aws/ec2/allow-ip/index.js +55 -0
- package/esm/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
- package/esm/commands/aws/ec2/allow-ip/schema.js +13 -0
- package/esm/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
- package/esm/commands/aws/ec2/allow-ip/utils.js +39 -0
- package/esm/commands/aws/iam/admin-group.d.ts +55 -0
- package/esm/commands/aws/iam/admin-group.js +15 -0
- package/esm/commands/aws/iam/break-glass/handler.d.ts +7 -0
- package/esm/commands/aws/iam/break-glass/handler.js +12 -0
- package/esm/commands/aws/iam/break-glass/index.d.ts +2 -0
- package/esm/commands/aws/iam/break-glass/index.js +19 -0
- package/esm/commands/aws/iam/break-glass/schema.d.ts +25 -0
- package/esm/commands/aws/iam/break-glass/schema.js +12 -0
- package/esm/commands/aws/iam/check-admin/handler.d.ts +5 -0
- package/esm/commands/aws/iam/check-admin/handler.js +10 -0
- package/esm/commands/aws/iam/check-admin/index.d.ts +2 -0
- package/esm/commands/aws/iam/check-admin/index.js +17 -0
- package/esm/commands/aws/iam/check-admin/schema.d.ts +19 -0
- package/esm/commands/aws/iam/check-admin/schema.js +12 -0
- package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.js +28 -0
- package/esm/commands/aws/iam/policies/sts-federation.js +19 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-list.js +183 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.js +49 -0
- package/esm/commands/aws/iam/policies/user-admins-self-service-iam.js +64 -0
- package/esm/commands/aws/iam/policies/user-admins-write-list.js +125 -0
- package/esm/commands/aws/iam/remove-admin/handler.d.ts +6 -0
- package/esm/commands/aws/iam/remove-admin/handler.js +11 -0
- package/esm/commands/aws/iam/remove-admin/index.d.ts +2 -0
- package/esm/commands/aws/iam/remove-admin/index.js +18 -0
- package/esm/commands/aws/iam/remove-admin/schema.d.ts +28 -0
- package/esm/commands/aws/iam/remove-admin/schema.js +12 -0
- package/esm/commands/aws/iam/setup-acl/handler.d.ts +6 -0
- package/esm/commands/aws/iam/setup-acl/handler.js +14 -0
- package/esm/commands/aws/iam/setup-acl/index.d.ts +3 -0
- package/esm/commands/aws/iam/setup-acl/index.js +33 -0
- package/esm/commands/aws/iam/setup-acl/schema.d.ts +24 -0
- package/esm/commands/aws/iam/setup-acl/schema.js +7 -0
- package/esm/commands/aws/iam/setup-acl/utils.d.ts +61 -0
- package/esm/commands/aws/iam/setup-acl/utils.js +20 -0
- package/esm/commands/aws/iam/users/handler.d.ts +5 -0
- package/esm/commands/aws/iam/users/handler.js +12 -0
- package/esm/commands/aws/iam/users/index.d.ts +3 -0
- package/esm/commands/aws/iam/users/index.js +41 -0
- package/esm/commands/aws/iam/users/schema.d.ts +18 -0
- package/esm/commands/aws/iam/users/schema.js +7 -0
- package/esm/commands/aws/iam/users/utils.d.ts +119 -0
- package/esm/commands/aws/iam/users/utils.js +30 -0
- package/esm/commands/aws/index.d.ts +14 -0
- package/esm/commands/aws/index.js +229 -0
- package/esm/commands/aws/route53/add-record/handler.d.ts +36 -0
- package/esm/commands/aws/route53/add-record/handler.js +18 -0
- package/esm/commands/aws/route53/add-record/index.d.ts +3 -0
- package/esm/commands/aws/route53/add-record/index.js +57 -0
- package/esm/commands/aws/route53/add-record/schema.d.ts +45 -0
- package/esm/commands/aws/route53/add-record/schema.js +11 -0
- package/esm/commands/aws/route53/add-record/utils.d.ts +216 -0
- package/esm/commands/aws/route53/add-record/utils.js +37 -0
- package/esm/commands/aws/route53/remove-record/handler.d.ts +6 -0
- package/esm/commands/aws/route53/remove-record/handler.js +14 -0
- package/esm/commands/aws/route53/remove-record/index.d.ts +2 -0
- package/esm/commands/aws/route53/remove-record/index.js +18 -0
- package/esm/commands/aws/route53/remove-record/schema.d.ts +30 -0
- package/esm/commands/aws/route53/remove-record/schema.js +8 -0
- package/esm/commands/aws/schema.d.ts +13 -0
- package/esm/commands/aws/schema.js +10 -0
- package/esm/commands/aws/ses/send-email/handler.d.ts +5 -0
- package/esm/commands/aws/ses/send-email/handler.js +12 -0
- package/esm/commands/aws/ses/send-email/index.d.ts +3 -0
- package/esm/commands/aws/ses/send-email/index.js +23 -0
- package/esm/commands/aws/ses/send-email/schema.d.ts +39 -0
- package/esm/commands/aws/ses/send-email/schema.js +7 -0
- package/esm/commands/aws/ses/send-email/utils.d.ts +47 -0
- package/esm/commands/aws/ses/send-email/utils.js +11 -0
- package/esm/commands/aws/ses/smtp-password.d.ts +21 -0
- package/esm/commands/aws/ses/smtp-password.js +10 -0
- package/esm/commands/aws/utils/exec-aws.d.ts +79 -0
- package/esm/commands/aws/utils/exec-aws.js +16 -0
- package/esm/commands/aws/utils/resolve-policy-path.d.ts +8 -0
- package/esm/commands/aws/utils/resolve-policy-path.js +6 -0
- package/esm/commands/aws/utils/resolve-profile.d.ts +28 -0
- package/esm/commands/aws/utils/resolve-profile.js +11 -0
- package/esm/commands/aws/utils/tty.d.ts +24 -0
- package/esm/commands/aws/utils/tty.js +10 -0
- package/esm/commands/db/create-readonly-user/handler.d.ts +5 -0
- package/esm/commands/db/create-readonly-user/handler.js +11 -0
- package/esm/commands/db/create-readonly-user/index.d.ts +3 -0
- package/esm/commands/db/create-readonly-user/index.js +40 -0
- package/esm/commands/db/create-readonly-user/mysql.d.ts +33 -0
- package/esm/commands/db/create-readonly-user/mysql.js +9 -0
- package/esm/commands/db/create-readonly-user/postgres.d.ts +31 -0
- package/esm/commands/db/create-readonly-user/postgres.js +9 -0
- package/esm/commands/db/create-readonly-user/schema.d.ts +55 -0
- package/esm/commands/db/create-readonly-user/schema.js +12 -0
- package/esm/commands/db/create-readonly-user/utils.d.ts +112 -0
- package/esm/commands/db/create-readonly-user/utils.js +22 -0
- package/esm/commands/db/index.d.ts +6 -0
- package/esm/commands/db/index.js +44 -0
- package/esm/commands/doppler/handler.js +5 -3
- package/esm/commands/doppler/index.d.ts +1 -0
- package/esm/commands/doppler/index.js +32 -5
- package/esm/commands/doppler/schema.d.ts +233 -17
- package/esm/commands/doppler/schema.js +11 -3
- package/esm/commands/doppler/set-secret.d.ts +113 -0
- package/esm/commands/doppler/set-secret.js +19 -0
- package/esm/commands/doppler/utils.d.ts +32 -8
- package/esm/commands/doppler/utils.js +5 -1
- package/esm/commands/icons/schema.d.ts +1 -1
- package/esm/commands/index.js +86 -7
- package/package.json +12 -2
- package/vitest.config.ts +11 -0
- package/cjs/__chunks/4GFJUCSP.cjs +0 -52
- package/esm/__chunks/X3R5PSWH.js +0 -52
- /package/cjs/__chunks/{WNJ3ZYLI.cjs → 3BY5Y4W7.cjs} +0 -0
- /package/esm/__chunks/{46HGXFME.js → 5ZBVGSOK.js} +0 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ACL_GROUPS,
|
|
3
|
+
CUSTOM_POLICIES,
|
|
4
|
+
attach,
|
|
5
|
+
detach,
|
|
6
|
+
ensureGroup,
|
|
7
|
+
printFinalState,
|
|
8
|
+
publishPolicy
|
|
9
|
+
} from "./XOUWDB3T.js";
|
|
10
|
+
import {
|
|
11
|
+
createUsersInteractive
|
|
12
|
+
} from "./3QLI5BDL.js";
|
|
13
|
+
import {
|
|
14
|
+
setupAclOptionsSchema
|
|
15
|
+
} from "./XQN2TA4S.js";
|
|
16
|
+
import {
|
|
17
|
+
getCallerIdentity,
|
|
18
|
+
requireCommands
|
|
19
|
+
} from "./FNXUONAV.js";
|
|
20
|
+
import {
|
|
21
|
+
resolveProfile
|
|
22
|
+
} from "./5GIUAFXL.js";
|
|
23
|
+
import {
|
|
24
|
+
promptYesNo
|
|
25
|
+
} from "./ZHKVJO2U.js";
|
|
26
|
+
|
|
27
|
+
// src/commands/aws/iam/setup-acl/handler.js
|
|
28
|
+
import chalk from "chalk";
|
|
29
|
+
import { ZodError } from "zod";
|
|
30
|
+
async function resolveRestrictRegions(params) {
|
|
31
|
+
const { restrictRegions } = params;
|
|
32
|
+
if (restrictRegions) {
|
|
33
|
+
console.log(`Region restriction: ${restrictRegions}`);
|
|
34
|
+
return restrictRegions === "yes";
|
|
35
|
+
}
|
|
36
|
+
console.log("Region restriction");
|
|
37
|
+
console.log(
|
|
38
|
+
" The policy UserAdminsDenyRegionsList limits acl-power-users to a hard-coded"
|
|
39
|
+
);
|
|
40
|
+
console.log(
|
|
41
|
+
" region allowlist. Most accounts should leave this OFF unless you have a strong reason."
|
|
42
|
+
);
|
|
43
|
+
const restrict = await promptYesNo({
|
|
44
|
+
message: " Attach region restriction to acl-power-users?",
|
|
45
|
+
defaultYes: false
|
|
46
|
+
});
|
|
47
|
+
console.log(` \u2192 ${restrict ? "yes" : "no"}`);
|
|
48
|
+
console.log("");
|
|
49
|
+
return restrict;
|
|
50
|
+
}
|
|
51
|
+
async function setupAclCommand(options) {
|
|
52
|
+
try {
|
|
53
|
+
const {
|
|
54
|
+
restrictRegions,
|
|
55
|
+
createUsers,
|
|
56
|
+
profile: profileOption,
|
|
57
|
+
region,
|
|
58
|
+
verbose
|
|
59
|
+
} = setupAclOptionsSchema.parse(options);
|
|
60
|
+
requireCommands(["aws"]);
|
|
61
|
+
const profile = await resolveProfile({ profile: profileOption });
|
|
62
|
+
const identity = getCallerIdentity({ profile, region, verbose });
|
|
63
|
+
const accountId = identity.Account;
|
|
64
|
+
console.log("Caller:");
|
|
65
|
+
console.log(` Account: ${accountId}`);
|
|
66
|
+
console.log(` Arn: ${identity.Arn}`);
|
|
67
|
+
console.log("");
|
|
68
|
+
const restrict = await resolveRestrictRegions({ restrictRegions });
|
|
69
|
+
console.log("1. Ensure groups exist...");
|
|
70
|
+
for (const group of ACL_GROUPS) {
|
|
71
|
+
ensureGroup({ name: group, profile, verbose });
|
|
72
|
+
}
|
|
73
|
+
console.log("");
|
|
74
|
+
console.log("2. Publish custom policies...");
|
|
75
|
+
for (const policy of CUSTOM_POLICIES) {
|
|
76
|
+
publishPolicy({
|
|
77
|
+
name: policy.name,
|
|
78
|
+
fileName: policy.fileName,
|
|
79
|
+
accountId,
|
|
80
|
+
profile,
|
|
81
|
+
verbose
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
console.log("");
|
|
85
|
+
const ADMIN = "arn:aws:iam::aws:policy/AdministratorAccess";
|
|
86
|
+
const IAM_FULL = "arn:aws:iam::aws:policy/IAMFullAccess";
|
|
87
|
+
const READ_ONLY = "arn:aws:iam::aws:policy/ReadOnlyAccess";
|
|
88
|
+
const WRITE_LIST = `arn:aws:iam::${accountId}:policy/UserAdminsWriteList`;
|
|
89
|
+
const DENY_LIST = `arn:aws:iam::${accountId}:policy/UserAdminsDenyList`;
|
|
90
|
+
const SELF_SERVICE = `arn:aws:iam::${accountId}:policy/UserAdminsSelfServiceIAM`;
|
|
91
|
+
const DENY_REGIONS = `arn:aws:iam::${accountId}:policy/UserAdminsDenyRegionsList`;
|
|
92
|
+
const STS_FEDERATION = `arn:aws:iam::${accountId}:policy/sts-federation`;
|
|
93
|
+
const S3_RESTRICTIONS = `arn:aws:iam::${accountId}:policy/S3RestrictionsDenyNonS3Services`;
|
|
94
|
+
console.log("3. Attach policies to groups...");
|
|
95
|
+
attach({ group: "acl-admin-do-not-use", arn: ADMIN, profile, verbose });
|
|
96
|
+
attach({ group: "acl-iam-full-access", arn: IAM_FULL, profile, verbose });
|
|
97
|
+
attach({ group: "acl-iam-full-access", arn: READ_ONLY, profile, verbose });
|
|
98
|
+
attach({
|
|
99
|
+
group: "acl-iam-full-access",
|
|
100
|
+
arn: SELF_SERVICE,
|
|
101
|
+
profile,
|
|
102
|
+
verbose
|
|
103
|
+
});
|
|
104
|
+
attach({
|
|
105
|
+
group: "acl-iam-full-access",
|
|
106
|
+
arn: STS_FEDERATION,
|
|
107
|
+
profile,
|
|
108
|
+
verbose
|
|
109
|
+
});
|
|
110
|
+
detach({ group: "acl-iam-full-access", arn: DENY_LIST, profile, verbose });
|
|
111
|
+
attach({ group: "acl-power-users", arn: READ_ONLY, profile, verbose });
|
|
112
|
+
attach({ group: "acl-power-users", arn: WRITE_LIST, profile, verbose });
|
|
113
|
+
attach({ group: "acl-power-users", arn: DENY_LIST, profile, verbose });
|
|
114
|
+
attach({ group: "acl-power-users", arn: SELF_SERVICE, profile, verbose });
|
|
115
|
+
attach({ group: "acl-read-only", arn: READ_ONLY, profile, verbose });
|
|
116
|
+
attach({ group: "acl-read-only", arn: STS_FEDERATION, profile, verbose });
|
|
117
|
+
attach({
|
|
118
|
+
group: "acl-s3-restrictions",
|
|
119
|
+
arn: S3_RESTRICTIONS,
|
|
120
|
+
profile,
|
|
121
|
+
verbose
|
|
122
|
+
});
|
|
123
|
+
console.log("");
|
|
124
|
+
console.log("4. Apply region restriction to acl-power-users...");
|
|
125
|
+
if (restrict) {
|
|
126
|
+
attach({ group: "acl-power-users", arn: DENY_REGIONS, profile, verbose });
|
|
127
|
+
} else {
|
|
128
|
+
detach({ group: "acl-power-users", arn: DENY_REGIONS, profile, verbose });
|
|
129
|
+
}
|
|
130
|
+
console.log("");
|
|
131
|
+
console.log("5. Detach legacy policies (if present)...");
|
|
132
|
+
const LEGACY_POWER_USER = "arn:aws:iam::aws:policy/PowerUserAccess";
|
|
133
|
+
const LEGACY_IAM_RO = "arn:aws:iam::aws:policy/IAMReadOnlyAccess";
|
|
134
|
+
const LEGACY_ALLOW = `arn:aws:iam::${accountId}:policy/UserAdminsAllowList`;
|
|
135
|
+
const LEGACY_DENY_SVCS = `arn:aws:iam::${accountId}:policy/UserAdminsDenyListServices`;
|
|
136
|
+
const LEGACY_DENY_GPU = `arn:aws:iam::${accountId}:policy/UserAdminsDenyListGpu`;
|
|
137
|
+
const legacyArns = [
|
|
138
|
+
LEGACY_POWER_USER,
|
|
139
|
+
LEGACY_IAM_RO,
|
|
140
|
+
LEGACY_ALLOW,
|
|
141
|
+
LEGACY_DENY_SVCS,
|
|
142
|
+
LEGACY_DENY_GPU
|
|
143
|
+
];
|
|
144
|
+
for (const group of ACL_GROUPS) {
|
|
145
|
+
for (const arn of legacyArns) {
|
|
146
|
+
detach({ group, arn, profile, verbose });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
console.log("");
|
|
150
|
+
console.log("6. Final state:");
|
|
151
|
+
printFinalState({ profile, verbose });
|
|
152
|
+
console.log("");
|
|
153
|
+
if (createUsers) {
|
|
154
|
+
console.log("7. Create IAM users (optional)");
|
|
155
|
+
console.log("");
|
|
156
|
+
await createUsersInteractive({ profile, verbose });
|
|
157
|
+
}
|
|
158
|
+
console.log(chalk.green("\n\u2705 ACL setup complete."));
|
|
159
|
+
} catch (error) {
|
|
160
|
+
if (error instanceof ZodError) {
|
|
161
|
+
console.error(chalk.red("\n\u274C Invalid command options:"));
|
|
162
|
+
error.errors.forEach((err) => {
|
|
163
|
+
console.error(chalk.red(` ${err.path.join(".")}: ${err.message}`));
|
|
164
|
+
});
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
const verbose = (
|
|
168
|
+
/** @type {any} */
|
|
169
|
+
options?.verbose || false
|
|
170
|
+
);
|
|
171
|
+
console.error(chalk.red("\n\u274C iam setup-acl failed:"));
|
|
172
|
+
if (error instanceof Error) {
|
|
173
|
+
console.error(chalk.red(` ${error.message}`));
|
|
174
|
+
if (verbose && error.stack) {
|
|
175
|
+
console.error(chalk.gray("\nStack trace:"));
|
|
176
|
+
console.error(chalk.gray(error.stack));
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
console.error(chalk.red(` ${String(error)}`));
|
|
180
|
+
}
|
|
181
|
+
console.error(
|
|
182
|
+
chalk.yellow(
|
|
183
|
+
"\n\u{1F4A1} Run with a profile that has IAMFullAccess (e.g. md-*-iam-admin).\n"
|
|
184
|
+
)
|
|
185
|
+
);
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export {
|
|
191
|
+
setupAclCommand
|
|
192
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
profileField,
|
|
3
|
+
verboseField
|
|
4
|
+
} from "./73BJG53F.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/aws/iam/remove-admin/schema.js
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var removeAdminOptionsSchema = z.object({
|
|
9
|
+
profile: profileField,
|
|
10
|
+
all: z.boolean().optional().default(false).describe(
|
|
11
|
+
"Scan every aws-vault profile (default only when --profile and AWS_PROFILE are unset)"
|
|
12
|
+
),
|
|
13
|
+
user: z.array(z.string()).optional().default([]).describe(
|
|
14
|
+
"Only remove these user(s); repeatable. Default: every user in the group"
|
|
15
|
+
),
|
|
16
|
+
yes: z.boolean().optional().default(false).describe("Skip the per-profile confirmation prompt"),
|
|
17
|
+
dryRun: z.boolean().optional().default(false).describe("Preview removals without changing anything"),
|
|
18
|
+
verbose: verboseField
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
removeAdminOptionsSchema
|
|
23
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createReadonlyUserCommand
|
|
3
|
+
} from "./M35URMT4.js";
|
|
4
|
+
|
|
5
|
+
// src/commands/db/index.js
|
|
6
|
+
function registerDbCommands(program) {
|
|
7
|
+
const db = program.command("db").summary("Database operational commands").description("Database operational helpers (MySQL and Postgres)");
|
|
8
|
+
db.command("create-readonly-user").summary("Create a read-only database user").description(
|
|
9
|
+
"Create (or update) a read-only database user on MySQL or Postgres. Interactively pick a single database or all databases, then print a connection URL."
|
|
10
|
+
).option(
|
|
11
|
+
"-e, --engine <engine>",
|
|
12
|
+
"Database engine: postgres or mysql (inferred from --url when omitted)"
|
|
13
|
+
).option(
|
|
14
|
+
"-u, --url <url>",
|
|
15
|
+
"Admin connection URL (defaults to DATABASE_URL / MYSQL_URL / POSTGRES_URL)"
|
|
16
|
+
).option(
|
|
17
|
+
"-d, --database <name>",
|
|
18
|
+
'Target database name, or "all" for every non-system database'
|
|
19
|
+
).option(
|
|
20
|
+
"--username <name>",
|
|
21
|
+
"Read-only username to create (default: readonly)"
|
|
22
|
+
).option(
|
|
23
|
+
"--password <password>",
|
|
24
|
+
"Password for the new user (generated when omitted)"
|
|
25
|
+
).option("--host-pattern <pattern>", "MySQL user host pattern (default: %)").option("--ssl", "Force SSL on (loose verify \u2014 useful for RDS)").option("--no-ssl", "Force SSL off").option("-y, --yes", "Skip the confirmation prompt").option("--dry-run", "Print the SQL plan without applying it").option("-v, --verbose", "Enable verbose logging").action(async (options) => {
|
|
26
|
+
let ssl;
|
|
27
|
+
if (options.ssl === true) {
|
|
28
|
+
ssl = true;
|
|
29
|
+
} else if (options.noSsl === true) {
|
|
30
|
+
ssl = false;
|
|
31
|
+
}
|
|
32
|
+
await createReadonlyUserCommand({
|
|
33
|
+
engine: options.engine,
|
|
34
|
+
url: options.url,
|
|
35
|
+
database: options.database,
|
|
36
|
+
username: options.username,
|
|
37
|
+
password: options.password,
|
|
38
|
+
hostPattern: options.hostPattern,
|
|
39
|
+
ssl,
|
|
40
|
+
yes: options.yes ?? false,
|
|
41
|
+
dryRun: options.dryRun ?? false,
|
|
42
|
+
verbose: options.verbose ?? false
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
registerDbCommands
|
|
49
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
profileField,
|
|
3
|
+
verboseField
|
|
4
|
+
} from "./73BJG53F.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/aws/iam/break-glass/schema.js
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var breakGlassOptionsSchema = z.object({
|
|
9
|
+
profile: profileField,
|
|
10
|
+
user: z.array(z.string()).optional().default([]).describe(
|
|
11
|
+
"Grant break-glass to this user (repeatable). Default: your own IAM user"
|
|
12
|
+
),
|
|
13
|
+
yes: z.boolean().optional().default(false).describe("Skip the confirmation prompt"),
|
|
14
|
+
dryRun: z.boolean().optional().default(false).describe("Preview the grant without changing anything"),
|
|
15
|
+
verbose: verboseField
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
breakGlassOptionsSchema
|
|
20
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import {
|
|
2
|
+
removeAdminOptionsSchema
|
|
3
|
+
} from "./DNFTUMGD.js";
|
|
4
|
+
import {
|
|
5
|
+
ADMIN_GROUP_NAME,
|
|
6
|
+
resolveAdminScanProfiles,
|
|
7
|
+
resolveProfileScan
|
|
8
|
+
} from "./NF3M2L6C.js";
|
|
9
|
+
import {
|
|
10
|
+
requireCommands
|
|
11
|
+
} from "./FNXUONAV.js";
|
|
12
|
+
import {
|
|
13
|
+
promptYesNo
|
|
14
|
+
} from "./ZHKVJO2U.js";
|
|
15
|
+
|
|
16
|
+
// src/commands/aws/iam/remove-admin/handler.js
|
|
17
|
+
import chalk from "chalk";
|
|
18
|
+
import { ZodError } from "zod";
|
|
19
|
+
async function removeAdminCommand(options) {
|
|
20
|
+
try {
|
|
21
|
+
const { profile, all, user, yes, dryRun, verbose } = removeAdminOptionsSchema.parse(options);
|
|
22
|
+
requireCommands(["aws"]);
|
|
23
|
+
const userFilter = new Set(user);
|
|
24
|
+
const needsVault = all || !(profile ?? process.env.AWS_PROFILE);
|
|
25
|
+
if (needsVault) {
|
|
26
|
+
requireCommands(["aws-vault"]);
|
|
27
|
+
}
|
|
28
|
+
let profiles;
|
|
29
|
+
try {
|
|
30
|
+
profiles = resolveAdminScanProfiles({ profile, all });
|
|
31
|
+
} catch (resolveError) {
|
|
32
|
+
if (resolveError instanceof Error && resolveError.message === "No aws-vault profiles with credentials found.") {
|
|
33
|
+
console.error(chalk.red(resolveError.message));
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
throw resolveError;
|
|
37
|
+
}
|
|
38
|
+
console.log(
|
|
39
|
+
chalk.blue(
|
|
40
|
+
`
|
|
41
|
+
==> Removing break-glass access (${ADMIN_GROUP_NAME}) across ${profiles.length} profile(s)
|
|
42
|
+
`
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
if (dryRun) {
|
|
46
|
+
console.log(chalk.yellow("[dry-run] No changes will be made.\n"));
|
|
47
|
+
}
|
|
48
|
+
let removed = 0;
|
|
49
|
+
let cleaned = 0;
|
|
50
|
+
let skipped = 0;
|
|
51
|
+
for (const candidate of profiles) {
|
|
52
|
+
const scan = resolveProfileScan({ profile: candidate, verbose });
|
|
53
|
+
if (!scan) {
|
|
54
|
+
skipped += 1;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (scan.users.length === 0) {
|
|
58
|
+
if (verbose) {
|
|
59
|
+
console.log(
|
|
60
|
+
chalk.green(`OK ${candidate} (${scan.accountId}) \u2014 0 users`)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
cleaned += 1;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const targets = userFilter.size > 0 ? scan.users.filter((name) => userFilter.has(name)) : scan.users;
|
|
67
|
+
if (targets.length === 0) {
|
|
68
|
+
console.log(
|
|
69
|
+
chalk.dim(
|
|
70
|
+
`-- ${candidate} (${scan.accountId}) \u2014 has users but none match --user`
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
skipped += 1;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
console.log(
|
|
77
|
+
chalk.red(
|
|
78
|
+
`FOUND ${candidate} (${scan.accountId}) \u2014 ${targets.length} user(s): ${targets.join(", ")}`
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
if (dryRun) {
|
|
82
|
+
for (const name of targets) {
|
|
83
|
+
console.log(
|
|
84
|
+
chalk.yellow(
|
|
85
|
+
` [dry-run] would remove ${name} from ${ADMIN_GROUP_NAME}`
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
let confirmed = yes;
|
|
92
|
+
if (!confirmed) {
|
|
93
|
+
confirmed = await promptYesNo({
|
|
94
|
+
message: ` Remove ${targets.length} user(s) from ${ADMIN_GROUP_NAME} in ${candidate}?`,
|
|
95
|
+
defaultYes: false
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (!confirmed) {
|
|
99
|
+
console.log(chalk.dim(" skipped (not confirmed)"));
|
|
100
|
+
skipped += 1;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
for (const name of targets) {
|
|
104
|
+
try {
|
|
105
|
+
scan.run(
|
|
106
|
+
[
|
|
107
|
+
"iam",
|
|
108
|
+
"remove-user-from-group",
|
|
109
|
+
"--group-name",
|
|
110
|
+
ADMIN_GROUP_NAME,
|
|
111
|
+
"--user-name",
|
|
112
|
+
name
|
|
113
|
+
],
|
|
114
|
+
{ expectJson: false }
|
|
115
|
+
);
|
|
116
|
+
console.log(chalk.green(` removed ${name}`));
|
|
117
|
+
removed += 1;
|
|
118
|
+
} catch (removeError) {
|
|
119
|
+
const reason = removeError instanceof Error ? removeError.message.split("\n")[0] ?? "" : String(removeError);
|
|
120
|
+
console.log(chalk.red(` failed to remove ${name}: ${reason}`));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
console.log(chalk.blue("\n==> Summary"));
|
|
125
|
+
console.log(` Profiles scanned: ${profiles.length}`);
|
|
126
|
+
console.log(` Users removed: ${removed}`);
|
|
127
|
+
console.log(` Already clean: ${cleaned}`);
|
|
128
|
+
console.log(` Skipped: ${skipped}`);
|
|
129
|
+
if (dryRun) {
|
|
130
|
+
console.log(
|
|
131
|
+
chalk.yellow("\n[dry-run] Re-run without --dry-run to apply changes.")
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (error instanceof ZodError) {
|
|
136
|
+
console.error(chalk.red("\n\u274C Invalid command options:"));
|
|
137
|
+
error.errors.forEach((err) => {
|
|
138
|
+
console.error(chalk.red(` ${err.path.join(".")}: ${err.message}`));
|
|
139
|
+
});
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
const verbose = (
|
|
143
|
+
/** @type {any} */
|
|
144
|
+
options?.verbose || false
|
|
145
|
+
);
|
|
146
|
+
console.error(chalk.red("\n\u274C remove-admin failed:"));
|
|
147
|
+
if (error instanceof Error) {
|
|
148
|
+
console.error(chalk.red(` ${error.message}`));
|
|
149
|
+
if (verbose && error.stack) {
|
|
150
|
+
console.error(chalk.gray("\nStack trace:"));
|
|
151
|
+
console.error(chalk.gray(error.stack));
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
console.error(chalk.red(` ${String(error)}`));
|
|
155
|
+
}
|
|
156
|
+
console.error(
|
|
157
|
+
chalk.yellow(
|
|
158
|
+
"\n\u{1F4A1} Requires the AWS CLI (and aws-vault when scanning multiple profiles) and iam:RemoveUserFromGroup.\n"
|
|
159
|
+
)
|
|
160
|
+
);
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
removeAdminCommand
|
|
167
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// src/commands/aws/utils/exec-aws.js
|
|
2
|
+
import { spawnSync } from "child_process";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
var AwsCliError = class extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} message
|
|
7
|
+
* @param {string | null} [code]
|
|
8
|
+
*/
|
|
9
|
+
constructor(message, code = null) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "AwsCliError";
|
|
12
|
+
this.code = code;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
function parseAwsErrorCode(stderr) {
|
|
16
|
+
const match = /\(([A-Za-z.]+)\)/.exec(stderr);
|
|
17
|
+
return match?.[1] ?? null;
|
|
18
|
+
}
|
|
19
|
+
function requireCommands(commands) {
|
|
20
|
+
const missing = commands.filter((command) => {
|
|
21
|
+
const result = spawnSync("which", [command], { stdio: "pipe" });
|
|
22
|
+
return result.status !== 0;
|
|
23
|
+
});
|
|
24
|
+
if (missing.length > 0) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`Required command(s) not found on PATH: ${missing.join(", ")}`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function runAws(params) {
|
|
31
|
+
const {
|
|
32
|
+
profile,
|
|
33
|
+
region,
|
|
34
|
+
args,
|
|
35
|
+
expectJson = true,
|
|
36
|
+
verbose = false,
|
|
37
|
+
env
|
|
38
|
+
} = params;
|
|
39
|
+
const finalArgs = [];
|
|
40
|
+
if (profile) finalArgs.push("--profile", profile);
|
|
41
|
+
if (region) finalArgs.push("--region", region);
|
|
42
|
+
finalArgs.push("--no-cli-pager", ...args);
|
|
43
|
+
if (expectJson) finalArgs.push("--output", "json");
|
|
44
|
+
return spawnAws("aws", finalArgs, { expectJson, verbose, env });
|
|
45
|
+
}
|
|
46
|
+
function runAwsVault(params) {
|
|
47
|
+
const {
|
|
48
|
+
profile,
|
|
49
|
+
args,
|
|
50
|
+
duration = "15m",
|
|
51
|
+
expectJson = true,
|
|
52
|
+
verbose = false
|
|
53
|
+
} = params;
|
|
54
|
+
const awsArgs = ["--no-cli-pager", ...args];
|
|
55
|
+
if (expectJson) awsArgs.push("--output", "json");
|
|
56
|
+
const finalArgs = [
|
|
57
|
+
"exec",
|
|
58
|
+
profile,
|
|
59
|
+
"--duration",
|
|
60
|
+
duration,
|
|
61
|
+
"--",
|
|
62
|
+
"aws",
|
|
63
|
+
...awsArgs
|
|
64
|
+
];
|
|
65
|
+
return spawnAws("aws-vault", finalArgs, { expectJson, verbose });
|
|
66
|
+
}
|
|
67
|
+
function spawnAws(command, args, options) {
|
|
68
|
+
const { expectJson, verbose, env } = options;
|
|
69
|
+
if (verbose) {
|
|
70
|
+
console.log(chalk.gray(` Executing: ${command} ${args.join(" ")}`));
|
|
71
|
+
}
|
|
72
|
+
const result = spawnSync(command, args, {
|
|
73
|
+
encoding: "utf-8",
|
|
74
|
+
env: env ? { ...process.env, ...env } : process.env
|
|
75
|
+
});
|
|
76
|
+
if (result.error) {
|
|
77
|
+
throw new AwsCliError(result.error.message);
|
|
78
|
+
}
|
|
79
|
+
if (result.status !== 0) {
|
|
80
|
+
const stderr = (result.stderr || result.stdout || "").trim();
|
|
81
|
+
const message = stderr || `Command failed: ${command} ${args.join(" ")}`;
|
|
82
|
+
throw new AwsCliError(message, parseAwsErrorCode(stderr));
|
|
83
|
+
}
|
|
84
|
+
const stdout = (result.stdout ?? "").trim();
|
|
85
|
+
if (!expectJson) {
|
|
86
|
+
return stdout;
|
|
87
|
+
}
|
|
88
|
+
if (!stdout) {
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
return JSON.parse(stdout);
|
|
92
|
+
}
|
|
93
|
+
function getCallerIdentity(params) {
|
|
94
|
+
const { profile, region, verbose } = params;
|
|
95
|
+
return runAws({
|
|
96
|
+
profile,
|
|
97
|
+
region,
|
|
98
|
+
args: ["sts", "get-caller-identity"],
|
|
99
|
+
verbose
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
AwsCliError,
|
|
105
|
+
parseAwsErrorCode,
|
|
106
|
+
requireCommands,
|
|
107
|
+
runAws,
|
|
108
|
+
runAwsVault,
|
|
109
|
+
getCallerIdentity
|
|
110
|
+
};
|