@kensio/yulin 1.21.6 → 1.21.8
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 +22 -2
- package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-creator.js +1 -0
- package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.d.ts +4 -0
- package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.js +26 -1
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-creator.js +3 -1
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-properties.d.ts +0 -7
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-properties.js +0 -20
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-unsimulated-properties.d.ts +13 -0
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-unsimulated-properties.js +59 -0
- package/dist/service/eventbridge/cfn/sim-cfn-event-bridge-resource-error.d.ts +1 -1
- package/dist/service/eventbridge/cfn/sim-cfn-event-bridge-resource-error.js +1 -1
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-properties.js +1 -1
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.d.ts +3 -2
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.js +25 -3
- package/dist/service/ses/command/authorize/sim-ses-authorizer.d.ts +9 -0
- package/dist/service/ses/command/authorize/sim-ses-authorizer.js +18 -2
- package/dist/service/ses/command/send/sim-ses-send-email.js +2 -1
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-creator.js +1 -0
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-properties.d.ts +9 -4
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-properties.js +18 -6
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-property-names.d.ts +10 -0
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-property-names.js +16 -1
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-creator.js +1 -1
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.d.ts +11 -6
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.js +18 -9
- package/docs/README.md +40 -4
- package/docs/ai-skill/README.md +57 -54
- package/docs/cli/README.md +84 -94
- package/docs/factories/README.md +42 -54
- package/docs/lint/README.md +41 -67
- package/docs/non-aws-dependencies/README.md +72 -168
- package/docs/sdk/README.md +109 -95
- package/docs/serve/README.md +192 -898
- package/docs/services/acm/README.md +24 -40
- package/docs/services/apigateway/README.md +52 -71
- package/docs/services/apigatewayv2/README.md +55 -74
- package/docs/services/athena/README.md +17 -26
- package/docs/services/backup/README.md +29 -39
- package/docs/services/bedrock/README.md +38 -52
- package/docs/services/cloudformation/README.md +43 -55
- package/docs/services/cloudfront/README.md +69 -95
- package/docs/services/cloudwatch/README.md +40 -54
- package/docs/services/cognito/README.md +30 -45
- package/docs/services/dynamodb/README.md +34 -51
- package/docs/services/ecr/README.md +36 -77
- package/docs/services/ecs/README.md +26 -46
- package/docs/services/elbv2/README.md +19 -29
- package/docs/services/eventbridge/README.md +24 -20
- package/docs/services/firehose/README.md +24 -32
- package/docs/services/glue/README.md +41 -78
- package/docs/services/iam/README.md +13 -15
- package/docs/services/kinesis/README.md +53 -93
- package/docs/services/kms/README.md +22 -32
- package/docs/services/lambda/README.md +60 -80
- package/docs/services/logs/README.md +41 -50
- package/docs/services/organizations/README.md +50 -85
- package/docs/services/personalize/README.md +28 -44
- package/docs/services/rekognition/README.md +26 -38
- package/docs/services/route53/README.md +17 -17
- package/docs/services/s3/README.md +47 -51
- package/docs/services/scheduler/README.md +41 -52
- package/docs/services/secretsmanager/README.md +27 -42
- package/docs/services/ses/README.md +24 -34
- package/docs/services/sns/README.md +31 -33
- package/docs/services/sqs/README.md +14 -14
- package/docs/services/ssm/README.md +19 -21
- package/docs/services/stepfunctions/README.md +18 -20
- package/docs/services/sts/README.md +32 -45
- package/docs/services/wafv2/README.md +12 -17
- package/docs/terraform/README.md +108 -126
- package/docs/testing/README.md +228 -0
- package/docs/time/README.md +87 -117
- package/llms.txt +2 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Simulated Bedrock
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Yulin answers Bedrock Runtime requests from response rules declared by the test. Model responses
|
|
4
|
+
come entirely from those rules.
|
|
5
5
|
|
|
6
6
|
Bedrock-specific types are imported from the `@kensio/yulin/bedrock` subpath.
|
|
7
7
|
|
|
8
8
|
## Answering a conversation
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Declare a response with `onPrompt`, then call `converse`. The prompt is the text of the last user
|
|
11
|
+
message.
|
|
12
12
|
|
|
13
13
|
```typescript sim-bedrock-converse
|
|
14
14
|
/**
|
|
@@ -37,13 +37,12 @@ console.log(answered.output.message.content.at(0)?.text);
|
|
|
37
37
|
console.log(answered.stopReason); // "end_turn"
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
A conversation
|
|
41
|
-
conversation grows.
|
|
40
|
+
A multi-turn conversation also matches its last user message.
|
|
42
41
|
|
|
43
42
|
## Answering every call to one model
|
|
44
43
|
|
|
45
|
-
`onModel`
|
|
46
|
-
|
|
44
|
+
Use `onModel` when every call to one model should receive the same response. Prompt rules take
|
|
45
|
+
precedence over model rules.
|
|
47
46
|
|
|
48
47
|
```typescript sim-bedrock-model-rule
|
|
49
48
|
/**
|
|
@@ -71,13 +70,13 @@ const answered = await simAws.bedrock().converse(
|
|
|
71
70
|
console.log(answered.output.message.content.at(0)?.text); // "A short summary."
|
|
72
71
|
```
|
|
73
72
|
|
|
74
|
-
`byDefault`
|
|
75
|
-
built-in
|
|
73
|
+
`byDefault` handles calls that match no prompt or model rule. With no matching declaration, Yulin
|
|
74
|
+
returns a built-in simulated response for `Converse`.
|
|
76
75
|
|
|
77
76
|
## Answering with a tool call
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
Declare a `toolUse` content block to test code that handles model tool calls. The default stop reason
|
|
79
|
+
for this response is `tool_use`.
|
|
81
80
|
|
|
82
81
|
```typescript sim-bedrock-tool-use
|
|
83
82
|
/**
|
|
@@ -119,8 +118,8 @@ console.log(answered.output.message.content.at(0)?.toolUse?.name);
|
|
|
119
118
|
|
|
120
119
|
## Streaming a conversation
|
|
121
120
|
|
|
122
|
-
`ConverseStream`
|
|
123
|
-
|
|
121
|
+
`ConverseStream` uses the same rules as `Converse`. Declare `chunks` to control the text in each
|
|
122
|
+
stream event.
|
|
124
123
|
|
|
125
124
|
```typescript sim-bedrock-converse-stream
|
|
126
125
|
/**
|
|
@@ -156,14 +155,11 @@ for await (const event of answered.stream) {
|
|
|
156
155
|
console.log(accumulated); // "Entry 1042 covers the tone sandhi rules."
|
|
157
156
|
```
|
|
158
157
|
|
|
159
|
-
The
|
|
160
|
-
|
|
161
|
-
`metadata` carrying the token counts. A tool call adds a `contentBlockStart` before its delta,
|
|
162
|
-
carrying the tool use id and name.
|
|
158
|
+
The stream contains `messageStart`, content block events, `messageStop` and `metadata`. Tool calls
|
|
159
|
+
also include `contentBlockStart` with the tool use ID and name.
|
|
163
160
|
|
|
164
|
-
The same declaration serves both APIs. `Converse`
|
|
165
|
-
|
|
166
|
-
raises.
|
|
161
|
+
The same declaration serves both APIs. `Converse` joins declared chunks. Plain `text` becomes one
|
|
162
|
+
stream delta. A stream can be read once.
|
|
167
163
|
|
|
168
164
|
`InvokeModelWithResponseStream` streams the declared body as a single `chunk`:
|
|
169
165
|
|
|
@@ -175,8 +171,8 @@ for await (const event of answered.body) {
|
|
|
175
171
|
|
|
176
172
|
## Invoking a model directly
|
|
177
173
|
|
|
178
|
-
`InvokeModel`
|
|
179
|
-
|
|
174
|
+
`InvokeModel` returns the declared `body` as JSON. The response shape depends on the model, so this
|
|
175
|
+
operation has no built-in body.
|
|
180
176
|
|
|
181
177
|
```typescript sim-bedrock-invoke-model
|
|
182
178
|
/**
|
|
@@ -207,12 +203,11 @@ console.log(JSON.parse(new TextDecoder().decode(answered.body)));
|
|
|
207
203
|
// { results: [ { outputText: "Entry 1042 covers tone sandhi." } ] }
|
|
208
204
|
```
|
|
209
205
|
|
|
210
|
-
|
|
211
|
-
usually the one to reach for.
|
|
206
|
+
Prompt rules match the UTF-8 request body. Model rules are usually simpler for this API.
|
|
212
207
|
|
|
213
208
|
## Reporting token counts
|
|
214
209
|
|
|
215
|
-
`usage`
|
|
210
|
+
Set `usage` on a response rule to control token counts. Yulin uses fixed counts when it is omitted.
|
|
216
211
|
|
|
217
212
|
```typescript sim-bedrock-usage
|
|
218
213
|
/**
|
|
@@ -245,14 +240,13 @@ console.log(answered.usage.totalTokens); // 1620
|
|
|
245
240
|
|
|
246
241
|
## Authorizing an invocation
|
|
247
242
|
|
|
248
|
-
|
|
249
|
-
foundation model ARN
|
|
250
|
-
provisioned model ARN is authorized against as it was written.
|
|
243
|
+
Every invocation authorizes `bedrock:InvokeModel` against the requested model. A base model ID is
|
|
244
|
+
converted to a foundation model ARN in the request Region. Model ARNs are used unchanged.
|
|
251
245
|
|
|
252
246
|
## SDK interception
|
|
253
247
|
|
|
254
|
-
|
|
255
|
-
|
|
248
|
+
Intercept a `BedrockRuntimeClient` when application code constructs the client itself. Client
|
|
249
|
+
credentials and Region select the simulated scope.
|
|
256
250
|
|
|
257
251
|
```typescript sim-bedrock-sdk-interception
|
|
258
252
|
/**
|
|
@@ -296,32 +290,26 @@ simSdk.restoreAll();
|
|
|
296
290
|
|
|
297
291
|
- `Converse`, `ConverseStream`, `InvokeModel` and `InvokeModelWithResponseStream`, through
|
|
298
292
|
`simAws.bedrock()` and through an intercepted `BedrockRuntimeClient`.
|
|
299
|
-
- Responses declared with `onPrompt`, `onModel` and `byDefault
|
|
300
|
-
rule, then the default.
|
|
293
|
+
- Responses declared with `onPrompt`, `onModel` and `byDefault`, in that precedence order.
|
|
301
294
|
- A declared response carries `text`, `chunks` or `content` blocks for `Converse`, a `body` for
|
|
302
295
|
`InvokeModel`, and optionally a `stopReason` and a `usage`.
|
|
303
|
-
- Streamed responses
|
|
304
|
-
streaming and non-streaming APIs alike.
|
|
296
|
+
- Streamed responses with caller-controlled chunks.
|
|
305
297
|
- Tool calls, as a declared `toolUse` content block.
|
|
306
298
|
- IAM authorization of `bedrock:InvokeModel` against the foundation model, inference profile or
|
|
307
299
|
provisioned model ARN the request names.
|
|
308
|
-
- Rules
|
|
300
|
+
- Rules scoped by account and Region.
|
|
309
301
|
|
|
310
302
|
## Limitations
|
|
311
303
|
|
|
312
|
-
- No model runs.
|
|
313
|
-
a key to match on.
|
|
304
|
+
- No model runs. Yulin returns the matching declared response.
|
|
314
305
|
- Every event of a stream is ready as soon as the call returns. Real Bedrock sends them as the model
|
|
315
306
|
generates them. No simulated clock advance separates them here.
|
|
316
|
-
- A response is split
|
|
317
|
-
arrives in one delta. The split a real model streams comes from its own tokenizer.
|
|
307
|
+
- A response is split only at declared chunk boundaries. Other text arrives in one delta.
|
|
318
308
|
- A streamed tool call sends its arguments in one delta. Real `ConverseStream` sends them as
|
|
319
309
|
fragments of JSON to be concatenated. A tool call with no declared arguments sends `{}`.
|
|
320
310
|
- `InvokeModelWithResponseStream` sends the declared body as a single chunk. Real Bedrock sends a
|
|
321
311
|
chunk per generated fragment, in the shape the model behind the id uses.
|
|
322
|
-
-
|
|
323
|
-
the AWS JSON protocol services. A function bundling its own SDK reaches Bedrock through module
|
|
324
|
-
interception. S3 and every other non-JSON-protocol service are reached the same way.
|
|
312
|
+
- Serialized Bedrock requests are unsupported. Use SDK interception.
|
|
325
313
|
- The Bedrock control plane is unsimulated. `ListFoundationModels`, guardrail management, inference
|
|
326
314
|
profile management and provisioned throughput all belong to `BedrockClient`.
|
|
327
315
|
- Bedrock Agents and knowledge bases are unsimulated. `InvokeAgent`, `Retrieve` and
|
|
@@ -329,22 +317,20 @@ simSdk.restoreAll();
|
|
|
329
317
|
- `ApplyGuardrail` is unsimulated, and a `guardrailConfig` or a `guardrailIdentifier` on an
|
|
330
318
|
invocation is refused outright. Answering without the guardrail would make one look applied here
|
|
331
319
|
and be applied in production.
|
|
332
|
-
- `system`, `inferenceConfig`, `toolConfig` and `additionalModelRequestFields` are accepted and
|
|
333
|
-
|
|
320
|
+
- `system`, `inferenceConfig`, `toolConfig` and `additionalModelRequestFields` are accepted and have
|
|
321
|
+
no effect. `maxTokens` truncates no declared response, and a `toolConfig` naming no tools
|
|
334
322
|
still gets a declared tool call.
|
|
335
323
|
- Token counts are fixed unless the declaration carries them. Counting them needs the tokenizer of
|
|
336
324
|
the model the request names. Declare a `usage` where the code under test meters spend.
|
|
337
325
|
- `metrics.latencyMs` is always zero. No time passes during an invocation.
|
|
338
326
|
- A `Converse` with no messages is refused. Real Bedrock accepts one where the `modelId` names a
|
|
339
327
|
prompt version from Prompt management, which is unsimulated.
|
|
340
|
-
-
|
|
341
|
-
be failing closed against Yulin's own gaps.
|
|
328
|
+
- Any model ID is accepted.
|
|
342
329
|
- `InvokeModel` has no built-in default response body, and an invocation matching a rule that
|
|
343
330
|
declares none is refused. A response body is model-specific, and one family's shape served for
|
|
344
331
|
every other one would parse into something the caller cannot read.
|
|
345
|
-
- An `InvokeModel` body
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
does not fall back to the default.
|
|
332
|
+
- An `InvokeModel` body supplied as a stream or `Blob` cannot match a prompt rule. It may still match
|
|
333
|
+
a model or default rule.
|
|
334
|
+
- A `Converse` call matching a response declared only as a body is refused for the same reason. The
|
|
335
|
+
matching rule prevents the default rule from being selected.
|
|
350
336
|
- There are no CloudFormation resource types for Bedrock, and Bedrock is absent from `serveSimAws`.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# Simulated CloudFormation
|
|
2
2
|
|
|
3
|
-
Yulin
|
|
4
|
-
|
|
5
|
-
SDK-style `CreateStackCommand` calls, or synthesized CDK template files.
|
|
3
|
+
Yulin deploys CloudFormation templates into a simulated AWS environment. It accepts inline
|
|
4
|
+
templates, AWS SDK command inputs, template files and synthesized CDK cloud assemblies.
|
|
6
5
|
|
|
7
6
|
## Basic usage
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
Call `deployTemplate(...)` with a template and wait for the stack to finish deploying.
|
|
10
9
|
|
|
11
10
|
```typescript sim-cloudformation-basic-template
|
|
12
11
|
/**
|
|
@@ -84,7 +83,7 @@ console.log(simAws.s3().getSimBucketByName("typed-site-bucket")?.bucketName);
|
|
|
84
83
|
|
|
85
84
|
## Creating stacks with AWS SDK command shapes
|
|
86
85
|
|
|
87
|
-
|
|
86
|
+
Use `createStack(...)` when the code under test works with AWS SDK command shapes.
|
|
88
87
|
|
|
89
88
|
```typescript sim-cloudformation-create-stack-command
|
|
90
89
|
/**
|
|
@@ -263,11 +262,9 @@ await simAws.backgroundTasksComplete();
|
|
|
263
262
|
|
|
264
263
|
## Updating a stack
|
|
265
264
|
|
|
266
|
-
`UpdateStackCommand` applies a changed template to
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
anywhere else. That is what lets a long-running local process pick up an infrastructure change
|
|
270
|
-
without restarting and losing its data.
|
|
265
|
+
`UpdateStackCommand` applies a changed template to an existing stack. It creates added resources,
|
|
266
|
+
deletes removed resources and replaces changed resources. Unchanged resources keep their simulated
|
|
267
|
+
state.
|
|
271
268
|
|
|
272
269
|
```typescript sim-cloudformation-update-stack
|
|
273
270
|
/**
|
|
@@ -352,11 +349,9 @@ could mean nothing else.
|
|
|
352
349
|
|
|
353
350
|
### What counts as a change
|
|
354
351
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
template body is compared as written. A change to a section the simulator ignores, such as
|
|
359
|
-
`Description`, is still an update.
|
|
352
|
+
Yulin compares resolved resources and outputs. Changing a parameter can therefore change a resource
|
|
353
|
+
without changing the template body. Reordering an unchanged template has no effect. Other template
|
|
354
|
+
sections are compared as written, including ignored sections such as `Description`.
|
|
360
355
|
|
|
361
356
|
A template that changes nothing at all is refused with a `ValidationError` reading
|
|
362
357
|
`No updates are to be performed.`, the same answer CloudFormation gives. So is an update asked for
|
|
@@ -436,12 +431,11 @@ An update from the held template with the deployed values changes nothing, and i
|
|
|
436
431
|
|
|
437
432
|
### Changed resources are replaced
|
|
438
433
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
it would keep them. In-place update is the obvious next step, still to be built.
|
|
434
|
+
Yulin replaces a resource when its resolved template entry changes. It deletes the old resource and
|
|
435
|
+
creates a new one. AWS updates many properties in place. A simulated bucket therefore loses its
|
|
436
|
+
objects when a property change replaces it.
|
|
443
437
|
|
|
444
|
-
|
|
438
|
+
Replacement also affects dependencies and retention policies:
|
|
445
439
|
|
|
446
440
|
- A resource naming a replaced resource is replaced too, all the way up the dependency chain, and
|
|
447
441
|
nothing is left pointing at a resource that has gone. Real CloudFormation hands the dependent the
|
|
@@ -618,9 +612,8 @@ to create. Name the replacement in the template, as the example above does, to h
|
|
|
618
612
|
|
|
619
613
|
## Deploying through a change set
|
|
620
614
|
|
|
621
|
-
A change set
|
|
622
|
-
|
|
623
|
-
touch. Simulated CloudFormation serves `CreateChangeSetCommand`, `DescribeChangeSetCommand`,
|
|
615
|
+
A change set describes a proposed stack operation without applying it. Simulated CloudFormation
|
|
616
|
+
serves `CreateChangeSetCommand`, `DescribeChangeSetCommand`,
|
|
624
617
|
`ExecuteChangeSetCommand`, `DeleteChangeSetCommand` and `ListChangeSetsCommand`.
|
|
625
618
|
|
|
626
619
|
```typescript sim-cloudformation-change-set
|
|
@@ -735,8 +728,7 @@ holds, in the order they were created.
|
|
|
735
728
|
|
|
736
729
|
## Deleting a stack
|
|
737
730
|
|
|
738
|
-
`DeleteStackCommand` deletes
|
|
739
|
-
created in, and then releases the stack name.
|
|
731
|
+
`DeleteStackCommand` deletes resources in reverse creation order, then releases the stack name.
|
|
740
732
|
|
|
741
733
|
```typescript sim-cloudformation-delete-stack
|
|
742
734
|
/**
|
|
@@ -801,9 +793,8 @@ Deleting a stack name that was never deployed succeeds, as it does in CloudForma
|
|
|
801
793
|
|
|
802
794
|
### When a resource cannot be deleted
|
|
803
795
|
|
|
804
|
-
|
|
805
|
-
the
|
|
806
|
-
ships an `autoDeleteObjects` custom resource.
|
|
796
|
+
Resource deletion can fail. For example, S3 refuses to delete a non-empty bucket. CloudFormation
|
|
797
|
+
leaves the stack in `DELETE_FAILED` and does not empty the bucket automatically.
|
|
807
798
|
|
|
808
799
|
A refusal leaves the stack in `DELETE_FAILED` with the reason on it, and keeps the stack name in use.
|
|
809
800
|
`waitForStackDeleteComplete(...)` rethrows the error, and `DescribeStacksCommand` reports it as
|
|
@@ -896,7 +887,7 @@ takes either.
|
|
|
896
887
|
|
|
897
888
|
## Parameters
|
|
898
889
|
|
|
899
|
-
|
|
890
|
+
Pass template parameter values when creating or updating a stack.
|
|
900
891
|
|
|
901
892
|
```typescript sim-cloudformation-parameters
|
|
902
893
|
/**
|
|
@@ -949,7 +940,7 @@ the type.
|
|
|
949
940
|
|
|
950
941
|
## Intrinsic functions
|
|
951
942
|
|
|
952
|
-
|
|
943
|
+
Yulin resolves the following intrinsic functions in resource properties and outputs.
|
|
953
944
|
|
|
954
945
|
### `Ref`
|
|
955
946
|
|
|
@@ -991,8 +982,8 @@ console.log(
|
|
|
991
982
|
);
|
|
992
983
|
```
|
|
993
984
|
|
|
994
|
-
|
|
995
|
-
|
|
985
|
+
`Ref` returns the CloudFormation value for a resource type. For an S3 bucket, it returns the bucket
|
|
986
|
+
name.
|
|
996
987
|
|
|
997
988
|
### `Fn::GetAtt`
|
|
998
989
|
|
|
@@ -1251,8 +1242,8 @@ console.log(simAws.s3().getSimBucketByName("docs-site-bucket")?.bucketName);
|
|
|
1251
1242
|
|
|
1252
1243
|
### `Fn::FindInMap`
|
|
1253
1244
|
|
|
1254
|
-
A template `Mappings` section
|
|
1255
|
-
|
|
1245
|
+
A template `Mappings` section stores values under two levels of keys. `Fn::FindInMap` reads a value
|
|
1246
|
+
using the map name and both keys.
|
|
1256
1247
|
|
|
1257
1248
|
```typescript sim-cloudformation-fn-find-in-map
|
|
1258
1249
|
/**
|
|
@@ -1330,9 +1321,7 @@ expression. A lookup that finds its value in the map ignores the default.
|
|
|
1330
1321
|
|
|
1331
1322
|
### `Fn::Split` and `Fn::Select`
|
|
1332
1323
|
|
|
1333
|
-
`Fn::Split`
|
|
1334
|
-
its zero-based index. They are usually written together, to pull one part out of a string another
|
|
1335
|
-
resource gave.
|
|
1324
|
+
`Fn::Split` divides a string by a delimiter. `Fn::Select` reads a list value by zero-based index.
|
|
1336
1325
|
|
|
1337
1326
|
```typescript sim-cloudformation-fn-select-split
|
|
1338
1327
|
/**
|
|
@@ -1418,8 +1407,7 @@ resource and the property path the value sat at, for example
|
|
|
1418
1407
|
|
|
1419
1408
|
### `Fn::ImportValue`
|
|
1420
1409
|
|
|
1421
|
-
`Fn::ImportValue` reads a
|
|
1422
|
-
`Export.Name`, and a Stack in the same Account and Region imports it by that name.
|
|
1410
|
+
`Fn::ImportValue` reads a named output exported by another stack in the same account and region.
|
|
1423
1411
|
|
|
1424
1412
|
CDK writes both halves on its own. Referencing a resource in another Stack of the same app puts an
|
|
1425
1413
|
`Export` on the producer and an `Fn::ImportValue` on the consumer, with no opt-in.
|
|
@@ -1486,8 +1474,8 @@ exports published in that Region.
|
|
|
1486
1474
|
|
|
1487
1475
|
## Dynamic references
|
|
1488
1476
|
|
|
1489
|
-
A `{{resolve:...}}` dynamic reference reads
|
|
1490
|
-
|
|
1477
|
+
A `{{resolve:...}}` dynamic reference reads an SSM parameter or Secrets Manager secret while
|
|
1478
|
+
creating a resource. A reference can appear inside a longer string.
|
|
1491
1479
|
|
|
1492
1480
|
`Fn::Sub` and `Fn::Join` resolve first, and the reference is read from the string they built. CDK
|
|
1493
1481
|
writes that shape whenever a secret sits in the same stack as the resource reading it (the secret's
|
|
@@ -1506,9 +1494,8 @@ for the segments and for what a reference Secrets Manager cannot answer resolves
|
|
|
1506
1494
|
|
|
1507
1495
|
## Conditions
|
|
1508
1496
|
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
output.
|
|
1497
|
+
The `Conditions` section defines boolean expressions over parameter and pseudo-parameter values.
|
|
1498
|
+
Conditions control resource creation and select `Fn::If` values.
|
|
1512
1499
|
|
|
1513
1500
|
```typescript sim-cloudformation-conditions
|
|
1514
1501
|
/**
|
|
@@ -1632,7 +1619,7 @@ condition the template leaves undefined fails the deployment.
|
|
|
1632
1619
|
|
|
1633
1620
|
## Resource dependencies
|
|
1634
1621
|
|
|
1635
|
-
|
|
1622
|
+
Use `DependsOn` to declare an explicit resource dependency.
|
|
1636
1623
|
|
|
1637
1624
|
```typescript sim-cloudformation-depends-on
|
|
1638
1625
|
/**
|
|
@@ -1765,8 +1752,7 @@ in the assembly, and a Stack named in `stackOptions` carries its own.
|
|
|
1765
1752
|
|
|
1766
1753
|
## Deploying synthesized CDK templates
|
|
1767
1754
|
|
|
1768
|
-
Use `deployTemplateFile(...)` to deploy a template file, including
|
|
1769
|
-
produces.
|
|
1755
|
+
Use `deployTemplateFile(...)` to deploy a JSON or YAML template file, including CDK synth output.
|
|
1770
1756
|
|
|
1771
1757
|
```typescript sim-cloudformation-cdk-template-file
|
|
1772
1758
|
/**
|
|
@@ -1805,8 +1791,7 @@ const stack = await simAws.cloudFormation().deployTemplateFile({
|
|
|
1805
1791
|
await stack.waitForDeployComplete();
|
|
1806
1792
|
```
|
|
1807
1793
|
|
|
1808
|
-
This
|
|
1809
|
-
create the simulated resources from that synthesized output template.
|
|
1794
|
+
This lets an integration test synthesize with CDK and deploy the resulting template through Yulin.
|
|
1810
1795
|
|
|
1811
1796
|
A template path with no file at it is refused with
|
|
1812
1797
|
`No Sim CloudFormation template file at <path>`, naming the resolved path. A synthesized template
|
|
@@ -1814,8 +1799,7 @@ is build output, and a checkout that has yet to synthesize one meets this on the
|
|
|
1814
1799
|
|
|
1815
1800
|
## Deploying a template written as YAML
|
|
1816
1801
|
|
|
1817
|
-
|
|
1818
|
-
`deployTemplateFile(...)` reads a `.yaml` or `.yml` file as YAML.
|
|
1802
|
+
`deployTemplateFile(...)` parses `.yaml` and `.yml` files as YAML.
|
|
1819
1803
|
|
|
1820
1804
|
```yaml
|
|
1821
1805
|
Resources:
|
|
@@ -1917,6 +1901,10 @@ it.
|
|
|
1917
1901
|
environment names. The assembly's `manifest.json` is where that comes from, so an app synthesizing
|
|
1918
1902
|
several Stacks across several regions needs no loop of its own and no region constants beside it.
|
|
1919
1903
|
|
|
1904
|
+
An application test suite should normally call `deployCdkOut(...)` once from its shared Yulin setup.
|
|
1905
|
+
Every test then uses the same deployed Stacks. The [test suite setup guide](https://yulinsim.dev/testing/)
|
|
1906
|
+
shows this arrangement with Vitest and SDK interception.
|
|
1907
|
+
|
|
1920
1908
|
```typescript sim-cloudformation-cdk-out-assembly
|
|
1921
1909
|
/**
|
|
1922
1910
|
* Deploying every Stack a synthesized CDK cloud assembly holds.
|
|
@@ -3250,10 +3238,10 @@ another function's event put there.
|
|
|
3250
3238
|
Two shapes are refused rather than expanded. A bucket writing its `NotificationConfiguration` or its
|
|
3251
3239
|
`LambdaConfigurations` as an intrinsic such as `Fn::If` is one, because there is no appending to a
|
|
3252
3240
|
list CloudFormation has not resolved yet, and adding the event's own entries would drop whatever the
|
|
3253
|
-
intrinsic resolved to. The other is a function the template conditions out
|
|
3254
|
-
refuses
|
|
3255
|
-
|
|
3256
|
-
|
|
3241
|
+
intrinsic resolved to. The other is a function the template conditions out. Real CloudFormation
|
|
3242
|
+
refuses this because the notification belongs to the unconditioned bucket, and one entry of that
|
|
3243
|
+
property cannot have its own condition. Condition the bucket along with the function, or declare the
|
|
3244
|
+
notification on the bucket yourself.
|
|
3257
3245
|
|
|
3258
3246
|
### Simple tables
|
|
3259
3247
|
|