@intentius/chant-lexicon-aws 0.124.102 → 0.124.103
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/dist/codegen/generate-lexicon.d.ts +2 -0
- package/dist/codegen/generate-lexicon.js +7 -0
- package/dist/generated/lexicon-aws.json +6860 -5
- package/dist/index-import.d.ts +4 -0
- package/dist/index-import.js +24 -1
- package/dist/integrity.json +3 -3
- package/dist/manifest.json +1 -1
- package/dist/meta.json +6860 -5
- package/dist/reference-catalog.js +2 -0
- package/package.json +2 -2
package/dist/index-import.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export interface ImportManifestEntry {
|
|
|
5
5
|
kind: string;
|
|
6
6
|
/** GetAtt name -> CloudFormation attribute: the schema's `readOnlyProperties`. */
|
|
7
7
|
attrs?: Record<string, string>;
|
|
8
|
+
/** The schema's top-level required properties. */
|
|
9
|
+
required?: string[];
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Whether `type` is a resource type this lexicon can write: the listed-type
|
|
@@ -16,6 +18,8 @@ export interface ImportManifestEntry {
|
|
|
16
18
|
export declare function isImportableAwsType(type: string, manifest?: ReadonlyMap<string, ImportManifestEntry>): boolean;
|
|
17
19
|
/** The properties a declaration of `type` can hold, from an indexed node's attrs. */
|
|
18
20
|
export declare function awsImportProperties(type: string, attrs: Record<string, unknown>, manifest?: ReadonlyMap<string, ImportManifestEntry>): Record<string, unknown>;
|
|
21
|
+
/** The properties `type` requires that `properties` does not hold, sorted. */
|
|
22
|
+
export declare function awsMissingRequired(type: string, properties: Record<string, unknown>, manifest?: ReadonlyMap<string, ImportManifestEntry>): string[];
|
|
19
23
|
/** `value` as a reference to `target`, or undefined. */
|
|
20
24
|
export declare function awsImportReference(value: string, target: IndexImportTarget, manifest?: ReadonlyMap<string, ImportManifestEntry>): unknown | undefined;
|
|
21
25
|
/** The resource attributes `chant import --index` writes on every resource it imports (#4536). */
|
package/dist/index-import.js
CHANGED
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
* `GetAtt(<id>, "Arn")` when it is the resource's ARN and the type has an
|
|
19
19
|
* `Arn` attribute. Anything else stays a literal.
|
|
20
20
|
* - A masked value becomes a `String` parameter with `NoEcho`.
|
|
21
|
+
* - A property the schema requires that the node does not hold becomes a
|
|
22
|
+
* `String` parameter to fill in. Cloud Control's `ListResources` returns
|
|
23
|
+
* part of a resource's model for some types (a role's listing has no
|
|
24
|
+
* `AssumeRolePolicyDocument`), and source that left the property out
|
|
25
|
+
* would build into a template CloudFormation refuses.
|
|
21
26
|
*/
|
|
22
27
|
import { createRequire } from "module";
|
|
23
28
|
import { moduleSourceUrl } from "@intentius/chant/module-source";
|
|
@@ -81,6 +86,10 @@ export function awsImportProperties(type, attrs, manifest = defaultManifest()) {
|
|
|
81
86
|
}
|
|
82
87
|
return out;
|
|
83
88
|
}
|
|
89
|
+
/** The properties `type` requires that `properties` does not hold, sorted. */
|
|
90
|
+
export function awsMissingRequired(type, properties, manifest = defaultManifest()) {
|
|
91
|
+
return (manifest.get(type)?.required ?? []).filter((p) => properties[p] === undefined).sort();
|
|
92
|
+
}
|
|
84
93
|
/** True when `type` exposes `Arn` to GetAtt, or when there is no registry to ask. */
|
|
85
94
|
function hasArnAttribute(type, manifest) {
|
|
86
95
|
if (manifest.size === 0)
|
|
@@ -111,7 +120,14 @@ export function createAwsIndexImport(manifest) {
|
|
|
111
120
|
// (#4536, ruled on choudoufu#2284 Q4): CloudFormation deletes at stack
|
|
112
121
|
// level and reads no per-resource marker, so an adopted object is never
|
|
113
122
|
// deleted on the stack's word alone. Import requires a DeletionPolicy.
|
|
114
|
-
|
|
123
|
+
const properties = awsImportProperties(node.kind, node.attrs ?? {}, m());
|
|
124
|
+
const missing = awsMissingRequired(node.kind, properties, m());
|
|
125
|
+
return {
|
|
126
|
+
type: node.kind,
|
|
127
|
+
properties,
|
|
128
|
+
attributes: { ...ADOPTED_RESOURCE_ATTRIBUTES },
|
|
129
|
+
...(missing.length > 0 ? { missing } : {}),
|
|
130
|
+
};
|
|
115
131
|
},
|
|
116
132
|
reference: (value, target) => awsImportReference(value, target, m()),
|
|
117
133
|
secretParameter(name, context) {
|
|
@@ -122,6 +138,13 @@ export function createAwsIndexImport(manifest) {
|
|
|
122
138
|
constraints: { NoEcho: true },
|
|
123
139
|
};
|
|
124
140
|
},
|
|
141
|
+
requiredParameter(name, context) {
|
|
142
|
+
return {
|
|
143
|
+
name,
|
|
144
|
+
type: "String",
|
|
145
|
+
description: `${context.path} of ${context.node.id}, required and not in the index listing`,
|
|
146
|
+
};
|
|
147
|
+
},
|
|
125
148
|
parameterReference: (name) => ({ __intrinsic: "Ref", name }),
|
|
126
149
|
typeLabel(node) {
|
|
127
150
|
const last = node.kind.split("::").pop() ?? "Resource";
|
package/dist/integrity.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
5
|
-
"meta.json": "
|
|
4
|
+
"manifest.json": "a9698194fd64833276748ca73f7dd76cdeba7eb601c2c1dbe54b3df942372742",
|
|
5
|
+
"meta.json": "7de63d55427041907cd0fbdc504fc496d381e2bfebeae2fe9d48f1847ed29faf",
|
|
6
6
|
"types/index.d.ts": "8651f9ae166668f4311eea1fe61c3fe235f345947951c1d23d1df24a4fd3384f",
|
|
7
7
|
"rules/hardcoded-region.ts": "957eadcaa9f39cc17d21437565d7a94607d9b082cf28918b178fa067f07498a9",
|
|
8
8
|
"rules/iam-wildcard.ts": "10f5065fa2bbf2c8ce23dfb475a56df33f280df87784e44fec641b2584cbf333",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"skills/chant-aws-eks.md": "8789255709ff004ad0a875fd5999edcdc66fc6e33d710db058d9f42703bcfdfe",
|
|
76
76
|
"skills/chant-aws-carve-terraform.md": "a6f528c814024422744118abbfd9bbf26f3d60c599e90c3f186f8b76e1e38a51"
|
|
77
77
|
},
|
|
78
|
-
"composite": "
|
|
78
|
+
"composite": "f3afc081ad543cdb1d742c0ff9b8030e2b0082d606b776380e4659d834f7adab"
|
|
79
79
|
}
|