@propulsionworks/cloudformation 0.0.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 ADDED
@@ -0,0 +1,3 @@
1
+ # @propulsionworks/cloudformation
2
+
3
+ In development.
@@ -0,0 +1,632 @@
1
+ import type { JsonPrimitive } from "./json.ts";
2
+
3
+ /**
4
+ * Branding symbol for {@link IntrinsicValue}.
5
+ */
6
+ export const IntrinsicValueType = Symbol.for(
7
+ "@propulsionworks/cloudformation/IntrinsicValueType",
8
+ );
9
+
10
+ /**
11
+ * Pseudo parameters are parameters that are predefined by AWS CloudFormation.
12
+ * You don't declare them in your template. Use them the same way as you would a
13
+ * parameter, as the argument for the Ref function.
14
+ */
15
+ export const PseudoParameters = [
16
+ "AWS::AccountId",
17
+ "AWS::NotificationARNs",
18
+ "AWS::NoValue",
19
+ "AWS::Partition",
20
+ "AWS::Region",
21
+ "AWS::StackId",
22
+ "AWS::StackName",
23
+ "AWS::URLSuffix",
24
+ ] as const;
25
+
26
+ /**
27
+ * Pseudo parameters are parameters that are predefined by AWS CloudFormation.
28
+ * You don't declare them in your template. Use them the same way as you would a
29
+ * parameter, as the argument for the Ref function.
30
+ */
31
+ export type PseudoParameter = (typeof PseudoParameters)[number];
32
+
33
+ /**
34
+ * Type brand for intrinsic functions returning the given type.
35
+ */
36
+ export type IntrinsicValue<T> = {
37
+ [IntrinsicValueType]: T;
38
+ };
39
+
40
+ type LogicFunction<ValueFn, LogicFn = never> =
41
+ | FnAnd<ValueFn, LogicFn>
42
+ | FnEquals<ValueFn>
43
+ | FnNot<ValueFn, LogicFn>
44
+ | FnOr<ValueFn, LogicFn>
45
+ | LogicFn;
46
+
47
+ /**
48
+ * Value functions which can be used within Condition definitions.
49
+ */
50
+ export type ConditionValueFunction = FnFindInMap | Ref;
51
+
52
+ /**
53
+ * Value functions which can be used with If functions.
54
+ */
55
+ export type IfValueFunction<Value> =
56
+ | (Value extends string ? FnBase64 | FnJoin | FnSub : never)
57
+ | (Value extends string[] ? FnGetAZs : never)
58
+ | FnFindInMap<Value>
59
+ | FnGetAtt<Value>
60
+ | FnIf<Value>
61
+ | FnSelect<Value>
62
+ | Ref<Value>;
63
+
64
+ /**
65
+ * You can use intrinsic functions, such as Fn::If, Fn::Equals, and Fn::Not, to
66
+ * conditionally create stack resources. These conditions are evaluated based on
67
+ * input parameters that you declare when you create or update a stack. After
68
+ * you define all your conditions, you can associate them with resources or
69
+ * resource properties in the Resources and Outputs sections of a template.
70
+ */
71
+ export type ConditionFunction = LogicFunction<ConditionValueFunction>;
72
+
73
+ /**
74
+ * An intrinsic function which returns the given value.
75
+ */
76
+ export type ValueFn<Value = unknown> =
77
+ | (Value extends string ? FnBase64 | FnJoin | FnSub : never)
78
+ | (Value extends readonly string[] ? FnCidr | FnGetAZs | FnSplit : never)
79
+ | (Value extends readonly (infer Element)[] ? ValueFn<Element>[] : never)
80
+ | FnFindInMap<Value>
81
+ | FnGetAtt<Value>
82
+ | FnIf<Value>
83
+ | FnImportValue<Value>
84
+ | FnSelect<Value>
85
+ | Ref<Value>;
86
+
87
+ /**
88
+ * Convert a value to accept intrinsic functions.
89
+ */
90
+ export type WithIntrinsics<Value> = Value extends object
91
+ ? { [K in keyof Value]: Value[K] | WithIntrinsics<Value[K]> }
92
+ : Value | ValueFn<Value>;
93
+
94
+ /**
95
+ * Condition functions for use in Rule conditions or assertions.
96
+ */
97
+ export type RuleConditionFunction =
98
+ | FnContains
99
+ | FnEachMemberEquals
100
+ | FnEachMemberIn;
101
+
102
+ /**
103
+ * String value functions which can be used with rules.
104
+ */
105
+ export type RuleValueFunction<Value = string | string[]> =
106
+ | (Value extends string[] ? FnRefAll | FnValueOfAll : never)
107
+ | FnValueOf<Value>
108
+ | Ref<Value>;
109
+
110
+ /**
111
+ * In the condition or assertions of a rule, you can use intrinsic functions,
112
+ * such as `Fn::Equals`, `Fn::Not`, and `Fn::RefAll`. The condition property
113
+ * determines if AWS CloudFormation applies the assertions. If the condition
114
+ * evaluates to true, CloudFormation evaluates the assertions to verify whether
115
+ * a parameter value is valid when a provisioned product is created or updated.
116
+ * If a parameter value isn't valid, CloudFormation doesn't create or update the
117
+ * stack. If the condition evaluates to false, CloudFormation doesn't check the
118
+ * parameter value and proceeds with the stack operation.
119
+ */
120
+ export type RuleFunction = LogicFunction<
121
+ RuleValueFunction,
122
+ RuleConditionFunction
123
+ >;
124
+
125
+ /**
126
+ * Returns true if all the specified conditions evaluate to true, or returns
127
+ * false if any one of the conditions evaluates to false. `Fn::And` acts as an
128
+ * AND operator. The minimum number of conditions that you can include is 2,
129
+ * and the maximum is 10.
130
+ *
131
+ * @param conditions A condition that evaluates to true or false.
132
+ *
133
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-and}
134
+ */
135
+ export type FnAnd<ValueFn = ConditionValueFunction, LogicFn = never> = {
136
+ "Fn::And": LogicFunction<ValueFn, LogicFn>[];
137
+ };
138
+
139
+ /**
140
+ * The intrinsic function `Fn::Base64` returns the Base64 representation of
141
+ * the input string. This function is typically used to pass encoded data to
142
+ * Amazon EC2 instances by way of the UserData property.
143
+ *
144
+ * @param valueToEncode The string value you want to convert to Base64.
145
+ * @returns The original string, in Base64 representation.
146
+ *
147
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-base64.html}
148
+ */
149
+ export type FnBase64 = {
150
+ [IntrinsicValueType]?: string;
151
+ "Fn::Base64": string | ValueFn<string>;
152
+ };
153
+
154
+ /**
155
+ * The intrinsic function `Fn::Cidr` returns an array of CIDR address blocks.
156
+ * The number of CIDR blocks returned is dependent on the count parameter.
157
+ *
158
+ * @param ipBlock The user-specified CIDR address block to be split into
159
+ * smaller CIDR blocks.
160
+ * @param count The number of CIDRs to generate. Valid range is between 1 and
161
+ * 256.
162
+ * @param cidrBits The number of subnet bits for the CIDR. For example,
163
+ * specifying a value "8" for this parameter will create a CIDR with a mask of
164
+ * "/24".
165
+ * @returns An array of CIDR address blocks.
166
+ *
167
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-cidr.html}
168
+ */
169
+ export type FnCidr = {
170
+ [IntrinsicValueType]?: string[];
171
+ "Fn::Cidr": [
172
+ ipBlock: string | FnSelect<string> | Ref<string>,
173
+ count: number | FnSelect<number> | Ref<number>,
174
+ cidrBits: number | FnSelect<number> | Ref<number>,
175
+ ];
176
+ };
177
+
178
+ /**
179
+ * The intrinsic function Condition returns the evaluated result of the
180
+ * specified condition.
181
+ *
182
+ * When you are declaring a condition in a template and you need to use another
183
+ * condition in the evaluation, you can use Condition to refer to that other
184
+ * condition. This is used when declaring a condition in the Conditions section
185
+ * of the template.
186
+ *
187
+ * @param name The name of the condition you want to reference.
188
+ *
189
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-condition.html}
190
+ */
191
+ export type FnCondition = {
192
+ Condition: string;
193
+ };
194
+
195
+ /**
196
+ * Returns `true` if a specified string matches at least one value in a list
197
+ * of strings.
198
+ *
199
+ * @param listOfStrings A list of strings, such as `"A", "B", "C"`.
200
+ * @param string A string, such as `"A"`, that you want to compare against a
201
+ * list of strings.
202
+ *
203
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html#fn-contains}
204
+ */
205
+ export type FnContains = {
206
+ "Fn::Contains": [
207
+ listOfStrings: string[] | RuleValueFunction<string[]>,
208
+ string: string | RuleValueFunction<string>,
209
+ ];
210
+ };
211
+
212
+ /**
213
+ * Returns `true` if a specified string matches all values in a list.
214
+ *
215
+ * @param listOfStrings A list of strings, such as `"A", "B", "C"`.
216
+ * @param string A string, such as `"A"`, that you want to compare against a
217
+ * list of strings.
218
+ *
219
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html#fn-eachmemberequals}
220
+ */
221
+ export type FnEachMemberEquals = {
222
+ "Fn::EachMemberEquals": [
223
+ listOfStrings: string[] | RuleValueFunction<string[]>,
224
+ string: string | RuleValueFunction<string>,
225
+ ];
226
+ };
227
+
228
+ /**
229
+ * Returns `true` if a specified string matches all values in a list.
230
+ *
231
+ * @param stringsToCheck A list of strings, such as `"A", "B", "C"`.
232
+ * CloudFormation checks whether each member in the stringsToC`heck parameter
233
+ * is in the `stringsToMap` parameter.
234
+ * @param stringsToMatch A list of strings, such as `"A", "B", "C"`. Each
235
+ * member in the `stringsToMatch` parameter is compared against the members of
236
+ * the `stringsToCheck` parameter.
237
+ *
238
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html#fn-eachmemberin}
239
+ */
240
+ export type FnEachMemberIn = {
241
+ "Fn::EachMemberIn": [
242
+ stringsToCheck: string[] | RuleValueFunction<string[]>,
243
+ stringsToMatch: string[] | RuleValueFunction<string[]>,
244
+ ];
245
+ };
246
+
247
+ /**
248
+ * Compares if two values are equal. Returns true if the two values are equal
249
+ * or false if they aren't.
250
+ *
251
+ * @param value1 A value of any primitive type that you want to compare.
252
+ * @param value2 A value of any primitive type that you want to compare.
253
+ *
254
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-equals}
255
+ */
256
+ export type FnEquals<ValueFn = ConditionValueFunction> = {
257
+ "Fn::Equals": [
258
+ value1: JsonPrimitive | ValueFn,
259
+ value2: JsonPrimitive | ValueFn,
260
+ ];
261
+ };
262
+
263
+ /**
264
+ * The intrinsic function `Fn::FindInMap` returns the value corresponding to
265
+ * keys in a two-level map that is declared in the Mappings section.
266
+ *
267
+ * @param mapName The logical name of a mapping declared in the Mappings
268
+ * section that contains the keys and values.
269
+ * @param topLevelKey The top-level key name. Its value is a list of key-value pairs.
270
+ * @param secondLevelKey The second-level key name, which is set to one of the keys from the list assigned to TopLevelKey.
271
+ * @returns The value that is assigned to SecondLevelKey.
272
+ *
273
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-findinmap.html}
274
+ */
275
+ export type FnFindInMap<Value = unknown> = {
276
+ [IntrinsicValueType]?: Value;
277
+ "Fn::FindInMap": [
278
+ mapName: string | FnFindInMap<string> | Ref<string>,
279
+ topLevelKey: string | FnFindInMap<string> | Ref<string>,
280
+ secondLevelKey: string | FnFindInMap<string> | Ref<string>,
281
+ ];
282
+ };
283
+
284
+ /**
285
+ * The `Fn::GetAtt` intrinsic function returns the value of an attribute from
286
+ * a resource in the template. For more information about GetAtt return values
287
+ * for a particular resource, refer to the documentation for that resource in
288
+ * the Resource and Property Reference.
289
+ *
290
+ * @param logicalNameOfResource The logical name (also called logical ID) of
291
+ * the resource that contains the attribute that you want.
292
+ * @param attributeName The name of the resource-specific attribute whose
293
+ * value you want. See the resource's reference page for details about the
294
+ * attributes available for that resource type.
295
+ * @returns The attribute value.
296
+ *
297
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html}
298
+ */
299
+ export type FnGetAtt<Value> = {
300
+ [IntrinsicValueType]?: Value;
301
+ "Fn::GetAtt": [
302
+ logicalResourceName: string,
303
+ attributeName: string | Ref<string>,
304
+ ];
305
+ };
306
+
307
+ /**
308
+ * The intrinsic function `Fn::GetAZs` returns an array that lists
309
+ * Availability Zones for a specified region. Because customers have access to
310
+ * different Availability Zones, the intrinsic function `Fn::GetAZs` enables
311
+ * template authors to write templates that adapt to the calling user's
312
+ * access. That way you don't have to hard-code a full list of Availability
313
+ * Zones for a specified region.
314
+ *
315
+ * @param region The name of the region for which you want to get the
316
+ * Availability Zones. You can use the AWS::Region pseudo parameter to
317
+ * specify the region in which the stack is created. Specifying an empty
318
+ * string is equivalent to specifying AWS::Region.
319
+ * @returns The list of Availability Zones for the region.
320
+ *
321
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getavailabilityzones.html}
322
+ */
323
+ export type FnGetAZs = {
324
+ [IntrinsicValueType]?: string[];
325
+ "Fn::GetAZs": string | Ref<string>;
326
+ };
327
+
328
+ /**
329
+ * Returns one value if the specified condition evaluates to true and another
330
+ * value if the specified condition evaluates to false. Currently, AWS
331
+ * CloudFormation supports the Fn::If intrinsic function in the metadata
332
+ * attribute, update policy attribute, and property values in the Resources
333
+ * section and Outputs sections of a template. You can use the `AWS::NoValue`
334
+ * pseudo parameter as a return value to remove the corresponding property.
335
+ *
336
+ * @param conditionName A reference to a condition in the Conditions section.
337
+ * Use the condition's name to reference it.
338
+ * @param valueIfTrue A value to be returned if the specified condition
339
+ * evaluates to true.
340
+ * @param valueIfFalse A value to be returned if the specified condition
341
+ * evaluates to false.
342
+ *
343
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-if}
344
+ */
345
+ export type FnIf<Value> = {
346
+ [IntrinsicValueType]?: Value;
347
+ "Fn::If": [
348
+ conditionName: string,
349
+ valueIfTrue: Value | IfValueFunction<Value>,
350
+ valueIfFalse: Value | IfValueFunction<Value>,
351
+ ];
352
+ };
353
+
354
+ /**
355
+ * The intrinsic function `Fn::ImportValue` returns the value of an output
356
+ * exported by another stack. You typically use this function to create
357
+ * cross-stack references. In the following example template snippets, Stack A
358
+ * exports VPC security group values and Stack B imports them.
359
+ *
360
+ * @param sharedValueToImport The stack output value that you want to import.
361
+ * @returns The stack output value.
362
+ *
363
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html}
364
+ */
365
+ export type FnImportValue<Value> = {
366
+ [IntrinsicValueType]?: Value;
367
+ "Fn::ImportValue":
368
+ | string
369
+ | FnBase64
370
+ | FnJoin
371
+ | FnSub
372
+ | FnFindInMap<string>
373
+ | FnIf<string>
374
+ | FnSelect<string>
375
+ | Ref<string>;
376
+ };
377
+
378
+ /**
379
+ * The intrinsic function `Fn::Join` appends a set of values into a single
380
+ * value, separated by the specified delimiter. If a delimiter is the empty
381
+ * string, the set of values are concatenated with no delimiter.
382
+ *
383
+ * @param delimiter The value you want to occur between fragments. The
384
+ * delimiter will occur between fragments only. It will not terminate the
385
+ * final value.
386
+ * @param listOfValues The list of values you want combined.
387
+ * @returns The combined string.
388
+ *
389
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-join.html}
390
+ */
391
+ export type FnJoin = {
392
+ [IntrinsicValueType]?: string;
393
+ "Fn::Join": [delimiter: string, listOfValues: FnJoinListValue];
394
+ };
395
+
396
+ /**
397
+ * Allowed functions in each element of the `listOfValues` parameter in
398
+ * {@link FnJoin}.
399
+ */
400
+ export type FnJoinListItemValue =
401
+ | string
402
+ | FnBase64
403
+ | FnFindInMap<string>
404
+ | FnGetAtt<string>
405
+ | FnIf<string>
406
+ | FnImportValue<string>
407
+ | FnSelect<string>
408
+ | Ref<string>;
409
+
410
+ /**
411
+ * Allowed functions in the `listOfValues` parameter in {@link FnJoin}.
412
+ */
413
+ export type FnJoinListValue =
414
+ | FnGetAZs
415
+ | FnFindInMap<string[]>
416
+ | FnGetAtt<string[]>
417
+ | FnIf<string[]>
418
+ | FnImportValue<string[]>
419
+ | FnSelect<string[]>
420
+ | FnSplit
421
+ | Ref<string[]>
422
+ | FnJoinListItemValue[];
423
+
424
+ /**
425
+ * Returns true for a condition that evaluates to false or returns false for a
426
+ * condition that evaluates to true. `Fn::Not` acts as a NOT operator.
427
+ *
428
+ * @param condition A condition such as `Fn::Equals` that evaluates to true or
429
+ * false.
430
+ *
431
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-not}
432
+ */
433
+ export type FnNot<ValueFn = ConditionValueFunction, LogicFn = never> = {
434
+ "Fn::Not": [condition: LogicFunction<ValueFn, LogicFn>];
435
+ };
436
+
437
+ /**
438
+ * Returns true if any one of the specified conditions evaluate to true, or
439
+ * returns false if all of the conditions evaluates to false. `Fn::Or` acts as
440
+ * an OR operator. The minimum number of conditions that you can include is 2,
441
+ * and the maximum is 10.
442
+ *
443
+ * @param conditions A condition that evaluates to true or false.
444
+ *
445
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-or}
446
+ */
447
+ export type FnOr<ValueFn = ConditionValueFunction, LogicFn = never> = {
448
+ "Fn::Or": LogicFunction<ValueFn, LogicFn>[];
449
+ };
450
+
451
+ /**
452
+ * The intrinsic function Ref returns the value of the specified parameter or
453
+ * resource.
454
+ *
455
+ * - When you specify a parameter's logical name, it returns the value of the
456
+ * parameter.
457
+ *
458
+ * - When you specify a resource's logical name, it returns a value that you
459
+ * can typically use to refer to that resource, such as a physical ID.
460
+ *
461
+ * When you are declaring a resource in a template and you need to specify
462
+ * another template resource by name, you can use the Ref to refer to that
463
+ * other resource. In general, Ref returns the name of the resource. For
464
+ * example, a reference to an AWS::AutoScaling::AutoScalingGroup returns the
465
+ * name of that Auto Scaling group resource.
466
+ *
467
+ * @param logicalName The logical name of the resource or parameter you want
468
+ * to dereference.
469
+ *
470
+ * @returns The physical ID of the resource or the value of the parameter.
471
+ *
472
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html}
473
+ */
474
+ export type Ref<Value = unknown> = {
475
+ [IntrinsicValueType]?: Value;
476
+ Ref: string;
477
+ };
478
+
479
+ /**
480
+ * Returns all values for a specified parameter type.
481
+ *
482
+ * @param parameterType An AWS-specific parameter type, such as
483
+ * `AWS::EC2::SecurityGroup::Id` or `AWS::EC2::VPC::Id`. For more information,
484
+ * see Parameters in the AWS CloudFormation User Guide.
485
+ *
486
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html#fn-refall}
487
+ */
488
+ export type FnRefAll = {
489
+ [IntrinsicValueType]?: string[];
490
+ "Fn::RefAll": string | RuleValueFunction<string>;
491
+ };
492
+
493
+ /**
494
+ * The intrinsic function `Fn::Select` returns a single object from a list of
495
+ * objects by index.
496
+ *
497
+ * @param index The index of the object to retrieve. This must be a value from
498
+ * zero to N-1, where N represents the number of elements in the array.
499
+ * @param listOfObjects The list of objects to select from. This list must not
500
+ * be null, nor can it have null entries.
501
+ * @returns The selected object.
502
+ *
503
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-select.html}
504
+ */
505
+ export type FnSelect<Value> = {
506
+ [IntrinsicValueType]?: Value;
507
+ "Fn::Select": [
508
+ index: number | Ref<number> | FnFindInMap<number>,
509
+ listOfObjects:
510
+ | Value[]
511
+ | (Value extends string[] ? FnGetAZs | FnSplit : never)
512
+ | FnFindInMap<Value[]>
513
+ | FnGetAtt<Value[]>
514
+ | Ref<Value[]>,
515
+ ];
516
+ };
517
+
518
+ /**
519
+ * To split a string into a list of string values so that you can select an
520
+ * element from the resulting string list, use the `Fn::Split` intrinsic
521
+ * function. Specify the location of splits with a delimiter, such as , (a
522
+ * comma). After you split a string, use the `Fn::Select` function to pick a
523
+ * specific element.
524
+ *
525
+ * @param delimiter A string value that determines where the source string is
526
+ * divided.
527
+ * @param sourceString The string value that you want to split.
528
+ * @returns A list of string values.
529
+ *
530
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-split.html}
531
+ */
532
+ export type FnSplit = {
533
+ [IntrinsicValueType]?: string[];
534
+ "Fn::Split": [delimiter: string, sourceString: string | ValueFn<string>];
535
+ };
536
+
537
+ /**
538
+ * The intrinsic function `Fn::Sub` substitutes variables in an input string
539
+ * with values that you specify. In your templates, you can use this function
540
+ * to construct commands or outputs that include values that aren't available
541
+ * until you create or update a stack.
542
+ *
543
+ * @param text A string with variables that AWS CloudFormation substitutes
544
+ * with their associated values at runtime. Write variables as `${MyVarName}`.
545
+ * Variables can be template parameter names, resource logical IDs,
546
+ * resource attributes, or a variable in a key-value map. If you specify only
547
+ * template parameter names, resource logical IDs, and resource attributes,
548
+ * don't specify a key-value map.
549
+ *
550
+ * If you specify template parameter names or resource logical IDs, such as
551
+ * `${InstanceTypeParameter}` AWS CloudFormation returns the same values as if
552
+ * you used the Ref intrinsic function. If you specify resource attributes,
553
+ * such as `${MyInstance.PublicIp}` AWS CloudFormation returns the same values
554
+ * as if you used the `Fn::GetAtt` intrinsic function.
555
+ *
556
+ * To write a dollar sign and curly braces (`${}`) literally, add an
557
+ * exclamation point (!) after the open curly brace, such as `${!Literal}`.
558
+ * AWS CloudFormation resolves this text as `${Literal}`.
559
+ *
560
+ * @param values A map of values that AWS CloudFormation substitutes for the
561
+ * associated variable names at runtime.
562
+ *
563
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html}
564
+ */
565
+ export type FnSub = {
566
+ [IntrinsicValueType]?: string;
567
+ "Fn::Sub": [text: string, values: Record<string, string | ValueFn<string>>];
568
+ };
569
+
570
+ /**
571
+ * Map of parameter type to attribute name to output type.
572
+ */
573
+ export type FnValueOfTypeMap = {
574
+ "AWS::EC2::VPC::Id": {
575
+ DefaultNetworkAcl: string;
576
+ DefaultSecurityGroup: string;
577
+ } & Record<`Tags.${string}`, string>;
578
+ "AWS::EC2::Subnet::Id": {
579
+ AvailabilityZone: string;
580
+ VpcId: string;
581
+ } & Record<`Tags.${string}`, string>;
582
+ "AWS::EC2::SecurityGroup::Id": Record<`Tags.${string}`, string>;
583
+ };
584
+
585
+ /**
586
+ * Supported attributes for {@link FnValueOf} and {@link FnValueOfAll}.
587
+ */
588
+ export type FnValueOfAttribute = {
589
+ [K in keyof FnValueOfTypeMap]: keyof FnValueOfTypeMap[K];
590
+ }[keyof FnValueOfTypeMap];
591
+
592
+ /**
593
+ * Supported parameter types for {@link FnValueOf} and {@link FnValueOfAll}.
594
+ */
595
+ export type FnValueOfType = keyof FnValueOfTypeMap;
596
+
597
+ /**
598
+ * Returns an attribute value or list of values for a specific parameter and
599
+ * attribute.
600
+ *
601
+ * @param parameterLogicalId The name of a parameter for which you want to
602
+ * retrieve attribute values. The parameter must be declared in the
603
+ * `Parameters` section of the template.
604
+ * @param attribute The name of an attribute from which you want to retrieve a
605
+ * value.
606
+ *
607
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html#fn-valueof}
608
+ */
609
+ export type FnValueOf<Value = string> = {
610
+ [IntrinsicValueType]?: Value;
611
+ "Fn::ValueOf": [parameterLogicalId: string, attribute: FnValueOfAttribute];
612
+ };
613
+
614
+ /**
615
+ * Returns a list of all attribute values for a given parameter type and
616
+ * attribute.
617
+ *
618
+ * @param parameterType An AWS-specific parameter type, such as
619
+ * `AWS::EC2::SecurityGroup::Id` or `AWS::EC2::VPC::Id`. For more information,
620
+ * see Parameters in the AWS CloudFormation User Guide.
621
+ * @param attribute The name of an attribute from which you want to retrieve a
622
+ * value.
623
+ *
624
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html#fn-valueofall}
625
+ */
626
+ export type FnValueOfAll = {
627
+ [IntrinsicValueType]?: string[];
628
+ "Fn::ValueOfAll": [
629
+ parameterType: FnValueOfType,
630
+ attribute: FnValueOfAttribute,
631
+ ];
632
+ };
@@ -0,0 +1,6 @@
1
+ export type JsonPrimitive = boolean | number | string | null;
2
+
3
+ export type JsonValue =
4
+ | JsonPrimitive
5
+ | JsonValue[]
6
+ | { [key: string]: JsonValue };