@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.
Files changed (74) hide show
  1. package/README.md +22 -2
  2. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-creator.js +1 -0
  3. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.d.ts +4 -0
  4. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.js +26 -1
  5. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-creator.js +3 -1
  6. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-properties.d.ts +0 -7
  7. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-properties.js +0 -20
  8. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-unsimulated-properties.d.ts +13 -0
  9. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-unsimulated-properties.js +59 -0
  10. package/dist/service/eventbridge/cfn/sim-cfn-event-bridge-resource-error.d.ts +1 -1
  11. package/dist/service/eventbridge/cfn/sim-cfn-event-bridge-resource-error.js +1 -1
  12. package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-properties.js +1 -1
  13. package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.d.ts +3 -2
  14. package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.js +25 -3
  15. package/dist/service/ses/command/authorize/sim-ses-authorizer.d.ts +9 -0
  16. package/dist/service/ses/command/authorize/sim-ses-authorizer.js +18 -2
  17. package/dist/service/ses/command/send/sim-ses-send-email.js +2 -1
  18. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-creator.js +1 -0
  19. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-properties.d.ts +9 -4
  20. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-properties.js +18 -6
  21. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-property-names.d.ts +10 -0
  22. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-property-names.js +16 -1
  23. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-creator.js +1 -1
  24. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.d.ts +11 -6
  25. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.js +18 -9
  26. package/docs/README.md +40 -4
  27. package/docs/ai-skill/README.md +57 -54
  28. package/docs/cli/README.md +84 -94
  29. package/docs/factories/README.md +42 -54
  30. package/docs/lint/README.md +41 -67
  31. package/docs/non-aws-dependencies/README.md +72 -168
  32. package/docs/sdk/README.md +109 -95
  33. package/docs/serve/README.md +192 -898
  34. package/docs/services/acm/README.md +24 -40
  35. package/docs/services/apigateway/README.md +52 -71
  36. package/docs/services/apigatewayv2/README.md +55 -74
  37. package/docs/services/athena/README.md +17 -26
  38. package/docs/services/backup/README.md +29 -39
  39. package/docs/services/bedrock/README.md +38 -52
  40. package/docs/services/cloudformation/README.md +43 -55
  41. package/docs/services/cloudfront/README.md +69 -95
  42. package/docs/services/cloudwatch/README.md +40 -54
  43. package/docs/services/cognito/README.md +30 -45
  44. package/docs/services/dynamodb/README.md +34 -51
  45. package/docs/services/ecr/README.md +36 -77
  46. package/docs/services/ecs/README.md +26 -46
  47. package/docs/services/elbv2/README.md +19 -29
  48. package/docs/services/eventbridge/README.md +24 -20
  49. package/docs/services/firehose/README.md +24 -32
  50. package/docs/services/glue/README.md +41 -78
  51. package/docs/services/iam/README.md +13 -15
  52. package/docs/services/kinesis/README.md +53 -93
  53. package/docs/services/kms/README.md +22 -32
  54. package/docs/services/lambda/README.md +60 -80
  55. package/docs/services/logs/README.md +41 -50
  56. package/docs/services/organizations/README.md +50 -85
  57. package/docs/services/personalize/README.md +28 -44
  58. package/docs/services/rekognition/README.md +26 -38
  59. package/docs/services/route53/README.md +17 -17
  60. package/docs/services/s3/README.md +47 -51
  61. package/docs/services/scheduler/README.md +41 -52
  62. package/docs/services/secretsmanager/README.md +27 -42
  63. package/docs/services/ses/README.md +24 -34
  64. package/docs/services/sns/README.md +31 -33
  65. package/docs/services/sqs/README.md +14 -14
  66. package/docs/services/ssm/README.md +19 -21
  67. package/docs/services/stepfunctions/README.md +18 -20
  68. package/docs/services/sts/README.md +32 -45
  69. package/docs/services/wafv2/README.md +12 -17
  70. package/docs/terraform/README.md +108 -126
  71. package/docs/testing/README.md +228 -0
  72. package/docs/time/README.md +87 -117
  73. package/llms.txt +2 -1
  74. package/package.json +1 -1
@@ -1,20 +1,14 @@
1
1
  # Simulated SES
2
2
 
3
- Yulin includes a simulated Amazon SES for tests and local development, through the SES v2 API. It
4
- holds email identities, applies the sandbox rules, and keeps a record of every message it would have
5
- sent. A test can assert that signing someone up produced a welcome email addressed to them, without
6
- an AWS account and without a mailbox to read.
7
-
8
- There is no delivery to simulate. A message SES accepts leaves AWS for a mail system. The whole of
9
- the observable AWS behaviour is whether SES would have accepted the message and what it would have
10
- sent. That is what makes this service small and what makes it useful.
3
+ Yulin simulates the Amazon SES v2 API in memory. It stores email identities, applies sandbox and
4
+ suppression rules, renders templates, and records accepted messages. It does not deliver email.
11
5
 
12
6
  SES specific types are imported from the `@kensio/yulin/ses` subpath.
13
7
 
14
8
  ## Asserting on a message that was sent
15
9
 
16
- `sentEmails()` hands over the record. Each message carries who it was from, the three recipient
17
- lists, the subject, the body, its attachments and the message id SES answered with.
10
+ Use `sentEmails()` to inspect accepted messages. Each record contains the sender, To/Cc/Bcc lists,
11
+ subject, body, attachments, and message ID.
18
12
 
19
13
  ```typescript sim-ses-send-and-assert
20
14
  /**
@@ -115,9 +109,8 @@ console.log(
115
109
 
116
110
  ## Verifying identities
117
111
 
118
- Real SES verifies an email address by emailing it a link and a domain by looking for DNS records.
119
- Neither can happen inside a test process, so verification here is the simulator's own operation
120
- instead of an API call. `verifyIdentity` performs it, creating the identity where one is absent.
112
+ SES normally verifies an address by email and a domain through DNS. In tests, call `verifyIdentity`
113
+ instead. It creates the identity if necessary and marks it verified.
121
114
 
122
115
  Everything else about identities is the ordinary SES API. `CreateEmailIdentity` starts one, and it
123
116
  starts unverified, exactly as a real one does:
@@ -631,13 +624,10 @@ one answer whoever asked.
631
624
 
632
625
  ## The sandbox
633
626
 
634
- An account starts in the SES sandbox, where **both** the sender and every recipient have to be
635
- verified. That is the state most tests should be written against. It is the configuration that
636
- refuses to mail an address nobody verified, and catching that refusal in a test is much better than
637
- catching it in an account.
627
+ An account starts in the SES sandbox. Both the sender and every recipient must be verified. Outside
628
+ the sandbox, only the sender must be verified.
638
629
 
639
- Outside the sandbox only the sender is checked. `PutAccountDetails` with `ProductionAccessEnabled`
640
- is how an account gets there:
630
+ Call `PutAccountDetails` with `ProductionAccessEnabled` to leave the sandbox:
641
631
 
642
632
  ```typescript sim-ses-sandbox
643
633
  /**
@@ -696,17 +686,12 @@ caller finds out everything it has to verify from one failure:
696
686
  Email address is not verified. The following identities failed the check in region US-EAST-1: someone@example.org
697
687
  ```
698
688
 
699
- Real SES treats `ProductionAccessEnabled` as a request that a human at AWS then reviews, and an
700
- account stays in the sandbox until that review lands. Granting it immediately is a deliberate
701
- divergence. The alternative is a simulator no test can get out of the sandbox in, and waiting for a
702
- review is beyond what a test can assert on anyway.
689
+ Unlike AWS, Yulin grants production access immediately instead of waiting for a manual review.
703
690
 
704
691
  ## The suppression list
705
692
 
706
- Real SES holds an account-level suppression list and fills it from hard bounces and complaints.
707
- Tests supply that feedback explicitly with `recordFeedback`. Suppression commands manage the same
708
- list. The support tool that lists suppressed addresses, the form that removes one and the script
709
- that seeds the list all have somewhere to run.
693
+ SES maintains an account suppression list for hard bounces and complaints. Tests add feedback with
694
+ `recordFeedback`, and the suppression commands read and change the same list.
710
695
 
711
696
  `PutSuppressedDestination`, `GetSuppressedDestination`, `ListSuppressedDestinations` and
712
697
  `DeleteSuppressedDestination` manage it.
@@ -870,8 +855,7 @@ recorded.
870
855
 
871
856
  ## Messages on the console
872
857
 
873
- `sentEmails()` is test code. A dev server has the same messages going past and nothing to read them
874
- with, so `serveSimAws` prints a summary of each one as SES accepts it:
858
+ For local development, `serveSimAws` prints a summary whenever SES accepts a message:
875
859
 
876
860
  ```
877
861
  sim SES: hello@example.com to alice@example.com, bcc audit@example.com
@@ -899,13 +883,12 @@ pool kept. Both services recorded it, and each block says what that service hold
899
883
 
900
884
  ## Permissions
901
885
 
902
- Every command authorizes through simulated IAM. A send authorizes against the identity being sent
903
- **from**, and recipients never enter into it. That is worth knowing when a policy looks like it
904
- should cover a send and fails to.
886
+ Every command uses simulated IAM. A send authorizes against the sender identity, not the recipient
887
+ addresses.
905
888
 
906
889
  ```typescript sim-ses-permissions
907
890
  /**
908
- * A Role that may only send from one domain.
891
+ * A Role that may only send from one address at a verified domain.
909
892
  */
910
893
 
911
894
  import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
@@ -945,6 +928,9 @@ await simAws.iam().putRolePolicy(
945
928
  Effect: "Allow",
946
929
  Action: "ses:SendEmail",
947
930
  Resource: "arn:aws:ses:us-east-1:111111111111:identity/example.com",
931
+ Condition: {
932
+ StringEquals: { "ses:FromAddress": "hello@example.com" },
933
+ },
948
934
  },
949
935
  ],
950
936
  }),
@@ -953,7 +939,7 @@ await simAws.iam().putRolePolicy(
953
939
 
954
940
  await ses.sendEmail(
955
941
  new SendEmailCommand({
956
- FromEmailAddress: "anything@example.com",
942
+ FromEmailAddress: "hello@example.com",
957
943
  Destination: { ToAddresses: ["someone@example.com"] },
958
944
  Content: {
959
945
  Simple: {
@@ -978,6 +964,10 @@ The more specific identity wins when both exist. A policy naming `identity/examp
978
964
  send from any address at the domain, unless that address is an identity in its own right, in which
979
965
  case the send authorizes against `identity/hello@example.com` instead.
980
966
 
967
+ `ses:FromAddress` carries the bare `FromEmailAddress`. A policy can use it to allow one address at a
968
+ verified domain. A display name does not change the value. For example, `Welcome team
969
+ <hello@example.com>` supplies `hello@example.com` to IAM.
970
+
981
971
  `ses:ListEmailIdentities`, `ses:GetAccount` and `ses:PutAccountDetails` have no resource type at all
982
972
  on real SES, and only a policy written against `*` allows them. A policy scoped to identity ARNs
983
973
  allows none of the three. Not even one written against `identity/*`, the intuitive reading and the
@@ -1,14 +1,11 @@
1
1
  # Simulated SNS
2
2
 
3
- Yulin includes a simulated Amazon SNS for tests and local development. Topics are held in memory and
4
- every operation is authorized by simulated IAM.
3
+ Yulin simulates Amazon SNS standard topics for tests and local development. A published message can
4
+ reach simulated SQS queues, invoke simulated Lambda functions or create SMS records that tests can
5
+ inspect. Direct SMS publishes are recorded in the same way.
5
6
 
6
- Standard topics only. SNS-specific types are imported from the `@kensio/yulin/sns` subpath.
7
-
8
- A message published to a topic is delivered to every queue subscribed to it, invokes every Lambda
9
- function subscribed to it, and is recorded as an SMS for every phone number subscribed to it. Only
10
- those three protocols are simulated. A message published straight to a phone number is recorded
11
- as an SMS a test can assert on.
7
+ Topics are stored in memory, and simulated IAM authorizes every operation. FIFO topics and other
8
+ subscription protocols are not simulated. Import SNS-specific types from `@kensio/yulin/sns`.
12
9
 
13
10
  ## Creating a topic and publishing to it
14
11
 
@@ -103,11 +100,10 @@ console.log(read.Attributes?.["SubscriptionsConfirmed"]); // "0"
103
100
  reports it. The three subscription counts are reported as zero, the counts a topic with no
104
101
  subscriptions has.
105
102
 
106
- An attribute real SNS has and this simulation gives no behaviour to is refused by name rather than
107
- taken and ignored. That covers `FifoTopic`, `KmsMasterKeyId`, `SignatureVersion`, `TracingConfig`,
108
- `ArchivePolicy`, `DeliveryPolicy`, `ContentBasedDeduplication` and the delivery status logging
109
- attributes such as `SQSSuccessFeedbackRoleArn`. A topic that appeared to accept `KmsMasterKeyId`
110
- would look encrypted to the request that set it and be plain to everything else.
103
+ Unsupported topic attributes are rejected instead of being stored without effect. These include
104
+ `FifoTopic`, `KmsMasterKeyId`, `SignatureVersion`, `TracingConfig`, `ArchivePolicy`, `DeliveryPolicy`,
105
+ `ContentBasedDeduplication` and delivery status logging attributes such as
106
+ `SQSSuccessFeedbackRoleArn`.
111
107
 
112
108
  ## Publishing
113
109
 
@@ -148,12 +144,11 @@ const published = await sns.publish(
148
144
  console.log(published.MessageId !== undefined); // true
149
145
  ```
150
146
 
151
- The name and data type rules are the real ones. A data type is `String`, `String.Array`, `Number` or
152
- `Binary`, and each takes a custom label after a dot, so `Number.int` is a number as far as the rules
153
- go. A reserved `AWS.` or `Amazon.` prefix on a name, a data type built on none of the four, or a
154
- value that disagrees with its data type is refused. A test finds any of those without going near AWS. The two reserved names real
155
- SNS defines for SMS, `AWS.SNS.SMS.SenderID` and `AWS.SNS.SMS.SMSType`, are the exception.
156
- [Sending an SMS](#sending-an-sms) covers those.
147
+ Message attributes use the AWS name and type rules. A type starts with `String`, `String.Array`,
148
+ `Number` or `Binary` and may add a custom label after a dot, such as `Number.int`. SNS rejects
149
+ reserved `AWS.` and `Amazon.` name prefixes, unknown base types and values that do not match their
150
+ type. The SMS attributes `AWS.SNS.SMS.SenderID` and `AWS.SNS.SMS.SMSType` are exceptions. See
151
+ [Sending an SMS](#sending-an-sms).
157
152
 
158
153
  A `Subject` is UTF-8 text with no line breaks or control characters, of fewer than 100 characters.
159
154
  That is the contract real SNS states. A subject of exactly 100 characters is already too long. A
@@ -164,9 +159,8 @@ publish with no `Message`, or with one over the size limit, is refused with
164
159
  the rest of the batch goes through, as real SNS reports it. An empty batch, more than ten entries, a
165
160
  malformed entry id or two entries sharing an id fail the whole request.
166
161
 
167
- The size limit is the one thing a batch is held to as a whole. Ten entries each just inside it are
168
- one batch far outside it, and a single entry over it fails the whole batch with
169
- `BatchRequestTooLongException`. The response singles out no entry.
162
+ The size limit applies to the whole batch. A batch over the limit fails with
163
+ `BatchRequestTooLongException`, without identifying one entry as the cause.
170
164
 
171
165
  ```typescript sim-sns-publish-batch
172
166
  /**
@@ -1742,24 +1736,29 @@ ARNs, and `Ref` on an `AWS::SNS::Topic` gives one.
1742
1736
 
1743
1737
  A property with no simulated behaviour fails the resource rather than being dropped. That covers
1744
1738
  `FifoTopic`, `ContentBasedDeduplication`, `FifoThroughputScope`, `KmsMasterKeyId`,
1745
- `SignatureVersion`, `TracingConfig`, `ArchivePolicy`, `DeliveryStatusLogging`, `DataProtectionPolicy`
1746
- and `Tags` on a topic, and `DeliveryPolicy`, `RedrivePolicy`, `ReplayPolicy`, `SubscriptionRoleArn`
1747
- and `Region` on a subscription. Most of them are refused by simulated SNS itself, since they are
1748
- topic or subscription attributes of the same name, and the reason is the same one an SDK caller gets.
1749
- A property the resource type never had is refused too. The failure is worded as an invalid resource,
1750
- which fails the resource where an unsupported one would be
1739
+ `SignatureVersion`, `TracingConfig`, `ArchivePolicy`, `DeliveryStatusLogging` and
1740
+ `DataProtectionPolicy` on a topic, and `DeliveryPolicy`, `RedrivePolicy`, `ReplayPolicy`,
1741
+ `SubscriptionRoleArn` and `Region` on a subscription. Most of them are refused by simulated SNS
1742
+ itself, since they are topic or subscription attributes of the same name, and the reason is the same
1743
+ one an SDK caller gets. A property the resource type never had is refused too. The failure is worded
1744
+ as an invalid resource, which fails the resource where an unsupported one would be
1751
1745
  [skipped](https://yulinsim.dev/services/cloudformation/#values-from-a-skipped-resource). A topic that cannot be created
1752
1746
  as the template asked for it would otherwise leave a stack that looks deployed with no publisher
1753
1747
  behind it.
1754
1748
 
1749
+ `Tags` is the one difference from `CreateTopic`, which refuses it outright. A template's tags are
1750
+ usually the whole stack's (a CDK app calling `Tags.of(app).add(...)` tags every topic in it), and a
1751
+ topic delivers the same messages whether it carries them or not. They are recorded as an ignored
1752
+ property and the deploy stands. Nothing reads them back either.
1753
+
1755
1754
  CDK works without hand-editing. `topic.addSubscription(new subscriptions.SqsSubscription(queue))`
1756
1755
  synthesises an `AWS::SNS::Subscription` alongside the `AWS::SQS::QueuePolicy` that authorizes the
1757
1756
  delivery, and both deploy. `new subscriptions.LambdaSubscription(fn)` does the same with the
1758
1757
  `AWS::Lambda::Permission` beside it.
1759
1758
 
1760
- ## Available functionality
1759
+ ## Supported operations
1761
1760
 
1762
- Sim SNS currently supports:
1761
+ Simulated SNS supports:
1763
1762
 
1764
1763
  - `CreateTopicCommand`, idempotent for a name already taken, and `DeleteTopicCommand`
1765
1764
  - `ListTopicsCommand`, paged at a hundred topics with a `NextToken`
@@ -1802,8 +1801,6 @@ Sim SNS currently supports:
1802
1801
 
1803
1802
  ## Limitations
1804
1803
 
1805
- Current documented limitations:
1806
-
1807
1804
  - Only the `sqs`, `lambda` and `sms` subscription protocols are simulated. A queue, a function and a
1808
1805
  phone number are the only things a topic can deliver to. `http`, `https`, `email`, `email-json`,
1809
1806
  `application` and `firehose` are refused at `Subscribe` time.
@@ -1880,7 +1877,8 @@ Current documented limitations:
1880
1877
  - Encryption is left out. `KmsMasterKeyId` is refused, and message bodies are held in process memory
1881
1878
  as they were published. Anything sharing the process can read them.
1882
1879
  - Tags are left out. `TagResource`, `UntagResource` and `ListTagsForResource` are absent, and
1883
- `CreateTopic` refuses a `Tags` parameter rather than dropping it.
1880
+ `CreateTopic` refuses a `Tags` parameter rather than dropping it. An `AWS::SNS::Topic` carrying
1881
+ `Tags` deploys with the tags dropped and the property recorded.
1884
1882
  - Data protection policies are left out. `PutDataProtectionPolicy` and `GetDataProtectionPolicy` are
1885
1883
  absent, and `CreateTopic` refuses a `DataProtectionPolicy` rather than creating a topic that
1886
1884
  redacts nothing.
@@ -1,9 +1,11 @@
1
1
  # Simulated SQS
2
2
 
3
- Yulin includes a simulated Amazon SQS for tests and local development. Messages are held in memory,
4
- hidden and released on the simulation's own clock, and every operation is authorized by simulated IAM.
3
+ Yulin simulates Amazon SQS standard queues for tests and local development. You can create queues,
4
+ send and receive messages, test visibility timeouts and redrive messages to dead-letter queues.
5
+ Messages are stored in memory, time-based behavior uses the simulation's clock, and simulated IAM
6
+ authorizes every operation.
5
7
 
6
- Standard queues only. SQS-specific types are imported from the `@kensio/yulin/sqs` subpath.
8
+ FIFO queues are not simulated. Import SQS-specific types from `@kensio/yulin/sqs`.
7
9
 
8
10
  ## Creating a queue and sending a message
9
11
 
@@ -57,10 +59,9 @@ differ. A request naming no attributes always matches.
57
59
 
58
60
  ## Visibility timeouts
59
61
 
60
- A received message is hidden from other consumers for the queue's visibility timeout, 30 seconds by
61
- default. The message records the instant it is hidden until. It becomes receivable again once
62
- simulated time reaches that instant. Advancing the clock is all a test needs to watch an undeleted
63
- message come back.
62
+ A received message is hidden from other consumers for the queue's visibility timeout, which is 30
63
+ seconds by default. If the consumer does not delete it, the message becomes available again when the
64
+ simulated clock reaches the end of that timeout.
64
65
 
65
66
  ```typescript sim-sqs-visibility-timeout
66
67
  /**
@@ -127,8 +128,8 @@ Every receive issues a fresh receipt handle, and a delete has to use the handle
127
128
  receive of that message. A handle from an earlier receive is accepted and deletes nothing. Real SQS
128
129
  accepts one too, and promises only that the message might not be deleted.
129
130
 
130
- That is the failure a consumer slower than its visibility timeout hits. Its message went back on the
131
- queue, someone else took it, and its own delete quietly does nothing.
131
+ This can happen when a consumer runs past the visibility timeout and another consumer receives the
132
+ same message. The first consumer's later delete succeeds without deleting the message.
132
133
 
133
134
  ```typescript sim-sqs-stale-receipt-handle
134
135
  /**
@@ -187,10 +188,9 @@ still the most recent one, so deleting with it works. A handle the queue never i
187
188
 
188
189
  ## Dead-letter queues
189
190
 
190
- A `RedrivePolicy` says where a message goes once a consumer has had enough attempts at it. Once a
191
- message has been received `maxReceiveCount` times without being deleted, the next lapse of its
192
- visibility timeout moves it to the queue named by `deadLetterTargetArn`. Advancing the clock drives
193
- the move, as it drives the timeout itself.
191
+ A `RedrivePolicy` sends repeatedly received messages to a dead-letter queue. After a message reaches
192
+ `maxReceiveCount` without being deleted, the next visibility timeout moves it to the queue named by
193
+ `deadLetterTargetArn`. Advance the simulated clock to trigger the timeout and move.
194
194
 
195
195
  ```typescript sim-sqs-dead-letter-queue
196
196
  /**
@@ -1137,7 +1137,7 @@ that deploys here, with the queue URL reaching the function through its environm
1137
1137
  policy naming the queue by the ARN `Fn::GetAtt` gives. A grant to a service principal synthesises an
1138
1138
  `AWS::SQS::QueuePolicy` alongside it, which deploys too.
1139
1139
 
1140
- ## Available functionality
1140
+ ## Supported operations
1141
1141
 
1142
1142
  Sim SQS currently supports:
1143
1143
 
@@ -1,12 +1,11 @@
1
1
  # Simulated SSM Parameter Store
2
2
 
3
- Yulin includes a simulated AWS Systems Manager Parameter Store for tests and local development.
4
- Parameters are stored in memory, versioned on every write, and every operation is authorized by
5
- simulated IAM.
3
+ Yulin simulates AWS Systems Manager Parameter Store for tests and local development. You can create,
4
+ read, update and delete parameters through the AWS SDK or a CloudFormation template. Parameters are
5
+ stored in memory, each write creates a version, and simulated IAM authorizes every operation.
6
6
 
7
- Only Parameter Store is simulated.
8
-
9
- SSM-specific types are imported from the `@kensio/yulin/ssm` subpath.
7
+ Other Systems Manager features, such as Run Command and Session Manager, are not simulated. Import
8
+ SSM-specific types from `@kensio/yulin/ssm`.
10
9
 
11
10
  ## Writing and reading a parameter
12
11
 
@@ -292,8 +291,7 @@ console.log(origins.length); // 2
292
291
 
293
292
  ## Parameter names
294
293
 
295
- Name validation matches real Parameter Store, because a name it accepts and AWS refuses is a
296
- deployment failure a passing test would have hidden. A name:
294
+ Parameter names use the same validation rules as AWS. A name:
297
295
 
298
296
  - may contain letters, digits, `_`, `.`, `-` and `/`
299
297
  - must start with `/` if it contains a hierarchy at all
@@ -302,8 +300,8 @@ deployment failure a passing test would have hidden. A name:
302
300
  - may not contain spaces between characters, though surrounding spaces are stripped
303
301
  - may not make an ARN longer than 1011 characters, counting the ARN prefix for the account and region
304
302
 
305
- A `String` or `StringList` value holds at most 4KB, the standard tier limit. This is the one people
306
- hit, usually by putting a whole JSON configuration blob in one parameter.
303
+ A `String` or `StringList` value holds at most 4 KB, the standard tier limit. Larger configuration
304
+ documents must be split across parameters or stored elsewhere.
307
305
 
308
306
  ## Deploying a parameter from CloudFormation
309
307
 
@@ -455,9 +453,9 @@ covers that one.
455
453
 
456
454
  ### A reference the simulation cannot answer
457
455
 
458
- Simulated CloudFormation deploys what it can. A reference naming a parameter that was never created
459
- resolves to `dummy-value-for-<name>`, and the stack carries on deploying. A template reading
460
- configuration a test does not care about is still worth deploying for everything else in it.
456
+ When a reference names a parameter that does not exist, simulated CloudFormation substitutes
457
+ `dummy-value-for-<name>` and continues the deployment. This lets a test deploy the rest of a
458
+ template without setting up unrelated configuration.
461
459
 
462
460
  The substitution is recorded on
463
461
  [`stack.ignoredProperties`](https://yulinsim.dev/services/cloudformation/#properties-a-resource-was-created-without),
@@ -998,9 +996,9 @@ console.log(read.Parameter?.Value); // "hunter2"
998
996
 
999
997
  `DescribeParameters` reports the key each `SecureString` is encrypted under as `KeyId`.
1000
998
 
1001
- ## Available functionality
999
+ ## Supported operations
1002
1000
 
1003
- Sim SSM currently supports:
1001
+ Simulated Parameter Store supports:
1004
1002
 
1005
1003
  - `PutParameterCommand`, creating a parameter or overwriting one
1006
1004
  - `GetParameterCommand`, by name, by `name:version` or by `name:label`
@@ -1026,8 +1024,6 @@ Sim SSM currently supports:
1026
1024
 
1027
1025
  ## Limitations
1028
1026
 
1029
- Current documented limitations:
1030
-
1031
1027
  - Only standard tier `SecureString` encryption is simulated, which encrypts under the KMS key
1032
1028
  directly. The advanced tier's envelope encryption through the AWS Encryption SDK is left out, and
1033
1029
  `kms:GenerateDataKey` is never needed.
@@ -1039,7 +1035,8 @@ Current documented limitations:
1039
1035
  - Parameter policies (expiration and notification) are left out. `Policies` is refused, and
1040
1036
  `DescribeParameters` always reports an empty `Policies` list.
1041
1037
  - Tags are left out. `Tags` on `PutParameter` is refused, and `AddTagsToResource`,
1042
- `RemoveTagsFromResource` and `ListTagsForResource` are absent.
1038
+ `RemoveTagsFromResource` and `ListTagsForResource` are absent. An `AWS::SSM::Parameter` carrying
1039
+ `Tags` deploys with the tags dropped and the property recorded.
1043
1040
  - `AllowedPattern` is refused outright. Ignoring it would store a value it was meant to reject,
1044
1041
  without complaint.
1045
1042
  - `KeyId` on a `String` or `StringList` parameter is refused, since nothing would encrypt a value
@@ -1060,9 +1057,10 @@ Current documented limitations:
1060
1057
  - Deletion is immediate. Real Parameter Store asks for thirty seconds before a deleted name is
1061
1058
  reused, where here the name is free straight away.
1062
1059
  - `AWS::SSM::Parameter` supports `Name`, `Type`, `Value`, `Description` and `Tier`. `AllowedPattern`,
1063
- `DataType`, `Policies` and `Tags` reach `PutParameter`, which refuses them for the reasons above.
1064
- `Type: SecureString` is refused, as real CloudFormation refuses it for this resource type. The
1065
- plaintext value would sit in the template.
1060
+ `DataType` and `Policies` reach `PutParameter`, which refuses them for the reasons above. `Tags`
1061
+ is the one difference from the command, and is recorded as an ignored property so a stack that
1062
+ tags every Resource in it still deploys. `Type: SecureString` is refused, as real CloudFormation
1063
+ refuses it for this resource type. The plaintext value would sit in the template.
1066
1064
  - The other `AWS::SSM::*` resource types (`Document`, `Association`, `MaintenanceWindow`,
1067
1065
  `PatchBaseline`, `ResourceDataSync` and the rest) are reported as unsupported and skipped.
1068
1066
  - Every deployment of an `AWS::SSM::Parameter` is a create. A name another stack already used is
@@ -1,18 +1,18 @@
1
1
  # Simulated Step Functions
2
2
 
3
- Simulated Step Functions interprets Amazon States Language and runs a state machine in the same
4
- process as the code under test. A workflow held in a template as data becomes something a test can
5
- run and assert on.
3
+ Yulin interprets Amazon States Language and runs Step Functions state machines in the same process
4
+ as the code under test. Tests can start executions, invoke simulated services, advance waits and
5
+ inspect execution history without deploying a workflow.
6
6
 
7
- Types for simulated Step Functions are imported from the `@kensio/yulin/stepfunctions` subpath.
7
+ Import Step Functions-specific types from `@kensio/yulin/stepfunctions`.
8
8
 
9
- ## What runs today
9
+ ## Supported state machine features
10
10
 
11
- Every state type Amazon States Language defines runs. `Pass`, `Task`, `Succeed`, `Fail`, `Choice`,
12
- `Wait`, `Parallel` and `Map`.
11
+ All eight state types are supported: `Pass`, `Task`, `Succeed`, `Fail`, `Choice`, `Wait`, `Parallel`
12
+ and `Map`.
13
13
 
14
- The data-flow fields run in full. `InputPath`, `Parameters`, `ResultSelector`, `ResultPath` and
15
- `OutputPath` apply in that order, reading Reference Paths and the intrinsic functions.
14
+ The data-flow fields `InputPath`, `Parameters`, `ResultSelector`, `ResultPath` and `OutputPath` run in
15
+ that order. They support Reference Paths and intrinsic functions.
16
16
 
17
17
  A `Task` state invokes a simulated Lambda function, calls an operation on any other simulated
18
18
  service, or starts another state machine. A `Resource` this simulator has no answer for is refused
@@ -114,23 +114,21 @@ console.log(described.status); // FAILED
114
114
  console.log(described.error); // NotEligible
115
115
  ```
116
116
 
117
- A failing execution is recorded on the execution, and the call returns as it would for one that
118
- succeeded. Simulated EventBridge treats an undeliverable event the same way. An execution failing is
119
- as often the thing under test as it is a fault, and raising it would fail an unrelated `advanceBy`
120
- elsewhere in the same test.
117
+ A failed execution records its status and error instead of throwing from `StartExecution`. Read it
118
+ with `DescribeExecution` or the inspection API. This keeps workflow failure available for
119
+ assertions.
121
120
 
122
121
  ## Invoking a Lambda function
123
122
 
124
123
  A `Task` state invokes a simulated Lambda function, through either of the two `Resource` forms CDK's
125
124
  `LambdaInvoke` emits.
126
125
 
127
- `arn:aws:states:::lambda:invoke` is the integration Step Functions optimises. The state is talking to
128
- the Lambda API, so its `Parameters` are an `Invoke` request (`FunctionName` names the function and
129
- `Payload` carries what it is sent) and its result is an `Invoke` response, with the handler's answer
130
- under `Payload`.
126
+ With `arn:aws:states:::lambda:invoke`, `Parameters` has the shape of a Lambda `Invoke` request.
127
+ `FunctionName` selects the function, `Payload` contains its input, and the handler result appears
128
+ under `Payload` in the task output.
131
129
 
132
- A function ARN sends the state's own input to the handler and answers with what the handler
133
- returned. CDK writes this form for `payloadResponseOnly`.
130
+ A function ARN sends the state input directly to the handler and uses the handler result as the task
131
+ output. CDK emits this form when `payloadResponseOnly` is enabled.
134
132
 
135
133
  ```typescript sim-step-functions-task
136
134
  /**
@@ -1334,7 +1332,7 @@ reference contradicts itself here, listing a differing role ARN under `StateMach
1334
1332
  while the operation's own note says the difference is ignored. The note is the more specific of the
1335
1333
  two and is what this follows.
1336
1334
 
1337
- ## Still to come
1335
+ ## Limitations
1338
1336
 
1339
1337
  - Distributed Map, with `ItemReader`, `ResultWriter` and the `ToleratedFailure` fields.
1340
1338
  - The `.sync` pattern, task tokens and activities.
@@ -1,16 +1,12 @@
1
1
  # Simulated STS
2
2
 
3
- Yulin includes a simulated STS (Security Token Service) for tests and local development.
4
-
5
- Sim STS is used through `SimAws` as `simAws.sts()`, scoped to the Account making the assume request.
6
- It simulates assuming IAM Roles. An assume request is evaluated against
7
- [simulated IAM](https://yulinsim.dev/services/iam/) policies, and a request that passes issues temporary session credentials
8
- that the rest of the simulated environment authenticates like real AWS credentials.
3
+ Yulin simulates `AssumeRole` and `GetCallerIdentity`. Access the service through `simAws.sts()` or an
4
+ intercepted `STSClient`.
9
5
 
10
6
  ## Basic usage
11
7
 
12
- Create a Role whose trust policy allows the Account to assume it, then assume it through STS. An
13
- omitted caller defaults to the Account root principal.
8
+ Create a role with a trust policy, then call `assumeRole`. A request with no caller runs as the
9
+ account root.
14
10
 
15
11
  ```typescript sim-sts-assume-role
16
12
  /**
@@ -50,23 +46,28 @@ console.log(assumeRoleOutput.Credentials?.AccessKeyId);
50
46
  console.log(assumeRoleOutput.Credentials?.Expiration);
51
47
  ```
52
48
 
53
- The output matches the AWS shape. `AssumedRoleUser.Arn` is the session ARN, such as
49
+ `AssumedRoleUser.Arn` is the session ARN, such as
54
50
  `arn:aws:sts::123456789012:assumed-role/TargetRole/test-session`, and `Credentials` carries the
55
51
  temporary `AccessKeyId`, `SecretAccessKey`, `SessionToken`, and `Expiration`.
56
52
 
57
- The issued credentials are registered with the target Account's sim IAM. They authenticate later
58
- simulated requests, for example as the `caller` of an IAM authorization attempt, where identity
59
- policies come from the underlying Role. See [the sim IAM docs](https://yulinsim.dev/services/iam/#sts-assumerole-sessions) for a
60
- full example. Credentials missing their session token, or used after `Expiration`, are rejected with
61
- an AWS-like invalid-credentials error.
53
+ Yulin registers the credentials with simulated IAM in the target account. Later requests use the
54
+ role's identity policies. See [STS sessions in simulated IAM](https://yulinsim.dev/services/iam/#sts-assumerole-sessions).
55
+ Credentials fail after `Expiration` or when the session token is missing.
56
+
57
+ `DurationSeconds` defaults to 3,600 seconds and must be a positive integer.
58
+
59
+ ## Reading the current identity
62
60
 
63
- `DurationSeconds` controls the session lifetime and defaults to 3600 seconds (one hour). It must be
64
- a positive integer.
61
+ `getCallerIdentity` reports the caller's ARN, account ID and user ID. It handles account roots, IAM
62
+ users and assumed-role sessions. The intercepted and served STS APIs also support
63
+ `GetCallerIdentityCommand`.
64
+
65
+ An unattributed request reports the configured default caller, or the account root when no default
66
+ caller is configured. An anonymous caller receives `AccessDenied`.
65
67
 
66
68
  ## Role-to-Role assumption
67
69
 
68
- Pass a caller to assume a Role as a specific principal. As in real AWS, both sides of the request
69
- are then evaluated:
70
+ Pass `caller` to assume a role as a specific principal. STS checks both sides of the request:
70
71
 
71
72
  - The target Role's trust policy must allow the caller to perform `sts:AssumeRole`
72
73
  - A non-root caller also needs an identity policy allowing `sts:AssumeRole` on the target Role's
@@ -144,33 +145,25 @@ const assumeRoleOutput = await account.sts().assumeRole(
144
145
  console.log(assumeRoleOutput.AssumedRoleUser?.Arn);
145
146
  ```
146
147
 
147
- STS throws an AWS-like access-denied error if either side denies the request, which happens when the
148
- trust policy does not cover the caller, the caller has no identity policy allowing `sts:AssumeRole`,
149
- or an explicit `Deny` matches. The error has a `403` status code and names the `sts:AssumeRole`
150
- action and the target Role ARN. No session is created.
148
+ If either check fails, STS raises a 403 access-denied error naming `sts:AssumeRole` and the target
149
+ role ARN. No session is created.
151
150
 
152
- Cross-Account assumption works the same way. Create the source and target Roles in different
153
- simulated Accounts of the same `SimAws` instance, and call `assumeRole` on the source Account's
154
- `sts()`. The issued session belongs to the target Role's Account.
151
+ Cross-account assumption uses the same checks. Call `assumeRole` through the source account. The
152
+ session belongs to the target role's account.
155
153
 
156
154
  ## Role chaining
157
155
 
158
- A process that assumes a Role and then assumes a second one from that session is chaining Roles. The
159
- caller of the second request is the session, and the Role it holds the permissions of is what both
160
- sides of the decision are written against. The trust policy of the target names that Role, and the
161
- identity policy allowing `sts:AssumeRole` belongs to it.
156
+ For role chaining, use the first session as the caller of the second `assumeRole` request. The target
157
+ trust policy names the first role, and that role needs identity permission to assume the target.
162
158
 
163
- Both ARNs of a session are matched against a `Principal`, so a trust policy naming either the Role
164
- or one particular session admits it. AWS recommends naming the Role, and a session name is often
165
- decided at run time rather than written into a policy.
159
+ A trust policy may name the role ARN or one assumed-role session ARN. Prefer the role ARN when the
160
+ session name is chosen at run time.
166
161
 
167
- Chaining over a served endpoint works the same way. Credentials from the first request sign the
168
- second, and the caller they resolve to carries the Role along with the session.
162
+ The served endpoint resolves session credentials in the same way.
169
163
 
170
164
  ## ExternalId
171
165
 
172
- A trust policy can require an external ID through the `sts:ExternalId` condition key. The
173
- `ExternalId` supplied to `AssumeRoleCommand` is matched against it.
166
+ A trust policy can require `sts:ExternalId`. Pass the matching `ExternalId` to `AssumeRoleCommand`.
174
167
 
175
168
  ```typescript sim-sts-external-id
176
169
  /**
@@ -214,14 +207,14 @@ const assumeRoleOutput = await account.sts().assumeRole(
214
207
  console.log(assumeRoleOutput.AssumedRoleUser?.Arn);
215
208
  ```
216
209
 
217
- An omitted or mismatched `ExternalId` leaves the trust-policy condition unmatched. The assume
218
- request is denied.
210
+ An omitted or mismatched value denies the request.
219
211
 
220
212
  ## Available functionality
221
213
 
222
214
  Sim STS currently supports:
223
215
 
224
216
  - `AssumeRoleCommand`
217
+ - `GetCallerIdentityCommand`
225
218
  - Trust-policy evaluation against the target Role's assume-role policy document
226
219
  - Identity-policy evaluation of the source caller, requiring `sts:AssumeRole` permission on the
227
220
  target Role
@@ -231,15 +224,9 @@ Sim STS currently supports:
231
224
  - Temporary credentials registered with the target Account's sim IAM, including session-token and
232
225
  expiry validation
233
226
 
234
- Unsupported STS options may be ignored or may throw errors depending on whether the simulator needs
235
- them to model the requested behaviour.
236
-
237
227
  ## Limitations
238
228
 
239
- Sim STS models Role assumption. Notable gaps:
240
-
241
- - `AssumeRoleCommand` is the only supported command. There is no `GetCallerIdentity`, federation, or
242
- web-identity support
229
+ - Federation, web identity and session-token commands are unsupported.
243
230
  - Session policies (`Policy` / `PolicyArns`), tags, and `SourceIdentity` requests are not evaluated
244
231
  - Condition support in trust policies is limited to the operators supported by
245
232
  [sim IAM](https://yulinsim.dev/services/iam/#policy-conditions)