viza 1.6.45 → 1.6.47
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { registerAwsRolesAnywhereBootstrap } from "./bootstrap/register.js";
|
|
2
2
|
import { registerAwsRolesAnywhereRotate } from "./rotate/register.js";
|
|
3
3
|
import { registerAwsRolesAnywhereRebootstrap } from "./rebootstrap/register.js";
|
|
4
|
+
import { registerAwsRolesAnywhereUpdateRole } from "./update-role/register.js";
|
|
4
5
|
export function registerAwsRolesAnywhereCommand(program) {
|
|
5
6
|
const aws = program.command("aws").description("AWS related commands");
|
|
6
7
|
const rolesanywhere = aws
|
|
@@ -9,4 +10,5 @@ export function registerAwsRolesAnywhereCommand(program) {
|
|
|
9
10
|
registerAwsRolesAnywhereBootstrap(rolesanywhere);
|
|
10
11
|
registerAwsRolesAnywhereRebootstrap(rolesanywhere);
|
|
11
12
|
registerAwsRolesAnywhereRotate(rolesanywhere);
|
|
13
|
+
registerAwsRolesAnywhereUpdateRole(rolesanywhere);
|
|
12
14
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { updateAwsRolesAnywhereRoleCommand } from "./update-role.js";
|
|
2
|
+
import { getResolvedOptions } from "../../../../cli/resolveOptions.js";
|
|
3
|
+
export function registerAwsRolesAnywhereUpdateRole(program) {
|
|
4
|
+
program
|
|
5
|
+
.command("update-role")
|
|
6
|
+
.description("Update AWS RolesAnywhere IAM role policies")
|
|
7
|
+
.option("--prod", "Use production environment")
|
|
8
|
+
.option("--dev", "Use development environment")
|
|
9
|
+
.action(async (_opts, command) => {
|
|
10
|
+
const fullOpts = getResolvedOptions(command);
|
|
11
|
+
await updateAwsRolesAnywhereRoleCommand(fullOpts);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { resolveEnv } from "../../../../context/env.js";
|
|
2
|
+
import { resolveResourceHubIntent } from "../../../../context/hubIntent.js";
|
|
3
|
+
import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
|
|
4
|
+
/**
|
|
5
|
+
* Target teams for `viza aws rolesanywhere update-role`.
|
|
6
|
+
* CLI-only fail-fast UX constraint.
|
|
7
|
+
* NOT a policy and MUST NOT be sent to gateway.
|
|
8
|
+
*/
|
|
9
|
+
const TARGET_TEAMS = {
|
|
10
|
+
"dev": [
|
|
11
|
+
"viza-admin",
|
|
12
|
+
"viza-super"
|
|
13
|
+
],
|
|
14
|
+
"prod": [
|
|
15
|
+
"viza-admin",
|
|
16
|
+
"viza-super"
|
|
17
|
+
]
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* viza aws rolesanywhere update-role
|
|
21
|
+
*
|
|
22
|
+
* Flow:
|
|
23
|
+
* 1) Resolve env
|
|
24
|
+
* 2) Resolve hub intent
|
|
25
|
+
* 3) Derive allowed teams (CLI UX only)
|
|
26
|
+
* 4) Dispatch frozen intent
|
|
27
|
+
*/
|
|
28
|
+
export async function updateAwsRolesAnywhereRoleCommand(options) {
|
|
29
|
+
// 1) Resolve environment
|
|
30
|
+
const env = resolveEnv(options);
|
|
31
|
+
const intent = resolveResourceHubIntent(env);
|
|
32
|
+
// 2) Resolve allowed teams (no status mode for rotate)
|
|
33
|
+
const allowedTeams = TARGET_TEAMS[env];
|
|
34
|
+
// 3) Dispatch intent (freeze)
|
|
35
|
+
await dispatchIntentAndWait({
|
|
36
|
+
intent,
|
|
37
|
+
commandType: "aws.rolesanywhere.update-role",
|
|
38
|
+
infraKey: "core",
|
|
39
|
+
targetEnv: env,
|
|
40
|
+
allowedTeams,
|
|
41
|
+
// Canonical CLI contract (explicit, non-magical)
|
|
42
|
+
selfHosted: options.selfHosted === true,
|
|
43
|
+
keepLog: options.removeLog !== true,
|
|
44
|
+
flowGates: {
|
|
45
|
+
secrets: true,
|
|
46
|
+
},
|
|
47
|
+
payload: {}
|
|
48
|
+
}, {
|
|
49
|
+
status: options.status === true,
|
|
50
|
+
log: "show",
|
|
51
|
+
});
|
|
52
|
+
}
|