@awboost/cfntypes 1.0.0-beta.5 → 1.0.0-beta.50

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,351 @@
1
+ import { CreationPolicy, DeletionPolicy, UpdatePolicy } from "./policies.js";
2
+ import { ResourceType, ResourceTypes } from "./resources.generated.js";
3
+ import { IntrinsicValue, TemplateMap } from "./util.js";
4
+ /**
5
+ * The name of the resource output to be exported for a cross-stack reference.
6
+ *
7
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html | Outputs}
8
+ */
9
+ export interface OutputExport {
10
+ Name: string;
11
+ }
12
+ /**
13
+ * The optional `Outputs` section declares output values that you can import
14
+ * into other stacks (to create cross-stack references), return in response (to
15
+ * describe stack calls), or view on the AWS CloudFormation console. For
16
+ * example, you can output the S3 bucket name for a stack to make the bucket
17
+ * easier to find.
18
+ *
19
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html | Outputs}
20
+ */
21
+ export interface OutputDefinition {
22
+ /**
23
+ * A String type that describes the output value. The value for the
24
+ * description declaration must be a literal string that's between `0` and
25
+ * `1024` bytes in length. You can't use a parameter or function to specify
26
+ * the description. The description can be a maximum of 4 K in length.
27
+ */
28
+ Description?: string;
29
+ /**
30
+ * The name of the resource output to be exported for a cross-stack reference.
31
+ */
32
+ Export?: OutputExport;
33
+ /**
34
+ * The value of the property returned by the aws `cloudformation
35
+ * describe-stacks` command. The value of an output can include literals,
36
+ * parameter references, pseudo-parameters, a mapping value, or intrinsic
37
+ * functions.
38
+ */
39
+ Value: IntrinsicValue;
40
+ }
41
+ /**
42
+ * Parameters enable you to input custom values to your template each time you
43
+ * create or update a stack.
44
+ *
45
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#parameters-section-structure-properties | Parameters}
46
+ */
47
+ export interface ParameterDefinition {
48
+ /**
49
+ * A regular expression that represents the patterns to allow for String
50
+ * types. The pattern must match the entire parameter value provided.
51
+ */
52
+ AllowedPattern?: string;
53
+ /**
54
+ * An array containing the list of values allowed for the parameter.
55
+ */
56
+ AllowedValues?: string[];
57
+ /**
58
+ * A string that explains a constraint when the constraint is violated. For
59
+ * example, without a constraint description, a parameter that has an allowed
60
+ * pattern of `[A-Za-z0-9]+` displays the following error message when the
61
+ * user specifies an invalid value:
62
+ *
63
+ * > Malformed input-Parameter MyParameter must match pattern [A-Za-z0-9]+
64
+ *
65
+ * By adding a constraint description, such as must only contain letters
66
+ * (uppercase and lowercase) and numbers, you can display the following
67
+ * customized error message:
68
+ *
69
+ * > Malformed input-Parameter MyParameter must only contain uppercase and
70
+ * > lowercase letters and numbers
71
+ */
72
+ ConstraintDescription?: string;
73
+ /**
74
+ * A value of the appropriate type for the template to use if no value is
75
+ * specified when a stack is created. If you define constraints for the
76
+ * parameter, you must specify a value that adheres to those constraints.
77
+ */
78
+ Default?: string;
79
+ /**
80
+ * A string of up to 4000 characters that describes the parameter.
81
+ */
82
+ Description?: string;
83
+ /**
84
+ * An integer value that determines the largest number of characters you want
85
+ * to allow for `String` types.
86
+ */
87
+ MaxLength?: number;
88
+ /**
89
+ * A numeric value that determines the largest numeric value you want to allow
90
+ * for `Number` types.
91
+ */
92
+ MaxValue?: number;
93
+ /**
94
+ * An integer value that determines the smallest number of characters you want
95
+ * to allow for `String` types.
96
+ */
97
+ MinLength?: number;
98
+ /**
99
+ * A numeric value that determines the smallest numeric value you want to
100
+ * allow for `Number` types.
101
+ */
102
+ MinValue?: number;
103
+ /**
104
+ * Whether to mask the parameter value to prevent it from being displayed in
105
+ * the console, command line tools, or API. If you set the NoEcho attribute to
106
+ * true, CloudFormation returns the parameter value masked as asterisks
107
+ * `(*****)` for any calls that describe the stack or stack events, except for
108
+ * information stored in the locations specified below.
109
+ */
110
+ NoEcho?: boolean;
111
+ /**
112
+ * The data type for the parameter. See AWS documentation for
113
+ * more info.
114
+ *
115
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#parameters-section-structure-properties | Parameters}
116
+ */
117
+ Type: string;
118
+ }
119
+ /**
120
+ * Represents the additional options for a resource definition (other than
121
+ * `Type` and Properties.)
122
+ *
123
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html | AWS resource and property types reference}
124
+ */
125
+ export interface ResourceOptions {
126
+ /**
127
+ * The name of a condition to associate with the resource. The resource will
128
+ * only be created if the condition evaluates to true.
129
+ *
130
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html | Conditions}
131
+ */
132
+ Condition?: string;
133
+ /**
134
+ * Associate the `CreationPolicy` attribute with a resource to prevent its
135
+ * status from reaching create complete until AWS CloudFormation receives a
136
+ * specified number of success signals or the timeout period is exceeded. To
137
+ * signal a resource, you can use the `cfn-signal` helper script or
138
+ * [SignalResource
139
+ * API](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_SignalResource.html).
140
+ * CloudFormation publishes valid signals to the stack events so that you
141
+ * track the number of signals sent.
142
+ *
143
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html | CreationPolicy attribute}
144
+ */
145
+ CreationPolicy?: CreationPolicy;
146
+ /**
147
+ * With the `DeletionPolicy` attribute you can preserve, and in some cases,
148
+ * backup a resource when its stack is deleted. You specify a `DeletionPolicy`
149
+ * attribute for each resource that you want to control. If a resource has no
150
+ * `DeletionPolicy` attribute, AWS CloudFormation deletes the resource by
151
+ * default, except for:
152
+ *
153
+ * - For `AWS::RDS::DBCluster resources`, the default policy is `Snapshot`.
154
+ * - For `AWS::RDS::DBInstance` resources that don't specify the
155
+ * `DBClusterIdentifier` property, the default policy is `Snapshot`.
156
+ * - For Amazon S3 buckets, you must delete all objects in the bucket for
157
+ * deletion to succeed.
158
+ *
159
+ * This capability also applies to stack update operations that lead to
160
+ * resources being deleted from stacks. For example, if you remove the
161
+ * resource from the stack template, and then update the stack with the
162
+ * template. This capability doesn't apply to resources whose physical
163
+ * instance is replaced during stack update operations. For example, if you
164
+ * edit a resource's properties such that CloudFormation replaces that
165
+ * resource during a stack update.
166
+ *
167
+ * To keep a resource when its stack is deleted, specify Retain for that
168
+ * resource. You can use retain for any resource. For example, you can retain
169
+ * a nested stack, Amazon S3 bucket, or EC2 instance so that you can continue
170
+ * to use or modify those resources after you delete their stacks.
171
+ *
172
+ * For resources that support snapshots, such as `AWS::EC2::Volume`, specify
173
+ * Snapshot to have CloudFormation create a snapshot before deleting the
174
+ * resource.
175
+ *
176
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html | DeletionPolicy attribute}
177
+ */
178
+ DeletionPolicy?: DeletionPolicy;
179
+ /**
180
+ * With the `DependsOn` attribute you can specify that the creation of a
181
+ * specific resource follows another. When you add a `DependsOn` attribute to
182
+ * a resource, that resource is created only after the creation of the
183
+ * resource specified in the `DependsOn` attribute.
184
+ *
185
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html | DependsOn attribute}
186
+ */
187
+ DependsOn?: string[];
188
+ /**
189
+ * The metadata attribute enables you to associate structured data with a
190
+ * resource. By adding a metadata attribute to a resource, you can add data in
191
+ * JSON or YAML to the resource declaration. In addition, you can use
192
+ * intrinsic functions (such as `GetAtt` and `Ref`), parameters, and pseudo
193
+ * parameters within the metadata attribute to add those interpreted values.
194
+ *
195
+ * AWS CloudFormation doesn't validate the syntax within the metadata
196
+ * attribute.
197
+ *
198
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html | Metadata attribute}
199
+ */
200
+ Metadata?: TemplateMap<IntrinsicValue>;
201
+ /**
202
+ * Use the `UpdatePolicy` attribute to specify how AWS CloudFormation handles
203
+ * updates to the `AWS::AppStream::Fleet`,
204
+ * `AWS::AutoScaling::AutoScalingGroup`, `AWS::ElastiCache::ReplicationGroup`,
205
+ * `AWS::OpenSearchService::Domain`, `AWS::Elasticsearch::Domain`, or
206
+ * `AWS::Lambda::Alias resources`.
207
+ *
208
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html | UpdatePolicy attribute}
209
+ */
210
+ UpdatePolicy?: UpdatePolicy;
211
+ /**
212
+ * Use the UpdateReplacePolicy attribute to retain or, in some cases, backup
213
+ * the existing physical instance of a resource when it's replaced during a
214
+ * stack update operation.
215
+ *
216
+ * When you initiate a stack update, AWS CloudFormation updates resources
217
+ * based on differences between what you submit and the stack's current
218
+ * template and parameters. If you update a resource property that requires
219
+ * that the resource be replaced, CloudFormation recreates the resource during
220
+ * the update. Recreating the resource generates a new physical ID.
221
+ * CloudFormation creates the replacement resource first, and then changes
222
+ * references from other dependent resources to point to the replacement
223
+ * resource. By default, CloudFormation then deletes the old resource. Using
224
+ * the `UpdateReplacePolicy`, you can specify that CloudFormation retain or,
225
+ * in some cases, create a snapshot of the old resource.
226
+ *
227
+ * For resources that support snapshots, such as `AWS::EC2::Volume`, specify
228
+ * Snapshot to have CloudFormation create a snapshot before deleting the old
229
+ * resource instance.
230
+ *
231
+ * You can apply the `UpdateReplacePolicy` attribute to any resource.
232
+ * `UpdateReplacePolicy` is only executed if you update a resource property
233
+ * whose update behavior is specified as Replacement, thereby causing
234
+ * CloudFormation to replace the old resource with a new one with a new
235
+ * physical ID. For example, if you update the Engine property of an
236
+ * `AWS::RDS::DBInstance` resource type, CloudFormation creates a new resource
237
+ * and replaces the current DB instance resource with the new one. The
238
+ * `UpdateReplacePolicy` attribute would then dictate whether CloudFormation
239
+ * deleted, retained, or created a snapshot of the old DB instance. The update
240
+ * behavior for each property of a resource is specified in the reference
241
+ * topic for that resource in the AWS resource and property types reference.
242
+ * For more information on resource update behavior, see Update behaviors of
243
+ * stack resources.
244
+ *
245
+ * The `UpdateReplacePolicy` attribute applies to stack updates you perform
246
+ * directly, in addition to stack updates performed using change sets.
247
+ *
248
+ * `UpdateReplacePolicy` differs from the `DeletionPolicy` attribute in that
249
+ * it only applies to resources replaced during stack updates. Use
250
+ * `DeletionPolicy` for resources deleted when a stack is deleted, or when the
251
+ * resource definition itself is deleted from the template as part of a stack
252
+ * update.
253
+ *
254
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html | UpdateReplacePolicy attribute}
255
+ */
256
+ UpdateReplacePolicy?: DeletionPolicy;
257
+ }
258
+ /**
259
+ * The required `Resources` section declares the AWS resources that you want to
260
+ * include in the stack, such as an Amazon EC2 instance or an Amazon S3 bucket.
261
+ *
262
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html | AWS resource and property types reference}
263
+ */
264
+ export interface ResourceDefinitionBase<P = unknown, T = string> extends ResourceOptions {
265
+ /**
266
+ * Resource properties are additional options that you can specify for a
267
+ * resource.
268
+ *
269
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html | AWS resource and property types reference}
270
+ */
271
+ Properties: P;
272
+ /**
273
+ * The resource type identifies the type of resource that you are declaring.
274
+ * For example, `AWS::EC2::Instance` declares an EC2 instance.
275
+ *
276
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html | AWS resource and property types reference}
277
+ */
278
+ Type: T;
279
+ }
280
+ /**
281
+ * Represents a built-in AWS resource definition.
282
+ */
283
+ export type AwsResourceDefinitionType<T extends ResourceType> = ResourceDefinitionBase<ResourceTypes[T], T>;
284
+ /**
285
+ * Represents the set of all resource definition types.
286
+ */
287
+ export type AwsResourceDefinition = {
288
+ [K in ResourceType]: AwsResourceDefinitionType<K>;
289
+ }[ResourceType];
290
+ /**
291
+ * The base type of custom resource properties. All custom resource defintions
292
+ * must specify a `ServiceToken`, which is the ARN of the Lambda function or SNS
293
+ * topic which handles this custom resource.
294
+ */
295
+ export interface CustomResourcePropertiesBase {
296
+ ServiceToken: string;
297
+ }
298
+ /**
299
+ * Represents the type of a custom resource.
300
+ */
301
+ export type CustomResourceType<T extends string = string> = `Custom::${T}`;
302
+ /**
303
+ * Represents a custom resource definition.
304
+ */
305
+ export type CustomResourceDefinition<P extends CustomResourcePropertiesBase = CustomResourcePropertiesBase, T extends string = string> = ResourceDefinitionBase<P, CustomResourceType<T>>;
306
+ /**
307
+ * Represents an AWS or custom resource definition.
308
+ */
309
+ export type ResourceDefinition = AwsResourceDefinition | CustomResourceDefinition;
310
+ /**
311
+ * Definition for a rule assertion.
312
+ *
313
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/rules-section-structure.html#template-constraint-rules-syntax | Rules syntax}
314
+ */
315
+ export interface RuleAssertion {
316
+ /**
317
+ * Rule-specific intrinsic function.
318
+ *
319
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/rules-section-structure.html#rules-specific-intrinsic-section-structure | Rule-specific intrinsic functions
320
+ }
321
+ */
322
+ Assert: IntrinsicValue;
323
+ /**
324
+ * Information about this assert.
325
+ */
326
+ AssertDescription?: string;
327
+ }
328
+ /**
329
+ * Each template rule consists of two properties:
330
+ *
331
+ * - Rule condition (optional) — determines when a rule takes effect.
332
+ * - Assertions (required) — describes what values users can specify for a
333
+ * particular parameter.
334
+ *
335
+ * A rule can include a `RuleCondition` property and must include an Assertions
336
+ * property. For each rule, you can define only one rule condition. You can
337
+ * define one or more asserts within the `Assertions` property. If you don't
338
+ * define a rule condition, the rule's assertions always take effect.
339
+ *
340
+ * @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/rules-section-structure.html#w2ab1c23c15c19b5 | Working with rules}
341
+ */
342
+ export interface RuleDefinition {
343
+ /**
344
+ * Describes what values users can specify for a particular parameter.
345
+ */
346
+ Assertions: RuleAssertion[];
347
+ /**
348
+ * Determines when a rule takes effect.
349
+ */
350
+ RuleCondition?: IntrinsicValue;
351
+ }
@@ -0,0 +1 @@
1
+ export {};