@aws/cloudformation-validate 1.0.0-beta

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.
@@ -0,0 +1,476 @@
1
+ export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export interface ConditionalNull {
5
+ path: string;
6
+ condition: string;
7
+ nullInTrue: boolean;
8
+ }
9
+
10
+ export interface ConditionalNullEntry {
11
+ path: string;
12
+ condition: string;
13
+ nullInTrueBranch: boolean;
14
+ }
15
+
16
+ export interface DetailedDiagnostic {
17
+ ruleId: string;
18
+ severity: Severity;
19
+ message: string;
20
+ source: RuleOrigin;
21
+ resourceId?: string;
22
+ resourceType?: string;
23
+ propertyPath?: string;
24
+ suggestedFix?: string;
25
+ category?: string;
26
+ startLine?: number;
27
+ startColumn?: number;
28
+ endLine?: number;
29
+ endColumn?: number;
30
+ relatedResources?: RelatedResource[];
31
+ conditionScenario?: Record<string, boolean> | undefined;
32
+ documentationUrl?: string;
33
+ ruleDescription?: string;
34
+ phase?: Phase;
35
+ section?: string;
36
+ context?: ViolationContext;
37
+ }
38
+
39
+ export interface DetailedReport {
40
+ filePath: string;
41
+ status: ReportStatus;
42
+ engineVersion: string;
43
+ metadata: ReportMetadata;
44
+ performance: PerformanceMetrics;
45
+ diagnostics: DetailedDiagnostic[];
46
+ }
47
+
48
+ export interface DiagnosticCondition {
49
+ expression?: string;
50
+ deps?: string[];
51
+ mutexWith?: string[];
52
+ }
53
+
54
+ export interface DiagnosticForEachExpansion {
55
+ path: string;
56
+ identifier: string;
57
+ collection: string;
58
+ }
59
+
60
+ export interface DiagnosticImplication {
61
+ antecedent: string;
62
+ consequent: string;
63
+ }
64
+
65
+ export interface DiagnosticModel {
66
+ template: DiagnosticTemplate;
67
+ parameters: Record<string, JsonValue>;
68
+ conditions: Record<string, DiagnosticCondition>;
69
+ conditionParamRefs: string[];
70
+ conditionImplications: DiagnosticImplication[];
71
+ conditionMutexGroups: DiagnosticMutexGroup[];
72
+ conditionExclusions: string[][];
73
+ resourceConditionMap: Record<string, string>;
74
+ mappings: JsonValue;
75
+ resources: Record<string, DiagnosticResource>;
76
+ outputs: Record<string, DiagnosticOutput>;
77
+ edges: ReferenceEdge[];
78
+ cycles: string[][];
79
+ outputEmptyJoins: string[];
80
+ samImplicitResources: string[];
81
+ globalsParamRefs: string[];
82
+ isCdk: boolean;
83
+ hasParseErrors: boolean;
84
+ parsedRules: DiagnosticRule[];
85
+ resolutionSources: ResolutionSource[];
86
+ }
87
+
88
+ export interface DiagnosticMutexGroup {
89
+ conditions: string[];
90
+ parameter: string;
91
+ values: string[];
92
+ }
93
+
94
+ export interface DiagnosticOutput {
95
+ value: JsonValue;
96
+ description: string | undefined;
97
+ condition: string | undefined;
98
+ exportName: JsonValue | undefined;
99
+ getattRefs: GetAttRef[];
100
+ conditionRefs: string[];
101
+ }
102
+
103
+ export interface DiagnosticResource {
104
+ resourceType: string;
105
+ condition: string | undefined;
106
+ dependsOn: string[];
107
+ deletionPolicy: JsonValue | undefined;
108
+ updateReplacePolicy: JsonValue | undefined;
109
+ creationPolicy: JsonValue | undefined;
110
+ updatePolicy: JsonValue | undefined;
111
+ properties: Record<string, JsonValue>;
112
+ outgoingRefs: OutgoingRef[];
113
+ incomingRefs: IncomingRef[];
114
+ findInMapRefs: string[];
115
+ simpleSubs: PathVariable[];
116
+ redundantSubs: string[];
117
+ emptyJoins: string[];
118
+ hardcodedPartitionArns: string[];
119
+ conditionallyNullProps: ConditionalNull[];
120
+ conditionRefs: string[];
121
+ forEachExpansions: DiagnosticForEachExpansion[];
122
+ unsubstitutedVariables: PathVariable[];
123
+ invalidRefs: PathTarget[];
124
+ }
125
+
126
+ export interface DiagnosticRule {
127
+ name: string;
128
+ condition: JsonValue | undefined;
129
+ assertions: DiagnosticRuleAssertion[];
130
+ }
131
+
132
+ export interface DiagnosticRuleAssertion {
133
+ assertExpr: JsonValue;
134
+ assertDescription?: string;
135
+ }
136
+
137
+ export interface DiagnosticTemplate {
138
+ formatVersion: string | undefined;
139
+ description: string | undefined;
140
+ transforms: string[];
141
+ rawTopLevelKeys: string[];
142
+ }
143
+
144
+ export interface EngineConfig {
145
+ customRules?: ExternalRuleSource[];
146
+ guardRules?: ExternalRuleSource[];
147
+ }
148
+
149
+ export interface ExternalRuleSource {
150
+ name: string;
151
+ content: string;
152
+ }
153
+
154
+ export interface ForEachExpansion {
155
+ propertyPath: string;
156
+ identifier: string;
157
+ collectionSource: string;
158
+ }
159
+
160
+ export interface GetAttRef {
161
+ resource: string;
162
+ attribute: string;
163
+ }
164
+
165
+ export interface IdRange {
166
+ prefix: string;
167
+ start: number;
168
+ end: number;
169
+ }
170
+
171
+ export interface IncomingRef {
172
+ source: string;
173
+ sourcePath: string;
174
+ kind: string;
175
+ attr?: string;
176
+ }
177
+
178
+ export interface MapEntry {
179
+ key: string;
180
+ value: ResolvedValue;
181
+ }
182
+
183
+ export interface OutgoingRef {
184
+ sourcePath: string;
185
+ target: string;
186
+ kind: string;
187
+ attr?: string;
188
+ conditionContext?: string;
189
+ }
190
+
191
+ export interface ParameterInfo {
192
+ paramType: string;
193
+ default: string | undefined;
194
+ allowedValues: string[] | undefined;
195
+ allowedPattern: string | undefined;
196
+ minLength: number | undefined;
197
+ maxLength: number | undefined;
198
+ minValue: number | undefined;
199
+ maxValue: number | undefined;
200
+ description: string | undefined;
201
+ noEcho: boolean;
202
+ }
203
+
204
+ export interface PathTarget {
205
+ path: string;
206
+ target: string;
207
+ }
208
+
209
+ export interface PathValuePair {
210
+ path: string;
211
+ value: string;
212
+ }
213
+
214
+ export interface PathVariable {
215
+ path: string;
216
+ variable: string;
217
+ }
218
+
219
+ export interface PerformanceMetrics {
220
+ schemaInit: PhaseMetric;
221
+ engineInit: PhaseMetric;
222
+ modelBuild: PhaseMetric;
223
+ schemaValidate: PhaseMetric;
224
+ ruleEvaluation: PhaseMetric;
225
+ diagnosticFinalize: PhaseMetric;
226
+ validateTotal: PhaseMetric;
227
+ }
228
+
229
+ export interface PhaseMetric {
230
+ durationMs: number;
231
+ }
232
+
233
+ export interface PseudoParameterOverrides {
234
+ accountId: string | undefined;
235
+ notificationArns: string | undefined;
236
+ partition: string | undefined;
237
+ region: string | undefined;
238
+ stackId: string | undefined;
239
+ stackName: string | undefined;
240
+ urlSuffix: string | undefined;
241
+ }
242
+
243
+ export interface ReferenceEdge {
244
+ source: string;
245
+ sourcePath: string;
246
+ target: string;
247
+ kind: string;
248
+ attr?: string;
249
+ conditionContext?: string;
250
+ }
251
+
252
+ export interface RelatedResource {
253
+ resource?: ResourceRef;
254
+ location?: SourceSpan;
255
+ message: string;
256
+ }
257
+
258
+ export interface ReportMetadata {
259
+ rulesEvaluated?: number;
260
+ resourcesScanned: number;
261
+ counts: Summary;
262
+ suppressed: number;
263
+ strict: boolean;
264
+ severityLevel: Severity;
265
+ }
266
+
267
+ export interface ResolutionSource {
268
+ resourceId: string;
269
+ propertyPath: string;
270
+ source: string;
271
+ }
272
+
273
+ export interface ResolvedOutput {
274
+ value: ResolvedValue;
275
+ description: string | undefined;
276
+ condition: string | undefined;
277
+ exportName: ResolvedValue | undefined;
278
+ }
279
+
280
+ export interface ResolvedResource {
281
+ logicalId: string;
282
+ resourceType: string;
283
+ condition: string | undefined;
284
+ dependsOn: string[];
285
+ deletionPolicy: ResolvedValue | undefined;
286
+ updateReplacePolicy: ResolvedValue | undefined;
287
+ updatePolicy: JsonValue | undefined;
288
+ creationPolicy: JsonValue | undefined;
289
+ metadata: JsonValue | undefined;
290
+ properties: Record<string, ResolvedValue>;
291
+ diagnostics: ResourceDiagnostics;
292
+ }
293
+
294
+ export interface ResourceDiagnostics {
295
+ findInMapRefs: string[];
296
+ simpleSubs: PathValuePair[];
297
+ redundantSubs: string[];
298
+ emptyJoins: string[];
299
+ conditionRefs: string[];
300
+ hardcodedPartitionArns: string[];
301
+ conditionallyNullProps: ConditionalNullEntry[];
302
+ foreachExpansions: ForEachExpansion[];
303
+ unsubstitutedVariables: PathValuePair[];
304
+ invalidRefs: PathValuePair[];
305
+ }
306
+
307
+ export interface ResourceIdFilter {
308
+ ruleId: string;
309
+ resourceId: string;
310
+ }
311
+
312
+ export interface ResourceRef {
313
+ id?: string;
314
+ resourceType?: string;
315
+ }
316
+
317
+ export interface ResourceTypeFilter {
318
+ ruleId: string;
319
+ resourceType: string;
320
+ }
321
+
322
+ export interface RuleFilterConfig {
323
+ ids?: string[];
324
+ categories?: string[];
325
+ idRanges?: IdRange[];
326
+ idPatterns?: string[];
327
+ resourceIds?: ResourceIdFilter[];
328
+ resourceTypes?: ResourceTypeFilter[];
329
+ }
330
+
331
+ export interface RuleInfo {
332
+ id: string;
333
+ severity: Severity;
334
+ category?: string;
335
+ description: string;
336
+ origin: RuleOrigin;
337
+ }
338
+
339
+ export interface SourceSpan {
340
+ startLine: number;
341
+ startColumn: number;
342
+ endLine: number;
343
+ endColumn: number;
344
+ }
345
+
346
+ export interface StandardDiagnostic {
347
+ ruleId: string;
348
+ severity: Severity;
349
+ message: string;
350
+ source: RuleOrigin;
351
+ resourceId?: string;
352
+ resourceType?: string;
353
+ propertyPath?: string;
354
+ suggestedFix?: string;
355
+ category?: string;
356
+ startLine?: number;
357
+ startColumn?: number;
358
+ endLine?: number;
359
+ endColumn?: number;
360
+ relatedResources?: RelatedResource[];
361
+ conditionScenario?: Record<string, boolean> | undefined;
362
+ }
363
+
364
+ export interface StandardReport {
365
+ filePath: string;
366
+ status: ReportStatus;
367
+ engineVersion: string;
368
+ metadata: ReportMetadata;
369
+ performance: PerformanceMetrics;
370
+ diagnostics: StandardDiagnostic[];
371
+ }
372
+
373
+ export interface Summary {
374
+ fatal: number;
375
+ errors: number;
376
+ warnings: number;
377
+ informational: number;
378
+ debug: number;
379
+ }
380
+
381
+ export interface ValidateConfig {
382
+ include?: RuleFilterConfig;
383
+ exclude?: RuleFilterConfig;
384
+ severityLevel?: Severity | undefined;
385
+ parameterOverrides?: Record<string, string> | undefined;
386
+ pseudoParameterOverrides?: PseudoParameterOverrides | undefined;
387
+ strict?: boolean | undefined;
388
+ includeEngineRules?: boolean | undefined;
389
+ }
390
+
391
+ export interface ViolationContext {
392
+ actualValue?: JsonValue | undefined;
393
+ expectedConstraint?: string;
394
+ property?: string;
395
+ lifecycle?: string;
396
+ resolutionSource?: string;
397
+ extra?: Record<string, JsonValue>;
398
+ }
399
+
400
+ export interface WasmSchemaValidationResult {
401
+ diagnostics: StandardDiagnostic[];
402
+ metric: PhaseMetric;
403
+ }
404
+
405
+ export type DetailLevel = 'STANDARD' | 'DETAILED';
406
+
407
+ export type EngineType = 'REGO' | 'CEL';
408
+
409
+ export type Phase = 'PARSE' | 'SCHEMA' | 'LINT';
410
+
411
+ export type RefKind = 'REF' | { GET_ATT: { attr: string } } | { SUB: { var: string } } | 'DEPENDS_ON';
412
+
413
+ export type ReportStatus = 'OK' | 'ERROR';
414
+
415
+ export type ResolvedValue =
416
+ | { Concrete: { value: JsonValue } }
417
+ | { List: { items: ResolvedValue[] } }
418
+ | { Map: { entries: MapEntry[] } }
419
+ | { Enum: { variants: ResolvedValue[] } }
420
+ | { Conditional: { condition: string; if_true: ResolvedValue; if_false: ResolvedValue } }
421
+ | { Reference: { target: string; kind: RefKind } }
422
+ | { Dynamic: { reason: string } }
423
+ | { TypedDynamic: { reason: string; param_type: string } };
424
+
425
+ export type RuleOrigin = 'SCHEMA' | 'CFN_LINT' | 'ENGINE' | 'CUSTOM' | 'GUARD';
426
+
427
+ export type Severity = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'FATAL';
428
+
429
+ export class WasmCelEngine {
430
+ free(): void;
431
+ [Symbol.dispose](): void;
432
+ engineName(): string;
433
+ listRules(): any;
434
+ constructor(config: EngineConfig);
435
+ validateDetailed(template: Uint8Array, options: ValidateConfig, file_path: string): any;
436
+ validateStandard(template: Uint8Array, options: ValidateConfig, file_path: string): any;
437
+ }
438
+
439
+ export class WasmRegoEngine {
440
+ free(): void;
441
+ [Symbol.dispose](): void;
442
+ engineName(): string;
443
+ listRules(): any;
444
+ constructor(config: EngineConfig);
445
+ validateDetailed(template: Uint8Array, options: ValidateConfig, file_path: string): any;
446
+ validateStandard(template: Uint8Array, options: ValidateConfig, file_path: string): any;
447
+ }
448
+
449
+ export class WasmSchemaValidator {
450
+ free(): void;
451
+ [Symbol.dispose](): void;
452
+ listRules(): any;
453
+ constructor();
454
+ schemaCount(): number;
455
+ validate(model: WasmSemanticModel, region: string): any;
456
+ }
457
+
458
+ export class WasmSemanticModel {
459
+ private constructor();
460
+ free(): void;
461
+ [Symbol.dispose](): void;
462
+ conditions(): any;
463
+ description(): string | undefined;
464
+ formatVersion(): string | undefined;
465
+ outputs(): any;
466
+ parameters(): any;
467
+ static parse(template: Uint8Array): WasmSemanticModel;
468
+ resources(): any;
469
+ sourceLocation(path: string): any;
470
+ toDiagnosticModel(): any;
471
+ transforms(): any;
472
+ }
473
+
474
+ export function init(): void;
475
+
476
+ export function version(): string;