@kensio/yulin 1.20.15 → 1.20.17

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 (355) hide show
  1. package/README.md +13 -0
  2. package/dist/sdk/module/sim-sdk-module-client-interceptor.d.ts +5 -0
  3. package/dist/sdk/module/sim-sdk-module-client-interceptor.js +14 -0
  4. package/dist/sdk/module/sim-sdk-static-client-factory.d.ts +26 -0
  5. package/dist/sdk/module/sim-sdk-static-client-factory.js +59 -0
  6. package/dist/sdk/send-patch.d.ts +8 -0
  7. package/dist/sdk/send-patch.js +11 -0
  8. package/dist/service/aws/caller/sim-aws-ambient-caller.d.ts +23 -0
  9. package/dist/service/aws/caller/sim-aws-ambient-caller.js +12 -0
  10. package/dist/service/aws/caller/sim-aws-caller-resolver.d.ts +39 -6
  11. package/dist/service/aws/caller/sim-aws-caller-resolver.js +32 -30
  12. package/dist/service/aws/caller/sim-aws-caller.d.ts +9 -0
  13. package/dist/service/aws/caller/sim-aws-resolved-caller.d.ts +19 -0
  14. package/dist/service/aws/caller/sim-aws-resolved-caller.js +26 -0
  15. package/dist/service/aws/factory/sim-aws-account-region-service-builder.d.ts +12 -0
  16. package/dist/service/aws/factory/sim-aws-account-region-service-builder.js +6 -0
  17. package/dist/service/aws/factory/sim-aws-account-service-cache.d.ts +12 -0
  18. package/dist/service/aws/factory/sim-aws-account-service-cache.js +9 -0
  19. package/dist/service/aws/factory/sim-aws-registered-service-builder.js +3 -1
  20. package/dist/service/aws/factory/sim-aws-service-factory.d.ts +5 -0
  21. package/dist/service/aws/factory/sim-aws-service-factory.js +14 -0
  22. package/dist/service/aws/sim-aws-properties.d.ts +15 -0
  23. package/dist/service/aws/sim-aws.js +2 -1
  24. package/dist/service/cloudformation/command/create-stack/create-stack.handler.d.ts +4 -0
  25. package/dist/service/cloudformation/command/create-stack/create-stack.handler.js +4 -1
  26. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.js +2 -1
  27. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-plan.d.ts +11 -2
  28. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-plan.js +2 -1
  29. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +6 -0
  30. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +11 -0
  31. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js +17 -15
  32. package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.d.ts +12 -0
  33. package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.js +2 -1
  34. package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cache-policy-cfn.d.ts +23 -0
  35. package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cache-policy-cfn.js +30 -0
  36. package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cfn-value-adapter.js +8 -0
  37. package/dist/service/cloudformation/resource/name/sim-cfn-generated-resource-name.d.ts +29 -12
  38. package/dist/service/cloudformation/resource/name/sim-cfn-generated-resource-name.js +51 -20
  39. package/dist/service/cloudformation/stack/deploy/sim-cfn-resource-order.d.ts +19 -0
  40. package/dist/service/cloudformation/stack/deploy/sim-cfn-resource-order.js +6 -0
  41. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-batch-creator.d.ts +7 -0
  42. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-batch-creator.js +9 -2
  43. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-creator.d.ts +2 -0
  44. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-creator.js +2 -1
  45. package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.d.ts +6 -0
  46. package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.js +4 -1
  47. package/dist/service/cloudformation/stack/sim-cfn-stack.js +2 -1
  48. package/dist/service/cloudformation/stack/sim-cfn-stack.type.d.ts +6 -0
  49. package/dist/service/cloudfront/behaviour/sim-cloud-front-behavior.d.ts +5 -0
  50. package/dist/service/cloudfront/cache-policy/sim-cf-cache-policy-registry.d.ts +37 -0
  51. package/dist/service/cloudfront/cache-policy/sim-cf-cache-policy-registry.js +50 -0
  52. package/dist/service/cloudfront/cache-policy/sim-cf-cache-policy.d.ts +25 -0
  53. package/dist/service/cloudfront/cache-policy/sim-cf-cache-policy.js +21 -0
  54. package/dist/service/cloudfront/cache-policy/sim-cf-managed-cache-policies.d.ts +28 -0
  55. package/dist/service/cloudfront/cache-policy/sim-cf-managed-cache-policies.js +48 -0
  56. package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.d.ts +8 -0
  57. package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.js +13 -0
  58. package/dist/service/cloudfront/cff/sim-cf-function-commands.d.ts +52 -0
  59. package/dist/service/cloudfront/cff/sim-cf-function-commands.js +51 -0
  60. package/dist/service/cloudfront/cff/sim-cff-configuration.d.ts +41 -0
  61. package/dist/service/cloudfront/cff/sim-cff-configuration.js +34 -0
  62. package/dist/service/cloudfront/cff/sim-cff-stage.d.ts +23 -0
  63. package/dist/service/cloudfront/cff/sim-cff-stage.js +30 -0
  64. package/dist/service/cloudfront/cff/sim-cloudfront-function.d.ts +6 -1
  65. package/dist/service/cloudfront/cff/sim-cloudfront-function.js +6 -0
  66. package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-config.d.ts +27 -0
  67. package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-config.js +42 -0
  68. package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-creator.d.ts +24 -0
  69. package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-creator.js +32 -0
  70. package/dist/service/cloudfront/cfn/distro/{sim-cfn-cf-distro-response-headers-policy.d.ts → sim-cfn-cf-distro-behavior-policies.d.ts} +8 -7
  71. package/dist/service/cloudfront/cfn/distro/{sim-cfn-cf-distro-response-headers-policy.js → sim-cfn-cf-distro-behavior-policies.js} +11 -37
  72. package/dist/service/cloudfront/cfn/distro/sim-cfn-cf-distro-creator.d.ts +6 -5
  73. package/dist/service/cloudfront/cfn/distro/sim-cfn-cf-distro-creator.js +8 -7
  74. package/dist/service/cloudfront/cfn/distro/sim-cfn-cf-distro-policy-drops.d.ts +23 -0
  75. package/dist/service/cloudfront/cfn/distro/sim-cfn-cf-distro-policy-drops.js +50 -0
  76. package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.d.ts +1 -0
  77. package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.js +10 -0
  78. package/dist/service/cloudfront/command/create-distribution/create-distribution.command.d.ts +1 -0
  79. package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts +2 -0
  80. package/dist/service/cloudfront/command/create-function/create-function.handler.js +7 -1
  81. package/dist/service/cloudfront/command/function/sim-cf-describe-function.d.ts +22 -0
  82. package/dist/service/cloudfront/command/function/sim-cf-describe-function.js +32 -0
  83. package/dist/service/cloudfront/command/function/sim-cf-function-access.d.ts +48 -0
  84. package/dist/service/cloudfront/command/function/sim-cf-function-access.js +48 -0
  85. package/dist/service/cloudfront/command/function/sim-cf-function-command.types.d.ts +97 -0
  86. package/dist/service/cloudfront/command/function/sim-cf-function-command.types.js +10 -0
  87. package/dist/service/cloudfront/command/function/sim-cf-function-lookup.d.ts +12 -0
  88. package/dist/service/cloudfront/command/function/sim-cf-function-lookup.js +21 -0
  89. package/dist/service/cloudfront/command/function/sim-cf-function-summary.d.ts +11 -0
  90. package/dist/service/cloudfront/command/function/sim-cf-function-summary.js +30 -0
  91. package/dist/service/cloudfront/command/function/sim-cf-get-function.d.ts +23 -0
  92. package/dist/service/cloudfront/command/function/sim-cf-get-function.js +33 -0
  93. package/dist/service/cloudfront/command/function/sim-cf-list-functions.d.ts +22 -0
  94. package/dist/service/cloudfront/command/function/sim-cf-list-functions.js +38 -0
  95. package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts +2 -0
  96. package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-cache-policy.d.ts +18 -0
  97. package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-cache-policy.js +30 -0
  98. package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-policies.d.ts +28 -0
  99. package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-policies.js +41 -0
  100. package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts +2 -2
  101. package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js +6 -3
  102. package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.d.ts +0 -10
  103. package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.js +0 -19
  104. package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.d.ts +2 -0
  105. package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.js +4 -2
  106. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.d.ts +3 -3
  107. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.js +5 -5
  108. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts +3 -3
  109. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js +4 -4
  110. package/dist/service/cloudfront/distribution/sim-cf-distribution-configuration-state.d.ts +3 -1
  111. package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.d.ts +2 -0
  112. package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +21 -0
  113. package/dist/service/cloudfront/error/sim-cloudfront.error.js +25 -0
  114. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.js +2 -10
  115. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.js +2 -1
  116. package/dist/service/cloudfront/sdk/sim-cloudfront-sdk-command-router.js +12 -0
  117. package/dist/service/cloudfront/sim-cf-authorize.d.ts +16 -0
  118. package/dist/service/cloudfront/sim-cf-authorize.js +19 -0
  119. package/dist/service/cloudfront/sim-cf-etag.d.ts +7 -0
  120. package/dist/service/cloudfront/sim-cf-etag.js +10 -0
  121. package/dist/service/cloudfront/sim-cloudfront-commands.d.ts +8 -12
  122. package/dist/service/cloudfront/sim-cloudfront-commands.js +8 -17
  123. package/dist/service/cloudfront/sim-cloudfront-policies.d.ts +43 -0
  124. package/dist/service/cloudfront/sim-cloudfront-policies.js +53 -0
  125. package/dist/service/cloudfront/sim-cloudfront.d.ts +13 -17
  126. package/dist/service/cloudfront/sim-cloudfront.js +22 -25
  127. package/dist/service/ecr/authorize/sim-ecr-authorizer.d.ts +31 -0
  128. package/dist/service/ecr/authorize/sim-ecr-authorizer.js +38 -0
  129. package/dist/service/ecr/cfn/repository/sim-cfn-ecr-repository-creator.d.ts +11 -2
  130. package/dist/service/ecr/cfn/repository/sim-cfn-ecr-repository-creator.js +11 -2
  131. package/dist/service/ecr/cfn/sim-ecr-cfn-resource-factory.d.ts +4 -2
  132. package/dist/service/ecr/cfn/sim-ecr-cfn-resource-factory.js +8 -9
  133. package/dist/service/ecr/cfn/sim-ecr-cfn-unsupported-resource.d.ts +7 -0
  134. package/dist/service/ecr/cfn/sim-ecr-cfn-unsupported-resource.js +9 -0
  135. package/dist/service/ecr/sim-ecr.d.ts +7 -0
  136. package/dist/service/ecr/sim-ecr.js +16 -4
  137. package/dist/service/ecs/command/authorize/sim-ecs-authorizer.d.ts +12 -0
  138. package/dist/service/ecs/command/authorize/sim-ecs-authorizer.js +21 -0
  139. package/dist/service/ecs/command/register-task-definition/register-task-definition.handler.js +1 -0
  140. package/dist/service/ecs/sim-ecs-service-principal.d.ts +8 -0
  141. package/dist/service/ecs/sim-ecs-service-principal.js +8 -0
  142. package/dist/service/eventbridge/command/authorize/sim-event-bridge-authorizer.d.ts +12 -0
  143. package/dist/service/eventbridge/command/authorize/sim-event-bridge-authorizer.js +21 -0
  144. package/dist/service/eventbridge/command/rule/sim-event-bridge-rule-access.d.ts +13 -0
  145. package/dist/service/eventbridge/command/rule/sim-event-bridge-rule-access.js +9 -0
  146. package/dist/service/eventbridge/command/target/sim-event-bridge-put-targets.js +1 -0
  147. package/dist/service/firehose/command/authorize/sim-firehose-authorizer.d.ts +12 -0
  148. package/dist/service/firehose/command/authorize/sim-firehose-authorizer.js +20 -0
  149. package/dist/service/firehose/command/sim-firehose-delivery-stream-access.d.ts +4 -0
  150. package/dist/service/firehose/command/sim-firehose-delivery-stream-access.js +6 -0
  151. package/dist/service/firehose/command/stream/sim-firehose-create-delivery-stream.js +3 -1
  152. package/dist/service/firehose/sim-firehose-service-principal.d.ts +8 -0
  153. package/dist/service/firehose/sim-firehose-service-principal.js +8 -0
  154. package/dist/service/firehose/source/sim-firehose-source.d.ts +5 -0
  155. package/dist/service/firehose/source/sim-firehose-source.js +5 -0
  156. package/dist/service/glue/cfn/database/sim-cfn-glue-database-properties.js +2 -2
  157. package/dist/service/glue/cfn/sim-cfn-glue-generated-name.d.ts +10 -0
  158. package/dist/service/glue/cfn/sim-cfn-glue-generated-name.js +25 -0
  159. package/dist/service/glue/cfn/table/sim-cfn-glue-table-properties.js +2 -3
  160. package/dist/service/iam/authorize/allow/sim-iam-allow-requirement.d.ts +33 -2
  161. package/dist/service/iam/authorize/allow/sim-iam-allow-requirement.js +33 -2
  162. package/dist/service/iam/authorize/allow/sim-iam-allow-statements.d.ts +4 -3
  163. package/dist/service/iam/authorize/allow/sim-iam-allow-statements.js +9 -3
  164. package/dist/service/iam/authorize/context/sim-iam-auth-z-allow-requirement.d.ts +14 -5
  165. package/dist/service/iam/authorize/context/sim-iam-auth-z-allow-requirement.js +16 -12
  166. package/dist/service/iam/authorize/context/sim-iam-auth-z-caller-context-builder.d.ts +36 -7
  167. package/dist/service/iam/authorize/context/sim-iam-auth-z-caller-context-builder.js +22 -11
  168. package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.d.ts +10 -71
  169. package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.js +7 -2
  170. package/dist/service/iam/authorize/context/sim-iam-auth-z-input.d.ts +87 -0
  171. package/dist/service/iam/authorize/context/sim-iam-auth-z-input.js +1 -0
  172. package/dist/service/iam/authorize/match/sim-iam-policy-principal-matcher.d.ts +21 -3
  173. package/dist/service/iam/authorize/match/sim-iam-policy-principal-matcher.js +34 -10
  174. package/dist/service/iam/authorize/match/sim-iam-principal-match.d.ts +29 -8
  175. package/dist/service/iam/authorize/match/sim-iam-principal-match.js +38 -13
  176. package/dist/service/iam/authorize/pass-role/sim-iam-pass-role-authorizer.d.ts +74 -0
  177. package/dist/service/iam/authorize/pass-role/sim-iam-pass-role-authorizer.js +92 -0
  178. package/dist/service/iam/authorize/sim-iam-account-auth-z.d.ts +21 -5
  179. package/dist/service/iam/authorize/sim-iam-account-auth-z.js +7 -3
  180. package/dist/service/iam/authorize/sim-iam-authorizer.d.ts +5 -2
  181. package/dist/service/iam/authorize/sim-iam-authorizer.js +3 -1
  182. package/dist/service/iam/authorize/sim-iam-inter-service-auth-z.d.ts +1 -1
  183. package/dist/service/iam/authorize/sim-iam-wildcard.js +39 -4
  184. package/dist/service/iam/cfn/managed-policy/sim-cfn-iam-managed-policy-creator.js +2 -1
  185. package/dist/service/iam/cfn/name/sim-cfn-iam-generated-name.d.ts +16 -0
  186. package/dist/service/iam/cfn/name/sim-cfn-iam-generated-name.js +36 -0
  187. package/dist/service/iam/cfn/role/sim-cfn-iam-role-properties-parser.js +9 -8
  188. package/dist/service/iam/cfn/sim-cfn-iam-optional-string.d.ts +17 -0
  189. package/dist/service/iam/cfn/sim-cfn-iam-optional-string.js +17 -0
  190. package/dist/service/iam/cfn/user/sim-cfn-iam-user-properties-parser.js +4 -8
  191. package/dist/service/iam/command/policy/create-policy/create-policy-input-resolver.js +2 -0
  192. package/dist/service/iam/command/policy/put-role-policy/put-role-policy.handler.js +5 -0
  193. package/dist/service/iam/command/policy/put-user-policy/put-user-policy.handler.js +5 -0
  194. package/dist/service/iam/command/role/create-role/create-role.handler.js +4 -1
  195. package/dist/service/iam/error/sim-iam.error.d.ts +11 -0
  196. package/dist/service/iam/error/sim-iam.error.js +13 -0
  197. package/dist/service/iam/index.d.ts +1 -0
  198. package/dist/service/iam/policy/sim-iam-policy-document-of-size.d.ts +18 -0
  199. package/dist/service/iam/policy/sim-iam-policy-document-of-size.js +41 -0
  200. package/dist/service/iam/role/sim-iam-deploy-role.d.ts +56 -0
  201. package/dist/service/iam/role/sim-iam-deploy-role.js +50 -0
  202. package/dist/service/iam/role/sim-iam-role-with-policy.factory.d.ts +11 -0
  203. package/dist/service/iam/role/sim-iam-role-with-policy.factory.js +4 -2
  204. package/dist/service/iam/sim-iam-account-parts.d.ts +16 -0
  205. package/dist/service/iam/sim-iam-account-parts.js +2 -0
  206. package/dist/service/iam/sim-iam.d.ts +12 -2
  207. package/dist/service/iam/sim-iam.js +12 -0
  208. package/dist/service/iam/validate/size/sim-iam-policy-document-size.d.ts +57 -0
  209. package/dist/service/iam/validate/size/sim-iam-policy-document-size.js +71 -0
  210. package/dist/service/kms/command/authorize/sim-kms-authorizer.d.ts +3 -1
  211. package/dist/service/kms/command/authorize/sim-kms-authorizer.js +4 -1
  212. package/dist/service/kms/command/sim-kms-request-options.d.ts +11 -0
  213. package/dist/service/kms/key/sim-kms-key-policy.d.ts +5 -4
  214. package/dist/service/kms/key/sim-kms-key-policy.js +4 -3
  215. package/dist/service/lambda/cfn/function/sim-cfn-lambda-function-properties-parser.d.ts +2 -2
  216. package/dist/service/lambda/cfn/function/sim-cfn-lambda-function-properties-parser.js +4 -3
  217. package/dist/service/lambda/cfn/function/sim-cfn-lambda-generated-function-name.d.ts +10 -0
  218. package/dist/service/lambda/cfn/function/sim-cfn-lambda-generated-function-name.js +25 -0
  219. package/dist/service/lambda/command/authorize/sim-lambda-resource-policies.d.ts +1 -1
  220. package/dist/service/lambda/command/create-function/create-function-authorizer.d.ts +9 -2
  221. package/dist/service/lambda/command/create-function/create-function-authorizer.js +16 -2
  222. package/dist/service/lambda/command/create-function/create-function.handler.js +1 -1
  223. package/dist/service/lambda/command/update-function-configuration/update-function-configuration-authorizer.d.ts +7 -2
  224. package/dist/service/lambda/command/update-function-configuration/update-function-configuration-authorizer.js +14 -2
  225. package/dist/service/lambda/command/update-function-configuration/update-function-configuration.handler.js +1 -1
  226. package/dist/service/lambda/function/logging/sim-lambda-function-logging.d.ts +10 -1
  227. package/dist/service/lambda/function/logging/sim-lambda-function-logging.js +25 -1
  228. package/dist/service/lambda/function/logging/sim-lambda-invoke-error-log.d.ts +13 -0
  229. package/dist/service/lambda/function/logging/sim-lambda-invoke-error-log.js +18 -0
  230. package/dist/service/lambda/sim-lambda-service-principal.d.ts +7 -0
  231. package/dist/service/lambda/sim-lambda-service-principal.js +7 -0
  232. package/dist/service/logs/cfn/delivery/sim-cfn-delivery-authorization.d.ts +46 -0
  233. package/dist/service/logs/cfn/delivery/sim-cfn-delivery-authorization.js +49 -0
  234. package/dist/service/logs/cfn/delivery/sim-cfn-delivery-creator.d.ts +5 -0
  235. package/dist/service/logs/cfn/delivery/sim-cfn-delivery-creator.js +6 -0
  236. package/dist/service/logs/cfn/delivery/sim-cfn-delivery-destination-creator.d.ts +5 -0
  237. package/dist/service/logs/cfn/delivery/sim-cfn-delivery-destination-creator.js +6 -0
  238. package/dist/service/logs/cfn/delivery/sim-cfn-delivery-source-creator.d.ts +5 -0
  239. package/dist/service/logs/cfn/delivery/sim-cfn-delivery-source-creator.js +6 -0
  240. package/dist/service/logs/cfn/group/sim-cfn-log-group-creator.d.ts +9 -2
  241. package/dist/service/logs/cfn/group/sim-cfn-log-group-creator.js +34 -5
  242. package/dist/service/logs/cfn/sim-logs-cfn-resource-deleter.js +1 -1
  243. package/dist/service/logs/cfn/sim-logs-cfn-resource-factory.d.ts +4 -0
  244. package/dist/service/logs/cfn/sim-logs-cfn-resource-factory.js +9 -4
  245. package/dist/service/logs/sim-logs-commands.d.ts +3 -0
  246. package/dist/service/logs/sim-logs-commands.js +4 -0
  247. package/dist/service/logs/sim-logs.js +6 -1
  248. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-creator.d.ts +2 -2
  249. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-creator.js +4 -3
  250. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-generated-name.d.ts +12 -0
  251. package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-generated-name.js +22 -0
  252. package/dist/service/s3/command/authorize/sim-s3-bucket-resource-policies.d.ts +1 -1
  253. package/dist/service/scheduler/command/authorize/sim-scheduler-authorizer.d.ts +10 -1
  254. package/dist/service/scheduler/command/authorize/sim-scheduler-authorizer.js +19 -1
  255. package/dist/service/scheduler/command/schedule/sim-scheduler-create-schedule.js +1 -0
  256. package/dist/service/scheduler/command/schedule/sim-scheduler-schedule-access.d.ts +8 -0
  257. package/dist/service/scheduler/command/schedule/sim-scheduler-schedule-access.js +9 -0
  258. package/dist/service/scheduler/command/schedule/sim-scheduler-update-schedule.js +1 -0
  259. package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-generated-name.d.ts +15 -0
  260. package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-generated-name.js +22 -0
  261. package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-secret-properties.d.ts +4 -10
  262. package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-secret-properties.js +13 -31
  263. package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-secret-value.d.ts +17 -0
  264. package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-secret-value.js +30 -0
  265. package/dist/service/secretsmanager/secret/sim-secrets-manager-secret-name.d.ts +6 -0
  266. package/dist/service/secretsmanager/secret/sim-secrets-manager-secret-name.js +8 -3
  267. package/dist/service/sns/command/authorize/sim-sns-topic-resource-policies.d.ts +1 -1
  268. package/dist/service/sqs/command/authorize/sim-sqs-queue-resource-policies.d.ts +1 -1
  269. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-generated-parameter-name.d.ts +16 -0
  270. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-generated-parameter-name.js +23 -0
  271. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.d.ts +2 -4
  272. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.js +5 -5
  273. package/dist/service/ssm/parameter/sim-ssm-kms-crypto.d.ts +6 -4
  274. package/dist/service/ssm/parameter/sim-ssm-kms-crypto.js +4 -4
  275. package/dist/service/ssm/parameter/sim-ssm-parameter-arn.d.ts +17 -0
  276. package/dist/service/ssm/parameter/sim-ssm-parameter-arn.js +20 -0
  277. package/dist/service/ssm/parameter/sim-ssm-parameter-kms.d.ts +15 -9
  278. package/dist/service/ssm/parameter/sim-ssm-parameter-kms.js +20 -10
  279. package/dist/service/ssm/parameter/sim-ssm-parameter-name.js +3 -12
  280. package/dist/service/stepfunctions/command/authorize/sim-step-functions-authorizer.d.ts +41 -0
  281. package/dist/service/stepfunctions/command/authorize/sim-step-functions-authorizer.js +64 -0
  282. package/dist/service/stepfunctions/command/machine/sim-state-machine-create.d.ts +5 -2
  283. package/dist/service/stepfunctions/command/machine/sim-state-machine-create.js +6 -2
  284. package/dist/service/stepfunctions/command/machine/sim-state-machine-delete.d.ts +26 -0
  285. package/dist/service/stepfunctions/command/machine/sim-state-machine-delete.js +29 -0
  286. package/dist/service/stepfunctions/command/machine/sim-state-machine-lookup.d.ts +7 -0
  287. package/dist/service/stepfunctions/command/machine/sim-state-machine-lookup.js +12 -3
  288. package/dist/service/stepfunctions/command/machine/sim-state-machine-update.d.ts +19 -0
  289. package/dist/service/stepfunctions/command/machine/{sim-state-machine-writes.js → sim-state-machine-update.js} +3 -14
  290. package/dist/service/stepfunctions/sim-step-functions.d.ts +8 -2
  291. package/dist/service/stepfunctions/sim-step-functions.js +26 -9
  292. package/dist/service/sts/auth-z/assume-role-auth-z-coordinator.d.ts +9 -2
  293. package/dist/service/sts/auth-z/assume-role-auth-z-coordinator.js +2 -2
  294. package/dist/service/sts/auth-z/assume-role-source-account-auth-z.d.ts +10 -4
  295. package/dist/service/sts/auth-z/assume-role-source-account-auth-z.js +8 -7
  296. package/dist/service/sts/auth-z/assume-role-target-auth-z.d.ts +2 -2
  297. package/dist/service/sts/auth-z/assume-role-trust-policy-authorizer.d.ts +6 -2
  298. package/dist/service/sts/auth-z/assume-role-trust-policy-authorizer.js +14 -11
  299. package/dist/service/sts/command/assume-role/assume-role.handler.d.ts +10 -1
  300. package/dist/service/sts/command/assume-role/assume-role.handler.js +6 -2
  301. package/dist/service/sts/command/get-caller-identity/get-caller-identity.handler.d.ts +10 -1
  302. package/dist/service/sts/command/get-caller-identity/get-caller-identity.handler.js +5 -1
  303. package/dist/service/sts/service-role/sim-service-role.js +5 -1
  304. package/dist/service/sts/sim-sts.d.ts +18 -1
  305. package/dist/service/sts/sim-sts.js +8 -0
  306. package/dist/util/memo/bounded-memo.d.ts +36 -0
  307. package/dist/util/memo/bounded-memo.js +58 -0
  308. package/docs/README.md +54 -0
  309. package/docs/ai-skill/README.md +69 -0
  310. package/docs/cli/README.md +284 -0
  311. package/docs/factories/README.md +140 -0
  312. package/docs/lint/README.md +176 -0
  313. package/docs/non-aws-dependencies/README.md +261 -0
  314. package/docs/sdk/README.md +274 -0
  315. package/docs/serve/README.md +1126 -0
  316. package/docs/services/acm/README.md +823 -0
  317. package/docs/services/apigateway/README.md +1919 -0
  318. package/docs/services/apigatewayv2/README.md +2678 -0
  319. package/docs/services/athena/README.md +1044 -0
  320. package/docs/services/bedrock/README.md +350 -0
  321. package/docs/services/cloudformation/README.md +3625 -0
  322. package/docs/services/cloudfront/README.md +3098 -0
  323. package/docs/services/cloudwatch/README.md +422 -0
  324. package/docs/services/cognito/README.md +4924 -0
  325. package/docs/services/dynamodb/README.md +3785 -0
  326. package/docs/services/ecr/README.md +302 -0
  327. package/docs/services/ecs/README.md +2021 -0
  328. package/docs/services/elbv2/README.md +1901 -0
  329. package/docs/services/eventbridge/README.md +1118 -0
  330. package/docs/services/firehose/README.md +811 -0
  331. package/docs/services/glue/README.md +507 -0
  332. package/docs/services/iam/README.md +1578 -0
  333. package/docs/services/kinesis/README.md +455 -0
  334. package/docs/services/kms/README.md +664 -0
  335. package/docs/services/lambda/README.md +3719 -0
  336. package/docs/services/logs/README.md +882 -0
  337. package/docs/services/organizations/README.md +574 -0
  338. package/docs/services/personalize/README.md +835 -0
  339. package/docs/services/rekognition/README.md +1070 -0
  340. package/docs/services/route53/README.md +1783 -0
  341. package/docs/services/s3/README.md +3029 -0
  342. package/docs/services/scheduler/README.md +814 -0
  343. package/docs/services/secretsmanager/README.md +670 -0
  344. package/docs/services/ses/README.md +1013 -0
  345. package/docs/services/sns/README.md +1904 -0
  346. package/docs/services/sqs/README.md +1185 -0
  347. package/docs/services/ssm/README.md +1096 -0
  348. package/docs/services/stepfunctions/README.md +1341 -0
  349. package/docs/services/sts/README.md +245 -0
  350. package/docs/services/wafv2/README.md +1380 -0
  351. package/docs/terraform/README.md +248 -0
  352. package/docs/time/README.md +284 -0
  353. package/llms.txt +59 -0
  354. package/package.json +7 -4
  355. package/dist/service/stepfunctions/command/machine/sim-state-machine-writes.d.ts +0 -25
@@ -0,0 +1,1118 @@
1
+ # Simulated EventBridge
2
+
3
+ Yulin includes a simulated Amazon EventBridge for tests and local development. Event buses are held
4
+ in memory and every operation is authorized by simulated IAM.
5
+
6
+ Event buses, rules, targets and `PutEvents`. A rule can send matched events to a simulated Lambda
7
+ function, SQS queue or SNS topic, run a simulated ECS task, or fire on a schedule when a test
8
+ advances simulated time. [EventBridge Scheduler](https://yulinsim.dev/services/scheduler/) is a separate service with its own
9
+ docs. EventBridge-specific types are imported from the `@kensio/yulin/eventbridge` subpath.
10
+
11
+ ## Putting an event onto a bus
12
+
13
+ ```typescript sim-event-bridge-put-events
14
+ /**
15
+ * Putting an event onto the default event bus.
16
+ */
17
+
18
+ import { PutEventsCommand } from "@aws-sdk/client-eventbridge";
19
+
20
+ import { SimAws } from "@kensio/yulin";
21
+
22
+ const simAws = new SimAws();
23
+ const events = simAws.eventBridge();
24
+
25
+ const output = await events.putEvents(
26
+ new PutEventsCommand({
27
+ Entries: [
28
+ {
29
+ Source: "orders.service",
30
+ DetailType: "OrderPlaced",
31
+ Detail: JSON.stringify({ orderId: "order-1", total: 4200 }),
32
+ },
33
+ ],
34
+ }),
35
+ );
36
+
37
+ console.log(output.FailedEntryCount); // 0
38
+ console.log(output.Entries?.[0]?.EventId !== undefined); // true
39
+ ```
40
+
41
+ Every account and region has a `default` bus without one being created, and an entry that names no
42
+ bus goes to it. A request carries between one and ten entries, and they are independent. Each may
43
+ name a different bus, and one that fails leaves the others alone.
44
+
45
+ `Detail`, `DetailType` and `Source` are all optional in the API model, and all three are needed for
46
+ EventBridge to take an entry. An entry missing one fails on its own, with the rest of the request
47
+ going through. A request in which no entry carries all three fails outright.
48
+
49
+ The size limit applies to the whole request. The entries together come to less than 1 MB, measured
50
+ the way AWS measures them, where a `Time` counts as 14 bytes and `Source`, `DetailType`, `Detail`
51
+ and each `Resources` entry count as the length of their UTF-8 forms.
52
+
53
+ ## Creating an event bus
54
+
55
+ ```typescript sim-event-bridge-create-bus
56
+ /**
57
+ * Creating a custom event bus and putting an event onto it.
58
+ */
59
+
60
+ import {
61
+ CreateEventBusCommand,
62
+ DescribeEventBusCommand,
63
+ PutEventsCommand,
64
+ } from "@aws-sdk/client-eventbridge";
65
+
66
+ import { SimAws } from "@kensio/yulin";
67
+
68
+ const simAws = new SimAws();
69
+ const events = simAws.eventBridge();
70
+
71
+ const created = await events.createEventBus(
72
+ new CreateEventBusCommand({ Name: "orders" }),
73
+ );
74
+
75
+ console.log(created.EventBusArn);
76
+ // "arn:aws:events:us-east-1:888888888888:event-bus/orders"
77
+
78
+ await events.putEvents(
79
+ new PutEventsCommand({
80
+ Entries: [
81
+ {
82
+ EventBusName: "orders",
83
+ Source: "orders.service",
84
+ DetailType: "OrderPlaced",
85
+ Detail: JSON.stringify({ orderId: "order-1" }),
86
+ },
87
+ ],
88
+ }),
89
+ );
90
+
91
+ const described = await events.describeEventBus(
92
+ new DescribeEventBusCommand({ Name: "orders" }),
93
+ );
94
+
95
+ console.log(described.Name); // "orders"
96
+ ```
97
+
98
+ A bus ARN is `arn:aws:events:<region>:<account-id>:event-bus/<name>`. Unlike an SNS topic ARN it
99
+ carries a resource type. An IAM policy naming a bus has the `event-bus/` in it.
100
+
101
+ A bus name is up to 256 characters of letters, numbers, full stops, hyphens and underscores.
102
+ Creating one that already exists is refused with `ResourceAlreadyExistsException`, which includes
103
+ `default`, since that bus is always there. That differs from SNS `CreateTopic`, which answers a
104
+ repeated create with the existing topic.
105
+
106
+ `DescribeEventBus` takes a name or a bus ARN, and describes the default bus when the request names
107
+ neither. `ListEventBuses` reports the default bus alongside the custom ones, narrowed by
108
+ `NamePrefix` and paged by `Limit` and `NextToken`.
109
+
110
+ `DeleteEventBus` frees the name at once, ready to be reused straight away. Deleting a bus that was
111
+ never there succeeds. The default bus stays.
112
+
113
+ ## Events put onto an unknown bus
114
+
115
+ An event put onto a bus that was never created **succeeds**:
116
+
117
+ ```typescript sim-event-bridge-missing-bus
118
+ /**
119
+ * An event put onto a bus that does not exist is accepted and dropped.
120
+ */
121
+
122
+ import { PutEventsCommand } from "@aws-sdk/client-eventbridge";
123
+
124
+ import { SimAws } from "@kensio/yulin";
125
+
126
+ const simAws = new SimAws();
127
+
128
+ const output = await simAws.eventBridge().putEvents(
129
+ new PutEventsCommand({
130
+ Entries: [
131
+ {
132
+ EventBusName: "odrers", // A typo, and nothing says so.
133
+ Source: "orders.service",
134
+ DetailType: "OrderPlaced",
135
+ Detail: JSON.stringify({ orderId: "order-1" }),
136
+ },
137
+ ],
138
+ }),
139
+ );
140
+
141
+ console.log(output.FailedEntryCount); // 0
142
+ console.log(output.Entries?.[0]?.EventId !== undefined); // true
143
+ ```
144
+
145
+ This is real EventBridge behaviour, and not a gap here. AWS answers 200, finds no rule to match the
146
+ event against, and drops it, without counting the entry as failed. A mistyped bus name therefore
147
+ looks exactly like a working call. That is worth knowing before it costs an afternoon, and the
148
+ simulation reproduces it faithfully.
149
+
150
+ ## Inspecting what a bus received
151
+
152
+ Real EventBridge keeps no events, and there is no API for reading them back. For tests,
153
+ `eventsOn(...)` reports what a bus received, in arrival order. It is a simulator accessor and not a
154
+ simulated API. No SDK command builds its answer from it.
155
+
156
+ ```typescript sim-event-bridge-inspecting-events
157
+ /**
158
+ * Asserting on the envelope EventBridge built from an entry.
159
+ */
160
+
161
+ import { PutEventsCommand } from "@aws-sdk/client-eventbridge";
162
+
163
+ import { SimAws, SimFixedClock } from "@kensio/yulin";
164
+
165
+ const simAws = new SimAws({
166
+ defaultAccountId: "111111111111",
167
+ defaultRegionName: "eu-west-2",
168
+ clock: new SimFixedClock(new Date("2026-07-26T09:00:00.000Z")),
169
+ });
170
+
171
+ await simAws.eventBridge().putEvents(
172
+ new PutEventsCommand({
173
+ Entries: [
174
+ {
175
+ Source: "orders.service",
176
+ DetailType: "OrderPlaced",
177
+ Detail: JSON.stringify({ orderId: "order-1" }),
178
+ Resources: ["arn:aws:s3:::orders"],
179
+ },
180
+ ],
181
+ }),
182
+ );
183
+
184
+ const [event] = simAws.eventBridge().eventsOn("default");
185
+
186
+ console.log(event?.toEnvelope());
187
+ // {
188
+ // version: "0",
189
+ // id: "0f2c...",
190
+ // "detail-type": "OrderPlaced",
191
+ // source: "orders.service",
192
+ // account: "111111111111",
193
+ // time: "2026-07-26T09:00:00Z",
194
+ // region: "eu-west-2",
195
+ // resources: ["arn:aws:s3:::orders"],
196
+ // detail: { orderId: "order-1" },
197
+ // }
198
+ ```
199
+
200
+ The envelope is the shape a rule matches against and a target receives. An entry that names no
201
+ `Time` is stamped from the simulation's own clock, giving a test with a fixed clock a predictable
202
+ timestamp. The timestamp is written to the second, as real EventBridge writes it.
203
+
204
+ ## Matching events with rules
205
+
206
+ A rule watches one bus and matches events against an event pattern.
207
+
208
+ ```typescript sim-event-bridge-rules
209
+ /**
210
+ * A rule matching order events on a bus.
211
+ */
212
+
213
+ import { PutEventsCommand, PutRuleCommand } from "@aws-sdk/client-eventbridge";
214
+
215
+ import { SimAws } from "@kensio/yulin";
216
+
217
+ const simAws = new SimAws();
218
+ const events = simAws.eventBridge();
219
+
220
+ await events.putRule(
221
+ new PutRuleCommand({
222
+ Name: "large-orders",
223
+ EventPattern: JSON.stringify({
224
+ source: ["orders.service"],
225
+ "detail-type": ["OrderPlaced"],
226
+ detail: { total: [{ numeric: [">=", 1000] }] },
227
+ }),
228
+ }),
229
+ );
230
+
231
+ await events.putEvents(
232
+ new PutEventsCommand({
233
+ Entries: [
234
+ {
235
+ Source: "orders.service",
236
+ DetailType: "OrderPlaced",
237
+ Detail: JSON.stringify({ orderId: "order-1", total: 4200 }),
238
+ },
239
+ ],
240
+ }),
241
+ );
242
+
243
+ const [receipt] = events.receiptsOn("default");
244
+
245
+ console.log(receipt?.matchedRuleNames); // ["large-orders"]
246
+ ```
247
+
248
+ A rule name is up to 64 characters, shorter than a bus name, and it is unique within one bus and not
249
+ within the account. A rule ARN on the default bus is
250
+ `arn:aws:events:<region>:<account>:rule/<name>`, and a rule on a custom bus carries the bus as well,
251
+ as `rule/<bus>/<name>`.
252
+
253
+ `PutRule` creates and updates alike, and an update **replaces** the rule rather than merging into
254
+ it. A second request that leaves out the description clears the description. That is real behaviour
255
+ and a common surprise.
256
+
257
+ `DisableRule` stops a rule matching, and `EnableRule` starts it again. A rule that was off picks up
258
+ from the next event and leaves what it missed behind. `DeleteRule` on a rule that was never there
259
+ succeeds. Deleting a bus deletes its rules with it.
260
+
261
+ `receiptsOn(...)` is a simulator accessor. It reports what a bus received and which rules each event
262
+ matched. A test can assert on routing before there are targets to watch.
263
+
264
+ ## Event patterns
265
+
266
+ A pattern has the same shape as the events it matches. Every key of a pattern has to match, making
267
+ the keys an "and". A field's conditions are written as a list, and any one matching is enough,
268
+ making the list an "or".
269
+
270
+ Supported conditions:
271
+
272
+ | Condition | Written as |
273
+ | ------------------------------ | ------------------------------------------------------ |
274
+ | Exact value, or any of several | `"source": ["orders.service", "billing.service"]` |
275
+ | Nested field | `"detail": { "customer": { "tier": ["gold"] } }` |
276
+ | Begins with | `"time": [{ "prefix": "2026-07-26" }]` |
277
+ | Ends with | `"FileName": [{ "suffix": ".png" }]` |
278
+ | Anything but | `"state": [{ "anything-but": ["stopped", "failed"] }]` |
279
+ | Numeric, and ranges | `"total": [{ "numeric": [">", 0, "<=", 5000] }]` |
280
+ | Field is or is not there | `"refundId": [{ "exists": false }]` |
281
+
282
+ Values are compared by type. The string `"5"` in a pattern does not match the number `5` in an
283
+ event. `null` and the empty string are values like any other. Where the event carries a list for a
284
+ field, the pattern matches when the two lists overlap, and a pattern naming one ARN then matches an
285
+ event whose `resources` names several. `exists` is about the field and not its members, and a field
286
+ carrying an empty list still exists.
287
+
288
+ Anything else is refused at `PutRule`. The `cidr`, `equals-ignore-case`, `wildcard` and `$or`
289
+ operators are all refused by name, as are the nested forms of `anything-but` and the
290
+ case-insensitive forms of `prefix` and `suffix`. A pattern that silently matched nothing would look
291
+ like a pattern that was simply too specific, and the rule would go unnoticed until the deployment.
292
+
293
+ ## Testing a pattern without a rule
294
+
295
+ `TestEventPattern` answers whether one event matches one pattern, creating no rule:
296
+
297
+ ```typescript sim-event-bridge-test-pattern
298
+ /**
299
+ * Checking a pattern against an event before writing a rule with it.
300
+ */
301
+
302
+ import { TestEventPatternCommand } from "@aws-sdk/client-eventbridge";
303
+
304
+ import { SimAws } from "@kensio/yulin";
305
+
306
+ const simAws = new SimAws();
307
+
308
+ const { Result } = await simAws.eventBridge().testEventPattern(
309
+ new TestEventPatternCommand({
310
+ EventPattern: JSON.stringify({
311
+ detail: { total: [{ numeric: [">=", 1000] }] },
312
+ }),
313
+ Event: JSON.stringify({
314
+ source: "orders.service",
315
+ "detail-type": "OrderPlaced",
316
+ detail: { orderId: "order-1", total: 4200 },
317
+ }),
318
+ }),
319
+ );
320
+
321
+ console.log(Result); // true
322
+ ```
323
+
324
+ This is the quickest way to find out why a rule stays quiet, and a pattern this simulation cannot
325
+ evaluate is refused here exactly as `PutRule` refuses it.
326
+
327
+ ## Sending matched events to targets
328
+
329
+ A rule sends every event it matches to each of its targets. A target is a simulated Lambda function,
330
+ SQS queue or SNS topic, or an ECS cluster where the rule runs a task. See
331
+ [running an ECS task](#running-an-ecs-task).
332
+
333
+ ```typescript sim-event-bridge-targets
334
+ /**
335
+ * A rule sending order events to a queue.
336
+ */
337
+
338
+ import {
339
+ PutEventsCommand,
340
+ PutRuleCommand,
341
+ PutTargetsCommand,
342
+ } from "@aws-sdk/client-eventbridge";
343
+ import {
344
+ CreateQueueCommand,
345
+ ReceiveMessageCommand,
346
+ SetQueueAttributesCommand,
347
+ } from "@aws-sdk/client-sqs";
348
+
349
+ import { SimAws } from "@kensio/yulin";
350
+
351
+ const simAws = new SimAws();
352
+ const queueArn = "arn:aws:sqs:us-east-1:888888888888:orders";
353
+
354
+ const queue = await simAws
355
+ .sqs()
356
+ .createQueue(new CreateQueueCommand({ QueueName: "orders" }));
357
+
358
+ // The queue's own policy is what admits EventBridge.
359
+ await simAws.sqs().setQueueAttributes(
360
+ new SetQueueAttributesCommand({
361
+ QueueUrl: queue.QueueUrl,
362
+ Attributes: {
363
+ Policy: JSON.stringify({
364
+ Version: "2012-10-17",
365
+ Statement: [
366
+ {
367
+ Effect: "Allow",
368
+ Principal: { Service: "events.amazonaws.com" },
369
+ Action: "sqs:SendMessage",
370
+ Resource: queueArn,
371
+ },
372
+ ],
373
+ }),
374
+ },
375
+ }),
376
+ );
377
+
378
+ await simAws.eventBridge().putRule(
379
+ new PutRuleCommand({
380
+ Name: "orders",
381
+ EventPattern: JSON.stringify({ source: ["orders.service"] }),
382
+ }),
383
+ );
384
+
385
+ await simAws.eventBridge().putTargets(
386
+ new PutTargetsCommand({
387
+ Rule: "orders",
388
+ Targets: [{ Id: "orders-queue", Arn: queueArn }],
389
+ }),
390
+ );
391
+
392
+ await simAws.eventBridge().putEvents(
393
+ new PutEventsCommand({
394
+ Entries: [
395
+ {
396
+ Source: "orders.service",
397
+ DetailType: "OrderPlaced",
398
+ Detail: JSON.stringify({ orderId: "order-1" }),
399
+ },
400
+ ],
401
+ }),
402
+ );
403
+
404
+ // Delivery happens after PutEvents has answered, as it does on real AWS.
405
+ await simAws.backgroundTasksComplete();
406
+
407
+ const received = await simAws
408
+ .sqs()
409
+ .receiveMessage(new ReceiveMessageCommand({ QueueUrl: queue.QueueUrl }));
410
+
411
+ console.log(received.Messages?.length); // 1
412
+ ```
413
+
414
+ A queue or topic target receives the event as its message body, with no envelope around it. A Lambda
415
+ target is invoked with the event as its payload. A target with an `Input` receives that fixed JSON
416
+ in place of the event. That makes `Input` useful for a target that only needs to know something
417
+ happened.
418
+
419
+ A rule has at most five targets, and a target id is unique within one rule. `PutTargets` replaces a
420
+ target of the same id, and never adds a second beside it. `RemoveTargets` reports an unknown id as a
421
+ failed entry and lets the request itself succeed. Deleting a rule takes its targets with it.
422
+
423
+ `ListTargetsByRule` reports a rule's targets, and `ListRuleNamesByTarget` reports the rules of a bus
424
+ that send to one target ARN.
425
+
426
+ ## What a target has to allow
427
+
428
+ EventBridge reaches a queue, topic or function target as the `events.amazonaws.com` service
429
+ principal, and the target's own resource policy is the whole of the decision. Those three have no
430
+ execution role, and a rule `RoleArn` and a target `RoleArn` are both refused. An ECS target is the
431
+ exception, because a task definition has no resource policy for a rule to be admitted by, and it
432
+ carries a role of its own.
433
+
434
+ - **A queue** needs `sqs:SendMessage` for `events.amazonaws.com` in its `Policy` attribute.
435
+ - **A topic** needs `sns:Publish` for `events.amazonaws.com` in its `Policy` attribute.
436
+ - **A function** needs an `AddPermission` grant of `lambda:InvokeFunction` to
437
+ `events.amazonaws.com`.
438
+
439
+ The policy is consulted on every delivery, and never when the target is added. A permission taken
440
+ away afterwards stops delivery. Real EventBridge leaves it unchecked at `PutTargets` time too.
441
+
442
+ A target may be in another account or region of the same simulation. It is the target's own account
443
+ that decides. The policy lives with the target and is evaluated by that account's IAM, as it is on
444
+ real AWS. Both condition keys AWS documents for this work. `aws:SourceArn` carries the rule's ARN
445
+ and `aws:SourceAccount` carries the account the rule belongs to.
446
+
447
+ ```typescript sim-event-bridge-cross-account
448
+ /**
449
+ * A rule in one Account sending to a queue in another.
450
+ */
451
+
452
+ const queuePolicy = {
453
+ Version: "2012-10-17",
454
+ Statement: [
455
+ {
456
+ Effect: "Allow",
457
+ Principal: { Service: "events.amazonaws.com" },
458
+ Action: "sqs:SendMessage",
459
+ Resource: "arn:aws:sqs:us-east-1:222222222222:orders",
460
+ Condition: {
461
+ ArnLike: {
462
+ "aws:SourceArn": "arn:aws:events:us-east-1:111111111111:rule/orders",
463
+ },
464
+ },
465
+ },
466
+ ],
467
+ };
468
+
469
+ console.log(JSON.stringify(queuePolicy).length > 0); // true
470
+ ```
471
+
472
+ An event delivered across accounts still names the account it was put in, and never the target's.
473
+
474
+ ## Sending to a Lambda version or alias
475
+
476
+ A function target ARN can carry a version number or an alias name on the end, and matched events go
477
+ to the version that qualifier names. The grant is made on the same qualifier:
478
+
479
+ ```typescript sim-event-bridge-lambda-alias
480
+ /**
481
+ * A rule sending order events to a Lambda alias, which runs the version it
482
+ * points at.
483
+ */
484
+
485
+ import {
486
+ PutEventsCommand,
487
+ PutRuleCommand,
488
+ PutTargetsCommand,
489
+ } from "@aws-sdk/client-eventbridge";
490
+ import {
491
+ AddPermissionCommand,
492
+ CreateAliasCommand,
493
+ CreateFunctionCommand,
494
+ PublishVersionCommand,
495
+ } from "@aws-sdk/client-lambda";
496
+
497
+ import { SimAws } from "@kensio/yulin";
498
+ import { makeLambdaZipFileInput } from "@kensio/yulin/lambda";
499
+
500
+ const simAws = new SimAws();
501
+ const lambda = simAws.lambda();
502
+ const functionArn = `arn:aws:lambda:${simAws.defaultRegionName}:${simAws.defaultAccountId}:function:fulfilment`;
503
+
504
+ await lambda.createFunction(
505
+ new CreateFunctionCommand({
506
+ FunctionName: "fulfilment",
507
+ Role: `arn:aws:iam::${simAws.defaultAccountId}:role/FulfilmentRole`,
508
+ Code: {
509
+ ZipFile: makeLambdaZipFileInput((_event, context) => {
510
+ console.log(context.functionVersion); // "1", the version behind `live`
511
+
512
+ return "fulfilled";
513
+ }),
514
+ },
515
+ }),
516
+ );
517
+
518
+ const published = await lambda.publishVersion(
519
+ new PublishVersionCommand({ FunctionName: "fulfilment" }),
520
+ );
521
+
522
+ await lambda.createAlias(
523
+ new CreateAliasCommand({
524
+ FunctionName: "fulfilment",
525
+ Name: "live",
526
+ FunctionVersion: published.Version,
527
+ }),
528
+ );
529
+
530
+ // The grant is made on the alias, which is the resource the target names.
531
+ await lambda.addPermission(
532
+ new AddPermissionCommand({
533
+ FunctionName: "fulfilment",
534
+ Qualifier: "live",
535
+ StatementId: "AllowEvents",
536
+ Action: "lambda:InvokeFunction",
537
+ Principal: "events.amazonaws.com",
538
+ }),
539
+ );
540
+
541
+ await simAws.eventBridge().putRule(
542
+ new PutRuleCommand({
543
+ Name: "orders",
544
+ EventPattern: JSON.stringify({ source: ["orders.service"] }),
545
+ }),
546
+ );
547
+
548
+ await simAws.eventBridge().putTargets(
549
+ new PutTargetsCommand({
550
+ Rule: "orders",
551
+ Targets: [{ Id: "fulfilment", Arn: `${functionArn}:live` }],
552
+ }),
553
+ );
554
+
555
+ await simAws.eventBridge().putEvents(
556
+ new PutEventsCommand({
557
+ Entries: [
558
+ { Source: "orders.service", DetailType: "OrderPlaced", Detail: "{}" },
559
+ ],
560
+ }),
561
+ );
562
+
563
+ await simAws.backgroundTasksComplete();
564
+ ```
565
+
566
+ The qualifier is resolved on every delivery, so `UpdateAlias` moves what the rule reaches and the
567
+ target stays as it is. A target naming no version and no alias is recorded on
568
+ `simAws.eventBridge().deliveryFailures`, the way a missing function is. See
569
+ [reading back a failed delivery](#reading-back-a-failed-delivery).
570
+
571
+ ## Running an ECS task
572
+
573
+ A target whose ARN names an ECS cluster runs a [simulated ECS](https://yulinsim.dev/services/ecs/) task instead of receiving
574
+ the event. `EcsParameters` says which task definition and how many tasks, and the target's `RoleArn`
575
+ is the role the rule runs it as, both of which real EventBridge requires for the same reasons.
576
+
577
+ ```typescript sim-event-bridge-ecs-target
578
+ /**
579
+ * A rule running an ECS task when an order event arrives.
580
+ */
581
+
582
+ import {
583
+ CreateClusterCommand,
584
+ RegisterTaskDefinitionCommand,
585
+ } from "@aws-sdk/client-ecs";
586
+ import {
587
+ PutEventsCommand,
588
+ PutRuleCommand,
589
+ PutTargetsCommand,
590
+ } from "@aws-sdk/client-eventbridge";
591
+ import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
592
+
593
+ import { SimAws } from "@kensio/yulin";
594
+
595
+ const simAws = new SimAws();
596
+ const ecs = simAws.ecs();
597
+ const imported: string[] = [];
598
+
599
+ await ecs.createCluster(new CreateClusterCommand({ clusterName: "orders" }));
600
+
601
+ ecs.bindContainer({
602
+ family: "order-import",
603
+ containerName: "app",
604
+ run: () => {
605
+ imported.push(process.env["ORDER_ID"] ?? "");
606
+ },
607
+ });
608
+
609
+ await ecs.registerTaskDefinition(
610
+ new RegisterTaskDefinitionCommand({
611
+ family: "order-import",
612
+ containerDefinitions: [{ name: "app", image: "order-import:1" }],
613
+ }),
614
+ );
615
+
616
+ // The rule runs the task as this role, so the role trusts EventBridge and is
617
+ // allowed to run it.
618
+ await simAws.iam().createRole(
619
+ new CreateRoleCommand({
620
+ RoleName: "EventsRole",
621
+ AssumeRolePolicyDocument: JSON.stringify({
622
+ Version: "2012-10-17",
623
+ Statement: {
624
+ Effect: "Allow",
625
+ Principal: { Service: "events.amazonaws.com" },
626
+ Action: "sts:AssumeRole",
627
+ },
628
+ }),
629
+ }),
630
+ );
631
+
632
+ await simAws.iam().putRolePolicy(
633
+ new PutRolePolicyCommand({
634
+ RoleName: "EventsRole",
635
+ PolicyName: "RunImport",
636
+ PolicyDocument: JSON.stringify({
637
+ Version: "2012-10-17",
638
+ Statement: { Effect: "Allow", Action: "ecs:RunTask", Resource: "*" },
639
+ }),
640
+ }),
641
+ );
642
+
643
+ await simAws.eventBridge().putRule(
644
+ new PutRuleCommand({
645
+ Name: "orders",
646
+ EventPattern: JSON.stringify({ source: ["orders.service"] }),
647
+ }),
648
+ );
649
+
650
+ await simAws.eventBridge().putTargets(
651
+ new PutTargetsCommand({
652
+ Rule: "orders",
653
+ Targets: [
654
+ {
655
+ Id: "order-import",
656
+ Arn: "arn:aws:ecs:us-east-1:888888888888:cluster/orders",
657
+ RoleArn: "arn:aws:iam::888888888888:role/EventsRole",
658
+ EcsParameters: { TaskDefinitionArn: "order-import", TaskCount: 1 },
659
+ // An ECS target's Input is the task's overrides, since a task has
660
+ // nowhere to receive a payload.
661
+ Input: JSON.stringify({
662
+ containerOverrides: [
663
+ {
664
+ name: "app",
665
+ environment: [{ name: "ORDER_ID", value: "order-1" }],
666
+ },
667
+ ],
668
+ }),
669
+ },
670
+ ],
671
+ }),
672
+ );
673
+
674
+ await simAws.eventBridge().putEvents(
675
+ new PutEventsCommand({
676
+ Entries: [
677
+ {
678
+ Source: "orders.service",
679
+ DetailType: "OrderPlaced",
680
+ Detail: JSON.stringify({ orderId: "order-1" }),
681
+ },
682
+ ],
683
+ }),
684
+ );
685
+
686
+ // The task runs after PutEvents has answered, as it does on real AWS.
687
+ await simAws.backgroundTasksComplete();
688
+
689
+ console.log(imported); // ["order-1"]
690
+ ```
691
+
692
+ The target ARN names the cluster. An ARN naming anything else in ECS is refused when the target is
693
+ added. `EcsParameters` names the task definition, as a family, a `family:revision` or a full ARN,
694
+ and the same one `RunTask` would take.
695
+
696
+ An ECS target's `Input` is the task's overrides, because a task has nowhere to receive a payload. So
697
+ container environment variables are set the way the CDK sets them, with a `containerOverrides` list
698
+ naming the container. A target with no `Input` runs the task with no overrides, and the matched
699
+ event never reaches the container.
700
+
701
+ The role is the whole of the decision. It has to trust `events.amazonaws.com` in its
702
+ `AssumeRolePolicyDocument`, and it has to be allowed `ecs:RunTask` on the task definition revision
703
+ the target runs. A role that may not becomes a recorded
704
+ [delivery failure](#reading-back-a-failed-delivery), and the caller who put the event sees no error.
705
+
706
+ The trust policy may carry the condition AWS recommends against the confused deputy problem. The
707
+ rule's ARN is supplied as `aws:SourceArn` and the account it belongs to as `aws:SourceAccount`, the
708
+ same pair a queue or topic policy is conditioned on for the other target types. A role scoped to one
709
+ rule is assumable for that rule and for no other.
710
+
711
+ Which containers actually run is [simulated ECS](https://yulinsim.dev/services/ecs/)'s answer, and never the rule's. A
712
+ container with a binding runs its handler, and a container without one is recorded as not simulated.
713
+ A target naming a task definition with nothing bound therefore records a task that never started,
714
+ and the rule counts as delivered.
715
+
716
+ ## Rules that fire on a schedule
717
+
718
+ A rule created with a `ScheduleExpression` in place of an event pattern fires on its own timing,
719
+ independently of anything put onto a bus. That timing is the simulation's clock. The rule fires when
720
+ a test advances simulated time to or past a due instant, and never otherwise. So a schedule that
721
+ takes an hour in production takes no time at all to test.
722
+
723
+ ```typescript sim-event-bridge-scheduled-rules
724
+ /**
725
+ * A scheduled rule invoking a function three times in three simulated hours.
726
+ */
727
+
728
+ import { PutRuleCommand, PutTargetsCommand } from "@aws-sdk/client-eventbridge";
729
+ import { AddPermissionCommand } from "@aws-sdk/client-lambda";
730
+
731
+ import { SimAws, SimFixedClock } from "@kensio/yulin";
732
+ import { makeLambdaZipFileInput } from "@kensio/yulin/lambda";
733
+
734
+ const simAws = new SimAws({
735
+ clock: new SimFixedClock(new Date("2026-07-26T09:00:00.000Z")),
736
+ });
737
+
738
+ const ranAt: string[] = [];
739
+
740
+ await simAws.lambda().createFunction({
741
+ input: {
742
+ FunctionName: "reconcile",
743
+ Role: "arn:aws:iam::888888888888:role/ReconcileRole",
744
+ Code: {
745
+ ZipFile: makeLambdaZipFileInput((event: { time: string }) => {
746
+ ranAt.push(event.time);
747
+ return { ok: true };
748
+ }),
749
+ },
750
+ },
751
+ });
752
+
753
+ await simAws.lambda().addPermission(
754
+ new AddPermissionCommand({
755
+ FunctionName: "reconcile",
756
+ StatementId: "events",
757
+ Action: "lambda:InvokeFunction",
758
+ Principal: "events.amazonaws.com",
759
+ }),
760
+ );
761
+
762
+ await simAws.eventBridge().putRule(
763
+ new PutRuleCommand({
764
+ Name: "hourly-reconciliation",
765
+ ScheduleExpression: "rate(1 hour)",
766
+ }),
767
+ );
768
+
769
+ await simAws.eventBridge().putTargets(
770
+ new PutTargetsCommand({
771
+ Rule: "hourly-reconciliation",
772
+ Targets: [
773
+ {
774
+ Id: "reconcile",
775
+ Arn: "arn:aws:lambda:us-east-1:888888888888:function:reconcile",
776
+ },
777
+ ],
778
+ }),
779
+ );
780
+
781
+ // Three simulated hours later, the function has run three times.
782
+ await simAws.clock().advanceBy({ hours: 3 });
783
+
784
+ console.log(ranAt);
785
+ // [ '2026-07-26T10:00:00Z', '2026-07-26T11:00:00Z', '2026-07-26T12:00:00Z' ]
786
+ ```
787
+
788
+ Firing is per due instant, and not per advance. Advancing an hour with a `rate(1 minute)` rule
789
+ invokes the target sixty times, at sixty distinct simulated timestamps, because that is what an hour
790
+ of that rule does. `advanceBy(...)` returns once every one of those firings and its deliveries have
791
+ settled, ready for the next line to assert.
792
+
793
+ A scheduled event carries the standard envelope with `source: "aws.events"`, `detail-type:
794
+ "Scheduled Event"` and an empty `detail`, and names the rule that fired in `resources`. Its `time`
795
+ is the instant the rule fell due rather than the instant the advance finished. That is the field AWS
796
+ advises scheduled handler code to read in place of the clock.
797
+
798
+ ### Writing the schedule
799
+
800
+ `rate(<value> <unit>)` runs from the moment the rule was created. A `rate(1 day)` rule created at
801
+ half past nine falls due at half past nine. The unit is `minute`, `hour` or `day`, and has to agree
802
+ with its value. `rate(1 hour)` and `rate(5 hours)` are the valid forms, and `rate(1 hours)` is
803
+ refused as real EventBridge refuses it. A minute is the finest schedule AWS runs, and there is no
804
+ unit below it.
805
+
806
+ `cron(<six fields>)` names absolute instants in UTC. The six fields are minutes, hours,
807
+ day-of-month, month, day-of-week and year, making the every-day-at-noon expression `cron(0 12 * * ?
808
+ *)`. A five-field expression, the form Unix cron takes, is refused naming the six-field form.
809
+ Day-of-week runs `1-7` or `SUN-SAT` with Sunday as one, unlike Unix cron. The day-of-month and
810
+ day-of-week fields cannot both say something, and whichever one is standing aside is written `?`.
811
+
812
+ A scheduled rule only works on the `default` bus, as it does on real AWS, and a `ScheduleExpression`
813
+ on any other bus is refused.
814
+
815
+ `DisableRule` stops a scheduled rule firing while it is off, and `EnableRule` picks up from the next
816
+ due instant. What was missed while it was off stays missed. `DeleteRule` stops it for good, and
817
+ `PutRule` replacing a scheduled rule restarts the schedule from the replacement.
818
+
819
+ A rule with no target still fires, and what it produced can be read with `eventsOn(...)`. That is
820
+ useful for asserting on the schedule itself before there is anything to deliver to.
821
+
822
+ ## Deploying from a CloudFormation template
823
+
824
+ `AWS::Events::EventBus` and `AWS::Events::Rule` deploy through
825
+ [simulated CloudFormation](https://yulinsim.dev/services/cloudformation/). A stack that declares its routing in a template can
826
+ be exercised end to end. A rule carries its `EventPattern` or `ScheduleExpression`, its `State`, and
827
+ its inline `Targets`, and a target ARN resolved by `Fn::GetAtt` from a function or queue in the same
828
+ template works as it would in a real deployment.
829
+
830
+ ```typescript sim-event-bridge-cloudformation
831
+ /**
832
+ * A rule and its target, deployed from a template rather than by the SDK.
833
+ */
834
+
835
+ import { PutEventsCommand } from "@aws-sdk/client-eventbridge";
836
+
837
+ import { SimAws } from "@kensio/yulin";
838
+ import { makeLambdaZipFileInput } from "@kensio/yulin/lambda";
839
+
840
+ const simAws = new SimAws();
841
+ const handled: unknown[] = [];
842
+
843
+ await simAws.lambda().createFunction({
844
+ input: {
845
+ FunctionName: "fulfilment",
846
+ Role: "arn:aws:iam::888888888888:role/FulfilmentRole",
847
+ Code: {
848
+ ZipFile: makeLambdaZipFileInput((event: unknown) => {
849
+ handled.push(event);
850
+ return { ok: true };
851
+ }),
852
+ },
853
+ },
854
+ });
855
+
856
+ const stack = await simAws.cloudFormation().deployTemplate({
857
+ stackName: "orders-stack",
858
+ template: {
859
+ Resources: {
860
+ OrdersRule: {
861
+ Type: "AWS::Events::Rule",
862
+ Properties: {
863
+ Name: "orders",
864
+ // A template carries the pattern as an object, where the API takes
865
+ // it as a string of JSON.
866
+ EventPattern: { source: ["orders.service"] },
867
+ Targets: [
868
+ {
869
+ Id: "fulfilment",
870
+ Arn: "arn:aws:lambda:us-east-1:888888888888:function:fulfilment",
871
+ },
872
+ ],
873
+ },
874
+ },
875
+ // The grant CDK emits alongside a Lambda target, and that the target
876
+ // needs here too.
877
+ PermissionForEventsToInvokeLambda: {
878
+ Type: "AWS::Lambda::Permission",
879
+ Properties: {
880
+ FunctionName: "fulfilment",
881
+ Action: "lambda:InvokeFunction",
882
+ Principal: "events.amazonaws.com",
883
+ SourceArn: { "Fn::GetAtt": ["OrdersRule", "Arn"] },
884
+ },
885
+ },
886
+ },
887
+ },
888
+ });
889
+
890
+ await stack.waitForDeployComplete();
891
+
892
+ await simAws.eventBridge().putEvents(
893
+ new PutEventsCommand({
894
+ Entries: [
895
+ {
896
+ Source: "orders.service",
897
+ DetailType: "OrderPlaced",
898
+ Detail: JSON.stringify({ orderId: "order-1" }),
899
+ },
900
+ ],
901
+ }),
902
+ );
903
+
904
+ await simAws.backgroundTasksComplete();
905
+
906
+ console.log(handled.length); // 1
907
+ ```
908
+
909
+ `Ref` returns the **name** of a bus or a rule, and never its ARN. That is what AWS returns, and it
910
+ makes a bus `Ref` usable straight away as another resource's `EventBusName`. The ARN comes from
911
+ `Fn::GetAtt ... Arn`, which an `AWS::Lambda::Permission` `SourceArn` needs. An unnamed rule gets a
912
+ name generated from the stack name, the logical ID and a tail derived from both, as
913
+ [the CloudFormation docs](https://yulinsim.dev/services/cloudformation/#names-cloudformation-generates "Names CloudFormation generates")
914
+ describe. A rule name caps at 64 characters. A stack name and logical ID longer than that together
915
+ are trimmed to 25 characters each, and either takes what the other leaves.
916
+
917
+ A target property this simulation leaves out, such as `InputTransformer` or `InputPath`, is refused
918
+ at deploy time naming the property and the Resource. The alternative is a rule that sends the whole
919
+ event where one field was asked for. Tearing the stack down removes the buses, rules and targets it
920
+ created.
921
+
922
+ ## Reading back a failed delivery
923
+
924
+ Real EventBridge tells the caller nothing about a failed delivery. A `PutEvents` that matched a rule
925
+ whose target refuses the call still answers with an event id. `deliveryFailures` explains a target
926
+ that is unexpectedly empty:
927
+
928
+ ```typescript sim-event-bridge-delivery-failures
929
+ /**
930
+ * Finding out why a target received nothing.
931
+ */
932
+
933
+ import {
934
+ PutEventsCommand,
935
+ PutRuleCommand,
936
+ PutTargetsCommand,
937
+ } from "@aws-sdk/client-eventbridge";
938
+ import { CreateQueueCommand } from "@aws-sdk/client-sqs";
939
+
940
+ import { SimAws } from "@kensio/yulin";
941
+
942
+ const simAws = new SimAws();
943
+
944
+ // A queue with no policy admitting EventBridge.
945
+ await simAws.sqs().createQueue(new CreateQueueCommand({ QueueName: "orders" }));
946
+
947
+ await simAws.eventBridge().putRule(
948
+ new PutRuleCommand({
949
+ Name: "orders",
950
+ EventPattern: JSON.stringify({ source: ["orders.service"] }),
951
+ }),
952
+ );
953
+ await simAws.eventBridge().putTargets(
954
+ new PutTargetsCommand({
955
+ Rule: "orders",
956
+ Targets: [{ Id: "q", Arn: "arn:aws:sqs:us-east-1:888888888888:orders" }],
957
+ }),
958
+ );
959
+
960
+ await simAws.eventBridge().putEvents(
961
+ new PutEventsCommand({
962
+ Entries: [
963
+ { Source: "orders.service", DetailType: "OrderPlaced", Detail: "{}" },
964
+ ],
965
+ }),
966
+ );
967
+ await simAws.backgroundTasksComplete();
968
+
969
+ const [failure] = simAws.eventBridge().deliveryFailures;
970
+
971
+ console.log(failure?.targetId); // "q"
972
+ console.log(failure?.message);
973
+ // "The queue policy of arn:aws:sqs:... does not allow events.amazonaws.com..."
974
+ ```
975
+
976
+ A target that names nothing reads differently from one whose policy said no, because a policy saying
977
+ no is a modelled outcome a test may be asking for on purpose.
978
+
979
+ `JSON.stringify` on a failure carries the message alongside the rule, the target and the event it
980
+ names.
981
+
982
+ ## Permissions
983
+
984
+ Most operations are authorized by simulated IAM against the bus ARN. The two that name no bus
985
+ authorize against `*` instead, and a policy naming a bus will not allow either. Those are
986
+ `events:ListEventBuses`, which has no bus-level resource on real AWS, and `events:TestEventPattern`,
987
+ which reaches no bus at all.
988
+
989
+ ```typescript sim-event-bridge-iam-policy
990
+ /**
991
+ * A policy allowing events onto one bus and nothing else.
992
+ */
993
+
994
+ const policy = {
995
+ Version: "2012-10-17",
996
+ Statement: [
997
+ {
998
+ Effect: "Allow",
999
+ Action: "events:PutEvents",
1000
+ Resource: "arn:aws:events:us-east-1:888888888888:event-bus/orders",
1001
+ },
1002
+ ],
1003
+ };
1004
+
1005
+ console.log(JSON.stringify(policy).length > 0); // true
1006
+ ```
1007
+
1008
+ A caller refused by IAM gets `AccessDeniedException`. Permission is checked before the bus is looked
1009
+ up, and a caller who may not reach a bus is refused whether or not that bus exists.
1010
+
1011
+ An ECS target carries a `RoleArn`, which the rule runs the task as. Adding one hands EventBridge that
1012
+ Role, and `PutTargets` authorizes `iam:PassRole` against it. See
1013
+ [passing a Role to a service](https://yulinsim.dev/services/iam/#passing-a-role-to-a-service) in the IAM docs.
1014
+
1015
+ ## Scoping
1016
+
1017
+ Buses belong to one account and region, as they do on real AWS:
1018
+
1019
+ ```typescript sim-event-bridge-scoping
1020
+ /**
1021
+ * Event buses in two Regions of the same Account.
1022
+ */
1023
+
1024
+ import { CreateEventBusCommand } from "@aws-sdk/client-eventbridge";
1025
+
1026
+ import { SimAws } from "@kensio/yulin";
1027
+
1028
+ const simAws = new SimAws();
1029
+
1030
+ await simAws
1031
+ .account("111111111111")
1032
+ .region("eu-west-2")
1033
+ .eventBridge()
1034
+ .createEventBus(new CreateEventBusCommand({ Name: "orders" }));
1035
+
1036
+ const elsewhere = simAws.account("111111111111").region("us-east-1");
1037
+
1038
+ console.log(elsewhere.eventBridge().findEventBus("orders")); // undefined
1039
+ ```
1040
+
1041
+ An entry naming a bus ARN in another account or region is refused. Real EventBridge does deliver
1042
+ events across accounts that way, but nothing here can reach another simulation's bus, and quietly
1043
+ treating a foreign ARN as local would let a test pass while the real call crossed a boundary it has
1044
+ no permission for.
1045
+
1046
+ ## Available functionality
1047
+
1048
+ - `CreateEventBus`, `DeleteEventBus`, `DescribeEventBus`, `ListEventBuses` and `PutEvents`.
1049
+ - `PutRule`, `DeleteRule`, `DescribeRule`, `ListRules`, `EnableRule`, `DisableRule` and
1050
+ `TestEventPattern`.
1051
+ - Scheduled rules, with a `rate(...)` or six-field `cron(...)` `ScheduleExpression`, fired by
1052
+ advancing the simulation's clock.
1053
+ - Event pattern matching on exact values, nested fields, lists, `prefix`, `suffix`, `anything-but`,
1054
+ `numeric` and `exists`.
1055
+ - `PutTargets`, `RemoveTargets`, `ListTargetsByRule` and `ListRuleNamesByTarget`, with delivery to a
1056
+ simulated Lambda function, SQS queue or SNS topic, authorized by the target's own resource policy.
1057
+ - ECS targets, running a simulated task through the target's `RoleArn` with the task definition and
1058
+ `TaskCount` from `EcsParameters` and container overrides from the target's `Input`.
1059
+ - Targets in another account or region of the same simulation, admitted by the target's own resource
1060
+ policy on `aws:SourceArn` or `aws:SourceAccount`, as real EventBridge does.
1061
+ - A target's fixed `Input`, and `deliveryFailures` for a delivery that failed.
1062
+ - The `default` bus in every account and region, without one being created.
1063
+ - Bus descriptions, creation timestamps from the simulation's clock, and prefix-narrowed paged
1064
+ listings.
1065
+ - The event envelope EventBridge builds from an entry, reached through `eventsOn(...)`.
1066
+ - IAM authorization against the bus ARN.
1067
+ - `iam:PassRole` authorization of the `RoleArn` an ECS target carries.
1068
+ - SDK interception of `EventBridgeClient`.
1069
+
1070
+ ## Limitations
1071
+
1072
+ - Targets deliver to Lambda, SQS and SNS, and run a task in ECS. A target ARN naming any other
1073
+ service is refused as the target is added, ahead of any matching event.
1074
+ - Target `InputPath` and `InputTransformer` are refused, as are dead letter queues and retry
1075
+ policies. A delivery is attempted once. A target `RoleArn` is refused except on an ECS target.
1076
+ That is the one target type that runs as a role, where the others run as the service principal.
1077
+ - An ECS target's `EcsParameters` takes `TaskDefinitionArn` and `TaskCount`, and takes and ignores
1078
+ `LaunchType`, `PlatformVersion`, `NetworkConfiguration` and `CapacityProviderStrategy`, since
1079
+ there is no placement and no network here for them to apply to. Anything else it can carry, such
1080
+ as `Group`, `Tags` or `PropagateTags`, is refused outright.
1081
+ - An ECS target's `Input` is read as the task's overrides, and a `containerOverrides` list is how a
1082
+ rule sets a container's environment. A target with no `Input` runs the task with no overrides, and
1083
+ the matched event never reaches the container.
1084
+ - A `TaskCount` above one runs that many simulated tasks, and a bound container handler runs once
1085
+ for each of them, in this process and one after another.
1086
+ - An ECS target is refused in a CloudFormation template. `AWS::Events::Rule` still refuses a target
1087
+ `RoleArn` and `EcsParameters`. Write an ECS target with `PutTargets`.
1088
+ - Numbers are compared after JSON parsing, so `300`, `300.0` and `3.0e2` are one value here. Real
1089
+ EventBridge compares the JSON token when matching an exact value, and so may tell those forms
1090
+ apart. Use `numeric` to compare numbers. That is what it is for.
1091
+ - The `cidr`, `equals-ignore-case`, `wildcard` and `$or` pattern operators are refused at `PutRule`,
1092
+ as are the nested forms of `anything-but` and the case-insensitive forms of `prefix` and `suffix`.
1093
+ - A rule needs an `EventPattern`, a `ScheduleExpression` or both. Real EventBridge takes a rule with
1094
+ neither, which matches nothing and fires never. Here that rule is refused.
1095
+ - A scheduled rule only fires while a test advances the simulation's clock. Nothing runs on the
1096
+ host's clock, and a simulation left alone in real time fires nothing.
1097
+ - `ScheduleExpressionTimezone` and the `L`, `W` and `#` cron wildcards are refused. Everything is
1098
+ read in UTC.
1099
+ - Firing is exact and exactly once. Real EventBridge may deliver a scheduled event a few seconds
1100
+ late, and may deliver it more than once.
1101
+ - EventBridge Scheduler is a separate service, simulated separately. See
1102
+ [simulated Scheduler](https://yulinsim.dev/services/scheduler/).
1103
+ - Rule tags, a rule `RoleArn`, managed rules and the `ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS`
1104
+ state are all refused.
1105
+ - Deleting an event bus deletes its rules, and deleting a rule deletes its targets. Real EventBridge
1106
+ refuses to delete either while it still has what hangs off it.
1107
+ - `AWS::Events::EventBusPolicy`, `AWS::Events::Archive`, `AWS::Events::Connection` and
1108
+ `AWS::Events::ApiDestination` are absent as CloudFormation resource types. `AWS::Events::EventBus`
1109
+ and `AWS::Events::Rule` are there. See
1110
+ [deploying from a template](#deploying-from-a-cloudformation-template).
1111
+ - Event bus resource policies are absent. `PutPermission`, `RemovePermission` and the bus `Policy`
1112
+ attribute are all missing, and a caller from another account cannot be admitted to a bus. That is
1113
+ stricter than real AWS.
1114
+ - Putting an event onto another account's or region's bus is refused.
1115
+ - Partner event buses and partner event sources are refused, as are event bus tags, encryption with
1116
+ a customer managed key, dead letter queues, logging configuration and global endpoints.
1117
+ - Archives, replay, schema registry and discovery, API destinations and connections are not
1118
+ simulated.