@flowcore/cli-plugin-iam 1.7.0 → 1.8.1
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/README.md +396 -7
- package/bin/dev.js +2 -2
- package/bin/run.js +2 -2
- package/dist/commands/assign/policy.d.ts +16 -0
- package/dist/commands/assign/policy.js +124 -0
- package/dist/commands/assign/role.d.ts +15 -0
- package/dist/commands/assign/role.js +98 -0
- package/dist/commands/create/policy.d.ts +16 -0
- package/dist/commands/create/policy.js +110 -0
- package/dist/commands/create/role.d.ts +14 -0
- package/dist/commands/create/role.js +78 -0
- package/dist/commands/edit/policy.js +3 -3
- package/dist/commands/edit/role.js +3 -3
- package/dist/commands/get/key-policies.d.ts +13 -0
- package/dist/commands/get/key-policies.js +79 -0
- package/dist/commands/get/key-roles.d.ts +13 -0
- package/dist/commands/get/key-roles.js +75 -0
- package/dist/commands/get/user-policies.d.ts +14 -0
- package/dist/commands/get/user-policies.js +94 -0
- package/dist/commands/get/user-roles.d.ts +14 -0
- package/dist/commands/get/user-roles.js +90 -0
- package/dist/commands/unassign/policy.d.ts +17 -0
- package/dist/commands/unassign/policy.js +143 -0
- package/dist/commands/unassign/role.d.ts +16 -0
- package/dist/commands/unassign/role.js +117 -0
- package/dist/commands/validate/key.d.ts +15 -0
- package/dist/commands/validate/key.js +106 -0
- package/dist/commands/validate/user.d.ts +15 -0
- package/dist/commands/validate/user.js +106 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/resource-types/iam-api-version.js +2 -2
- package/dist/resource-types/policy.resource.js +3 -3
- package/dist/resource-types/role-binding.resource.d.ts +4 -4
- package/dist/resource-types/role.resource.d.ts +3 -3
- package/dist/resource-types/role.resource.js +2 -2
- package/dist/utils/combine-merge.util.d.ts +1 -1
- package/dist/utils/combine-merge.util.js +1 -1
- package/dist/utils/error-message.util.d.ts +1 -0
- package/dist/utils/error-message.util.js +4 -0
- package/dist/utils/fetch-manifest.util.js +2 -2
- package/dist/utils/read-pipe.util.js +5 -5
- package/oclif.manifest.json +958 -63
- package/package.json +18 -11
- package/.npmrc +0 -1
- package/CHANGELOG.md +0 -132
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { inspect } from "node:util";
|
|
1
2
|
import { baseResourceDto } from "@flowcore/cli-plugin-core";
|
|
2
3
|
import { diff } from "@opentf/obj-diff";
|
|
3
4
|
import enquirer from "enquirer";
|
|
4
5
|
import { diffString } from "json-diff";
|
|
5
|
-
import { inspect } from "node:util";
|
|
6
6
|
import { omit } from "radash";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
export var PolicyDocumentAction;
|
|
@@ -85,7 +85,7 @@ export class PolicyService {
|
|
|
85
85
|
flowcoreManaged: parsedPolicy.spec.flowcoreManaged ?? false,
|
|
86
86
|
};
|
|
87
87
|
if (diff({
|
|
88
|
-
...omit(existingPolicy, ["id"]),
|
|
88
|
+
...omit(existingPolicy, ["id", "frn"]),
|
|
89
89
|
policyDocuments: existingPolicy.policyDocuments.map((doc) => useStatementIds ? doc : omit(doc, ["statementId"])),
|
|
90
90
|
}, newPolicy).length === 0) {
|
|
91
91
|
return false;
|
|
@@ -93,7 +93,7 @@ export class PolicyService {
|
|
|
93
93
|
if (!skipConfirmation) {
|
|
94
94
|
this.logger.info("Policy has changed, do you want to apply these changes?");
|
|
95
95
|
this.logger.info(diffString({
|
|
96
|
-
...omit(existingPolicy, ["id"]),
|
|
96
|
+
...omit(existingPolicy, ["id", "frn"]),
|
|
97
97
|
policyDocuments: existingPolicy.policyDocuments.map((doc) => useStatementIds ? doc : omit(doc, ["statementId"])),
|
|
98
98
|
}, newPolicy, { color: true, full: true }));
|
|
99
99
|
const { confirm } = await enquirer.prompt({
|
|
@@ -28,17 +28,17 @@ export declare const roleBindingDto: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
28
28
|
type: "key" | "user";
|
|
29
29
|
}>, "many">;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
role: string;
|
|
31
32
|
subjects: {
|
|
32
33
|
id: string;
|
|
33
34
|
type: "key" | "user";
|
|
34
35
|
}[];
|
|
35
|
-
role: string;
|
|
36
36
|
}, {
|
|
37
|
+
role: string;
|
|
37
38
|
subjects: {
|
|
38
39
|
id: string;
|
|
39
40
|
type: "key" | "user";
|
|
40
41
|
}[];
|
|
41
|
-
role: string;
|
|
42
42
|
}>;
|
|
43
43
|
}>, "strip", z.ZodTypeAny, {
|
|
44
44
|
kind: string;
|
|
@@ -48,11 +48,11 @@ export declare const roleBindingDto: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
48
48
|
tenant: string;
|
|
49
49
|
};
|
|
50
50
|
spec: {
|
|
51
|
+
role: string;
|
|
51
52
|
subjects: {
|
|
52
53
|
id: string;
|
|
53
54
|
type: "key" | "user";
|
|
54
55
|
}[];
|
|
55
|
-
role: string;
|
|
56
56
|
};
|
|
57
57
|
}, {
|
|
58
58
|
kind: string;
|
|
@@ -62,11 +62,11 @@ export declare const roleBindingDto: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
62
62
|
tenant: string;
|
|
63
63
|
};
|
|
64
64
|
spec: {
|
|
65
|
+
role: string;
|
|
65
66
|
subjects: {
|
|
66
67
|
id: string;
|
|
67
68
|
type: "key" | "user";
|
|
68
69
|
}[];
|
|
69
|
-
role: string;
|
|
70
70
|
};
|
|
71
71
|
}>;
|
|
72
72
|
export type RoleBinding = z.infer<typeof roleBindingDto>;
|
|
@@ -18,14 +18,14 @@ export declare const roleDto: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
18
18
|
spec: z.ZodObject<{
|
|
19
19
|
description: z.ZodOptional<z.ZodString>;
|
|
20
20
|
flowcoreManaged: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
-
policies: z.ZodArray<z.ZodString, "many"
|
|
21
|
+
policies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
23
|
policies: string[];
|
|
24
24
|
description?: string | undefined;
|
|
25
25
|
flowcoreManaged?: boolean | undefined;
|
|
26
26
|
}, {
|
|
27
|
-
policies: string[];
|
|
28
27
|
description?: string | undefined;
|
|
28
|
+
policies?: string[] | undefined;
|
|
29
29
|
flowcoreManaged?: boolean | undefined;
|
|
30
30
|
}>;
|
|
31
31
|
}>, "strip", z.ZodTypeAny, {
|
|
@@ -48,8 +48,8 @@ export declare const roleDto: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
48
48
|
tenant: string;
|
|
49
49
|
};
|
|
50
50
|
spec: {
|
|
51
|
-
policies: string[];
|
|
52
51
|
description?: string | undefined;
|
|
52
|
+
policies?: string[] | undefined;
|
|
53
53
|
flowcoreManaged?: boolean | undefined;
|
|
54
54
|
};
|
|
55
55
|
}>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { inspect } from "node:util";
|
|
1
2
|
import { baseResourceDto } from "@flowcore/cli-plugin-core";
|
|
2
3
|
import { diff } from "@opentf/obj-diff";
|
|
3
4
|
import enquirer from "enquirer";
|
|
4
5
|
import { diffString } from "json-diff";
|
|
5
|
-
import { inspect } from "node:util";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
export const roleDto = baseResourceDto.extend({
|
|
8
8
|
spec: z.object({
|
|
9
9
|
description: z.string().optional(),
|
|
10
10
|
flowcoreManaged: z.boolean().optional(),
|
|
11
|
-
policies: z.array(z.string()),
|
|
11
|
+
policies: z.array(z.string()).default([]),
|
|
12
12
|
}),
|
|
13
13
|
});
|
|
14
14
|
export class RoleService {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import merge from
|
|
1
|
+
import merge from "deepmerge";
|
|
2
2
|
export declare const combineMerge: (target: unknown[], source: unknown[], options: merge.ArrayMergeOptions) => unknown[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getErrorMessage(err: Error): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
import { ux } from "@oclif/core";
|
|
2
3
|
import merge from "deepmerge";
|
|
3
4
|
import { load } from "js-yaml";
|
|
4
|
-
import fs from "node:fs";
|
|
5
5
|
import { combineMerge } from "./combine-merge.util.js";
|
|
6
6
|
import { readPipe } from "./read-pipe.util.js";
|
|
7
7
|
export const FetchManifestUtil = {
|
|
@@ -9,7 +9,7 @@ export const FetchManifestUtil = {
|
|
|
9
9
|
const contents = [];
|
|
10
10
|
for (const file of files) {
|
|
11
11
|
if (file === "-") {
|
|
12
|
-
contents.push(await readPipe() || "");
|
|
12
|
+
contents.push((await readPipe()) || "");
|
|
13
13
|
}
|
|
14
14
|
else if (fs.existsSync(file)) {
|
|
15
15
|
contents.push(fs.readFileSync(file, "utf8"));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export const readPipe = () => new Promise(resolve => {
|
|
1
|
+
export const readPipe = () => new Promise((resolve) => {
|
|
2
2
|
const stdin = process.openStdin();
|
|
3
3
|
stdin.setEncoding("utf8");
|
|
4
|
-
let data =
|
|
5
|
-
stdin.on(
|
|
4
|
+
let data = "";
|
|
5
|
+
stdin.on("data", (chunk) => {
|
|
6
6
|
data += chunk;
|
|
7
7
|
});
|
|
8
|
-
stdin.on(
|
|
8
|
+
stdin.on("end", () => {
|
|
9
9
|
resolve(data);
|
|
10
10
|
});
|
|
11
11
|
if (stdin.isTTY) {
|
|
12
|
-
resolve(
|
|
12
|
+
resolve("");
|
|
13
13
|
}
|
|
14
14
|
});
|