@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,1096 @@
1
+ # Simulated SSM Parameter Store
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.
6
+
7
+ Only Parameter Store is simulated.
8
+
9
+ SSM-specific types are imported from the `@kensio/yulin/ssm` subpath.
10
+
11
+ ## Writing and reading a parameter
12
+
13
+ `PutParameter` needs a `Type` when the parameter is new. `GetParameter` returns the current version.
14
+
15
+ ```typescript sim-ssm-put-and-get
16
+ /**
17
+ * Writing a simulated parameter and reading it back.
18
+ */
19
+
20
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
21
+
22
+ import { SimAws } from "@kensio/yulin";
23
+
24
+ const simAws = new SimAws();
25
+ const ssm = simAws.ssm();
26
+
27
+ await ssm.putParameter(
28
+ new PutParameterCommand({
29
+ Name: "/myapp/prod/db-host",
30
+ Type: "String",
31
+ Value: "db.internal",
32
+ }),
33
+ );
34
+
35
+ const read = await ssm.getParameter(
36
+ new GetParameterCommand({ Name: "/myapp/prod/db-host" }),
37
+ );
38
+
39
+ console.log(read.Parameter?.Value); // "db.internal"
40
+ console.log(read.Parameter?.Version); // 1
41
+ ```
42
+
43
+ A parameter written without a leading slash and one read with it are the same parameter, because
44
+ both name the same ARN.
45
+
46
+ ## Parameter ARNs and IAM policies
47
+
48
+ A parameter ARN drops the leading slash from the name. `/myapp/prod/db-host` becomes
49
+ `arn:aws:ssm:eu-west-2:111111111111:parameter/myapp/prod/db-host`, with one slash after `parameter`
50
+ rather than two. A policy written with the doubled slash matches nothing.
51
+
52
+ ```typescript sim-ssm-iam-policy
53
+ /**
54
+ * A simulated IAM policy allowing a Role to read one parameter.
55
+ */
56
+
57
+ import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
58
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
59
+
60
+ import { SimAws } from "@kensio/yulin";
61
+
62
+ const simAws = new SimAws();
63
+ const accountId = simAws.defaultAccountId;
64
+ const regionName = simAws.defaultRegionName;
65
+
66
+ const role = await simAws.iam().createRole(
67
+ new CreateRoleCommand({
68
+ RoleName: "ConfigReader",
69
+ AssumeRolePolicyDocument: JSON.stringify({
70
+ Version: "2012-10-17",
71
+ Statement: {
72
+ Effect: "Allow",
73
+ Principal: { AWS: `arn:aws:iam::${accountId}:root` },
74
+ Action: "sts:AssumeRole",
75
+ },
76
+ }),
77
+ }),
78
+ );
79
+
80
+ await simAws.iam().putRolePolicy(
81
+ new PutRolePolicyCommand({
82
+ RoleName: "ConfigReader",
83
+ PolicyName: "ReadDbHost",
84
+ PolicyDocument: JSON.stringify({
85
+ Version: "2012-10-17",
86
+ Statement: {
87
+ Effect: "Allow",
88
+ Action: "ssm:GetParameter",
89
+ // One slash after `parameter`, not two, whatever the name looks like.
90
+ Resource: `arn:aws:ssm:${regionName}:${accountId}:parameter/myapp/prod/db-host`,
91
+ },
92
+ }),
93
+ }),
94
+ );
95
+
96
+ await simAws.ssm().putParameter(
97
+ new PutParameterCommand({
98
+ Name: "/myapp/prod/db-host",
99
+ Type: "String",
100
+ Value: "db.internal",
101
+ }),
102
+ );
103
+
104
+ const read = await simAws
105
+ .ssm()
106
+ .getParameter(new GetParameterCommand({ Name: "/myapp/prod/db-host" }), {
107
+ caller: { kind: "arn", arn: role.Role.Arn },
108
+ });
109
+
110
+ console.log(read.Parameter?.Value); // "db.internal"
111
+ ```
112
+
113
+ `DescribeParameters` is the exception. Real Parameter Store gives that action no resource-level
114
+ permissions. It authorizes against `*` here, and a policy naming individual parameter ARNs grants
115
+ nothing.
116
+
117
+ `GetParametersByPath` authorizes against the path rather than against each parameter it returns.
118
+ Access to a path is access to everything under it. A recursive listing of `/myapp` returns
119
+ `/myapp/prod/db-host` even where a policy explicitly denies that parameter.
120
+
121
+ ## Versions
122
+
123
+ Every write makes a new version. `PutParameter` refuses a name that is already taken unless the
124
+ request sets `Overwrite`, and an earlier version stays readable by number.
125
+
126
+ ```typescript sim-ssm-parameter-versions
127
+ /**
128
+ * Overwriting a simulated parameter and reading an earlier version.
129
+ */
130
+
131
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
132
+
133
+ import { SimAws } from "@kensio/yulin";
134
+
135
+ const simAws = new SimAws();
136
+ const ssm = simAws.ssm();
137
+
138
+ await ssm.putParameter(
139
+ new PutParameterCommand({
140
+ Name: "/myapp/prod/db-host",
141
+ Type: "String",
142
+ Value: "db.internal",
143
+ }),
144
+ );
145
+
146
+ const overwritten = await ssm.putParameter(
147
+ new PutParameterCommand({
148
+ Name: "/myapp/prod/db-host",
149
+ Value: "db2.internal",
150
+ Overwrite: true,
151
+ }),
152
+ );
153
+
154
+ console.log(overwritten.Version); // 2
155
+
156
+ const first = await ssm.getParameter(
157
+ new GetParameterCommand({ Name: "/myapp/prod/db-host:1" }),
158
+ );
159
+
160
+ console.log(first.Parameter?.Value); // "db.internal"
161
+ console.log(first.Parameter?.Selector); // ":1"
162
+ ```
163
+
164
+ A parameter's type cannot change. Overwriting a `String` parameter as a `StringList` fails with
165
+ `HierarchyTypeMismatchException`, as it does on real AWS. Delete the parameter and create a new one
166
+ instead.
167
+
168
+ ## Reading a hierarchy
169
+
170
+ `GetParametersByPath` reads a whole level of the hierarchy. Without `Recursive` it returns only the
171
+ level immediately below the path.
172
+
173
+ ```typescript sim-ssm-parameters-by-path
174
+ /**
175
+ * Reading a hierarchy of simulated parameters as application configuration.
176
+ */
177
+
178
+ import {
179
+ GetParametersByPathCommand,
180
+ PutParameterCommand,
181
+ } from "@aws-sdk/client-ssm";
182
+
183
+ import { SimAws } from "@kensio/yulin";
184
+
185
+ const simAws = new SimAws();
186
+ const ssm = simAws.ssm();
187
+
188
+ await ssm.putParameter(
189
+ new PutParameterCommand({
190
+ Name: "/myapp/prod/db-host",
191
+ Type: "String",
192
+ Value: "db.internal",
193
+ }),
194
+ );
195
+ await ssm.putParameter(
196
+ new PutParameterCommand({
197
+ Name: "/myapp/prod/db-port",
198
+ Type: "String",
199
+ Value: "5432",
200
+ }),
201
+ );
202
+ await ssm.putParameter(
203
+ new PutParameterCommand({
204
+ Name: "/myapp/test/db-host",
205
+ Type: "String",
206
+ Value: "db.test.internal",
207
+ }),
208
+ );
209
+
210
+ const listed = await ssm.getParametersByPath(
211
+ new GetParametersByPathCommand({ Path: "/myapp/prod" }),
212
+ );
213
+
214
+ console.log(listed.Parameters?.map((parameter) => parameter.Name));
215
+ // [ "/myapp/prod/db-host", "/myapp/prod/db-port" ]
216
+ ```
217
+
218
+ A page holds ten parameters, as it does on real AWS. Follow `NextToken` to read the rest.
219
+
220
+ ## Reading several parameters at once
221
+
222
+ `GetParameters` takes up to ten names. A name that resolves to nothing comes back in
223
+ `InvalidParameters`, and the request still succeeds. That is what makes a typo easy to miss.
224
+
225
+ ```typescript sim-ssm-get-parameters-batch
226
+ /**
227
+ * Reading several simulated parameters, including one name with a typo.
228
+ */
229
+
230
+ import { GetParametersCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
231
+
232
+ import { SimAws } from "@kensio/yulin";
233
+
234
+ const simAws = new SimAws();
235
+ const ssm = simAws.ssm();
236
+
237
+ await ssm.putParameter(
238
+ new PutParameterCommand({
239
+ Name: "/myapp/prod/db-host",
240
+ Type: "String",
241
+ Value: "db.internal",
242
+ }),
243
+ );
244
+
245
+ const read = await ssm.getParameters(
246
+ new GetParametersCommand({
247
+ Names: ["/myapp/prod/db-host", "/myapp/prod/db-hostt"],
248
+ }),
249
+ );
250
+
251
+ console.log(read.Parameters?.map((parameter) => parameter.Name));
252
+ // [ "/myapp/prod/db-host" ]
253
+ console.log(read.InvalidParameters); // [ "/myapp/prod/db-hostt" ]
254
+ ```
255
+
256
+ `GetParameters` still authorizes each name. One name the caller may not read fails the whole
257
+ request.
258
+
259
+ ## String lists
260
+
261
+ A `StringList` value comes back as one comma-separated string, on read as well as on write, never
262
+ as an array.
263
+
264
+ ```typescript sim-ssm-string-list
265
+ /**
266
+ * Reading a simulated StringList parameter.
267
+ */
268
+
269
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
270
+
271
+ import { SimAws } from "@kensio/yulin";
272
+
273
+ const simAws = new SimAws();
274
+ const ssm = simAws.ssm();
275
+
276
+ await ssm.putParameter(
277
+ new PutParameterCommand({
278
+ Name: "/myapp/prod/allowed-origins",
279
+ Type: "StringList",
280
+ Value: "https://one.example,https://two.example",
281
+ }),
282
+ );
283
+
284
+ const read = await ssm.getParameter(
285
+ new GetParameterCommand({ Name: "/myapp/prod/allowed-origins" }),
286
+ );
287
+
288
+ const origins = read.Parameter?.Value?.split(",") ?? [];
289
+
290
+ console.log(origins.length); // 2
291
+ ```
292
+
293
+ ## Parameter names
294
+
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:
297
+
298
+ - may contain letters, digits, `_`, `.`, `-` and `/`
299
+ - must start with `/` if it contains a hierarchy at all
300
+ - may not have more than fifteen hierarchy levels
301
+ - may not start with `aws` or `ssm` in any case, which Parameter Store reserves
302
+ - may not contain spaces between characters, though surrounding spaces are stripped
303
+ - may not make an ARN longer than 1011 characters, counting the ARN prefix for the account and region
304
+
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.
307
+
308
+ ## Deploying a parameter from CloudFormation
309
+
310
+ Simulated CloudFormation creates a parameter from an `AWS::SSM::Parameter` resource, in the stack's
311
+ account and region. The parameter is written through `PutParameter`. A template-created parameter is
312
+ the same thing an SDK caller would get, with the same name validation, the same ARN, and version 1.
313
+
314
+ `Ref` on the resource gives the parameter name, as it does on real AWS, and it can be handed straight
315
+ to `GetParameter`. `Fn::GetAtt … Type` and `Fn::GetAtt … Value` give those
316
+ properties.
317
+
318
+ ```typescript sim-ssm-cloudformation-parameter
319
+ /**
320
+ * Deploying a parameter from a CloudFormation template and reading it back.
321
+ */
322
+
323
+ import { GetParameterCommand } from "@aws-sdk/client-ssm";
324
+
325
+ import { SimAws } from "@kensio/yulin";
326
+
327
+ const simAws = new SimAws();
328
+
329
+ const stack = await simAws.cloudFormation().deployTemplate({
330
+ stackName: "config-stack",
331
+ template: {
332
+ Resources: {
333
+ DbHost: {
334
+ Type: "AWS::SSM::Parameter",
335
+ Properties: {
336
+ Name: "/myapp/prod/db-host",
337
+ Type: "String",
338
+ Value: "db.internal",
339
+ Description: "Where the application database lives",
340
+ },
341
+ },
342
+ },
343
+ Outputs: {
344
+ DbHostParameter: {
345
+ Value: { Ref: "DbHost" },
346
+ },
347
+ },
348
+ },
349
+ });
350
+
351
+ await stack.waitForDeployComplete();
352
+
353
+ // Ref resolves to the parameter name, so it works as a GetParameter Name.
354
+ const parameterName = stack.output("DbHostParameter");
355
+
356
+ const read = await simAws
357
+ .ssm()
358
+ .getParameter(new GetParameterCommand({ Name: parameterName }));
359
+
360
+ console.log(read.Parameter?.Value); // "db.internal"
361
+ console.log(read.Parameter?.Version); // 1
362
+ ```
363
+
364
+ A parameter with no `Name` is named from the stack name, the logical ID and a tail derived from
365
+ both. A `FeatureFlags` in `config-stack` becomes `config-stack-FeatureFlags-` and twelve more
366
+ characters, where real CloudFormation ends the name in twelve random ones. The name carries no
367
+ leading slash, putting the parameter at the top of the hierarchy where real CloudFormation puts one
368
+ it names itself. Parameter Store counts the ARN prefix towards the 1011 characters a name may use,
369
+ and [the CloudFormation docs](https://yulinsim.dev/services/cloudformation/#names-cloudformation-generates "Names CloudFormation generates")
370
+ cover how the stack name and the logical ID share what is left.
371
+
372
+ An IAM policy granting access to a template-created parameter needs the ARN rather than the `Ref`.
373
+ Build it with `Fn::Sub`, remembering that the ARN drops the name's leading slash:
374
+
375
+ ```yaml
376
+ Resource: !Sub "arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/myapp/prod/db-host"
377
+ ```
378
+
379
+ CDK does this for you. `ssm.StringParameter` with `grantRead(fn)` synthesises a template that deploys
380
+ here without hand-editing.
381
+
382
+ ## Reading a parameter with a dynamic reference
383
+
384
+ A template reads a parameter that already exists through a `{{resolve:ssm:...}}` dynamic reference.
385
+ The reference is replaced with the parameter's value as the resource holding it is created.
386
+
387
+ `{{resolve:ssm:name}}` reads the current version, and `{{resolve:ssm:name:3}}` reads version 3. A
388
+ reference can sit inside a longer string, where only the reference itself is replaced.
389
+
390
+ ```typescript sim-ssm-dynamic-reference
391
+ /**
392
+ * Reading an existing parameter from a template with a dynamic reference.
393
+ */
394
+
395
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
396
+
397
+ import { SimAws } from "@kensio/yulin";
398
+
399
+ const simAws = new SimAws();
400
+
401
+ await simAws.ssm().putParameter(
402
+ new PutParameterCommand({
403
+ Name: "/myapp/prod/db-host",
404
+ Type: "String",
405
+ Value: "db.internal",
406
+ }),
407
+ );
408
+
409
+ const stack = await simAws.cloudFormation().deployTemplate({
410
+ stackName: "app-stack",
411
+ template: {
412
+ Resources: {
413
+ DbUrl: {
414
+ Type: "AWS::SSM::Parameter",
415
+ Properties: {
416
+ Name: "/myapp/prod/db-url",
417
+ Type: "String",
418
+ Value: "postgres://{{resolve:ssm:/myapp/prod/db-host}}:5432/app",
419
+ },
420
+ },
421
+ },
422
+ },
423
+ });
424
+
425
+ await stack.waitForDeployComplete();
426
+
427
+ const read = await simAws
428
+ .ssm()
429
+ .getParameter(new GetParameterCommand({ Name: "/myapp/prod/db-url" }));
430
+
431
+ console.log(read.Parameter?.Value); // "postgres://db.internal:5432/app"
432
+ ```
433
+
434
+ CDK emits one of these from `ssm.StringParameter.valueForStringParameter` when a version is given,
435
+ and from `fromStringParameterAttributes` with `forceDynamicReference`.
436
+
437
+ A reference inside `Fn::Sub` is read after the variables around it are substituted, so
438
+ `!Sub "{{resolve:ssm:/myapp/${Environment}/db-host}}"` looks up the name the substitution produced.
439
+
440
+ A `StringList` parameter resolves to the comma-separated string Parameter Store holds, which
441
+ `Fn::Split` then splits.
442
+
443
+ Real CloudFormation makes no dependency out of a dynamic reference, and neither does this. A
444
+ parameter another resource of the same stack creates is only there in time when the template says
445
+ `DependsOn`.
446
+
447
+ The parameter is read with `GetParameter`, as the caller deploying the stack. A policy denying that
448
+ read fails the resource holding the reference, the way it fails a real deployment. A stack deployed
449
+ without a caller reads as the account root.
450
+
451
+ A `SecureString` parameter is read through `{{resolve:ssm-secure:...}}`, which the next section
452
+ covers. `{{resolve:secretsmanager:...}}` reads a secret, and
453
+ [simulated Secrets Manager](https://yulinsim.dev/services/secretsmanager/#reading-a-secret-with-a-dynamic-reference)
454
+ covers that one.
455
+
456
+ ### A reference the simulation cannot answer
457
+
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.
461
+
462
+ The substitution is recorded on
463
+ [`stack.ignoredProperties`](https://yulinsim.dev/services/cloudformation/#properties-a-resource-was-created-without),
464
+ naming the property that held the reference and why the value is a stand-in. A version the parameter
465
+ never had, a `SecureString`, and a body that is not a name and an optional integer version are all
466
+ recorded the same way.
467
+
468
+ ## Reading a SecureString with an ssm-secure reference
469
+
470
+ `{{resolve:ssm-secure:name}}` reads a `SecureString` parameter and resolves to its decrypted value.
471
+ `{{resolve:ssm-secure:name:3}}` reads version 3. The string scanning is the one plain `ssm`
472
+ references use, so a reference can sit inside a longer value and inside `Fn::Sub`.
473
+
474
+ Decryption goes to simulated KMS under the key the parameter was written with, as the caller
475
+ deploying the stack. A caller lacking `kms:Decrypt` on that key fails the resource with the
476
+ `AccessDenied` a decrypting `GetParameter` raises (see
477
+ [A customer managed key needs its own permission](#a-customer-managed-key-needs-its-own-permission)).
478
+
479
+ CDK writes one of these from `SecretValue.ssmSecure`, from
480
+ `ssm.StringParameter.fromSecureStringParameterAttributes` and from the deprecated
481
+ `valueForSecureStringParameter`.
482
+
483
+ ### Where a reference is accepted
484
+
485
+ Real CloudFormation reads an `ssm-secure` reference in eleven resource properties and refuses it in
486
+ every other one. Simulated CloudFormation holds a template to the same list.
487
+
488
+ | Resource | Property |
489
+ | -------------------------------------- | ------------------------------------------- |
490
+ | `AWS::DirectoryService::MicrosoftAD` | `Password` |
491
+ | `AWS::DirectoryService::SimpleAD` | `Password` |
492
+ | `AWS::ElastiCache::ReplicationGroup` | `AuthToken` |
493
+ | `AWS::IAM::User` | `LoginProfile.Password` |
494
+ | `AWS::KinesisFirehose::DeliveryStream` | `RedshiftDestinationConfiguration.Password` |
495
+ | `AWS::OpsWorks::App` | `Source.Password` |
496
+ | `AWS::OpsWorks::Stack` | `CustomCookbooksSource.Password` |
497
+ | `AWS::OpsWorks::Stack` | `RdsDbInstances.DbPassword` |
498
+ | `AWS::RDS::DBCluster` | `MasterUserPassword` |
499
+ | `AWS::RDS::DBInstance` | `MasterUserPassword` |
500
+ | `AWS::Redshift::Cluster` | `MasterUserPassword` |
501
+
502
+ A reference anywhere else fails the resource, naming the property that held it. A template breaking
503
+ this rule is broken on real CloudFormation too.
504
+
505
+ `AWS::IAM::User` `LoginProfile.Password` is the pair a simulated resource holds today, and it is
506
+ where CDK writes `SecretValue.ssmSecure`. The other ten name resource types this simulation has yet
507
+ to reach.
508
+
509
+ ```typescript sim-ssm-secure-dynamic-reference
510
+ /**
511
+ * Reading a SecureString parameter into a resource property from a template.
512
+ */
513
+
514
+ import { PutParameterCommand } from "@aws-sdk/client-ssm";
515
+
516
+ import { SimAws } from "@kensio/yulin";
517
+
518
+ const simAws = new SimAws();
519
+
520
+ await simAws.ssm().putParameter(
521
+ new PutParameterCommand({
522
+ Name: "/myapp/prod/console-password",
523
+ Type: "SecureString",
524
+ Value: "hunter2",
525
+ }),
526
+ );
527
+
528
+ const stack = await simAws.cloudFormation().deployTemplate({
529
+ stackName: "console-stack",
530
+ template: {
531
+ Resources: {
532
+ ConsoleUser: {
533
+ Type: "AWS::IAM::User",
534
+ Properties: {
535
+ UserName: "ConsoleUser",
536
+ LoginProfile: {
537
+ Password: "{{resolve:ssm-secure:/myapp/prod/console-password}}",
538
+ },
539
+ },
540
+ },
541
+ },
542
+ },
543
+ });
544
+
545
+ await stack.waitForDeployComplete();
546
+
547
+ const user = simAws
548
+ .iam()
549
+ .users.values()
550
+ .find((each) => each.userName === "ConsoleUser");
551
+
552
+ console.log(user?.loginProfile?.password); // "hunter2"
553
+ ```
554
+
555
+ A reference naming a `String` or a `StringList` parameter fails the resource, as real CloudFormation
556
+ fails it. Read a parameter stored in the clear with a plain `{{resolve:ssm:...}}` reference.
557
+
558
+ ### An ssm-secure reference the simulation cannot answer
559
+
560
+ The best-effort path is the one plain `ssm` references take. A reference naming a parameter that was
561
+ never created, or a version the parameter never had, resolves to `dummy-value-for-<name>` and the
562
+ stack carries on deploying. So does a body that is not a name and an optional integer version. Each
563
+ substitution is recorded on
564
+ [`stack.ignoredProperties`](https://yulinsim.dev/services/cloudformation/#properties-a-resource-was-created-without).
565
+
566
+ ## Reading a parameter through a template Parameter
567
+
568
+ A template `Parameters` entry declared as `AWS::SSM::Parameter::Value<String>` is given a parameter
569
+ name, and `Ref` on it gives the value held under that name in the stack's account and region. The
570
+ name comes from the value passed to `CreateStack`, and from the template `Default` when no value is
571
+ passed.
572
+
573
+ ```typescript sim-ssm-template-parameter-value
574
+ /**
575
+ * Reading configuration into a template through a Parameter Store value type.
576
+ */
577
+
578
+ import { PutParameterCommand } from "@aws-sdk/client-ssm";
579
+
580
+ import { SimAws } from "@kensio/yulin";
581
+
582
+ const simAws = new SimAws();
583
+
584
+ await simAws.ssm().putParameter(
585
+ new PutParameterCommand({
586
+ Name: "/myapp/prod/uploads-bucket",
587
+ Type: "String",
588
+ Value: "myapp-prod-uploads",
589
+ }),
590
+ );
591
+
592
+ const stack = await simAws.cloudFormation().deployTemplate({
593
+ stackName: "app-stack",
594
+ template: {
595
+ Parameters: {
596
+ UploadsBucketName: {
597
+ Type: "AWS::SSM::Parameter::Value<String>",
598
+ Default: "/myapp/prod/uploads-bucket",
599
+ },
600
+ },
601
+ Resources: {
602
+ UploadsBucket: {
603
+ Type: "AWS::S3::Bucket",
604
+ Properties: { BucketName: { Ref: "UploadsBucketName" } },
605
+ },
606
+ },
607
+ },
608
+ });
609
+
610
+ await stack.waitForDeployComplete();
611
+
612
+ // The Bucket was created under the name the parameter holds.
613
+ console.log(simAws.s3().getSimBucketByName("myapp-prod-uploads")?.bucketName);
614
+ // "myapp-prod-uploads"
615
+ ```
616
+
617
+ CDK emits this Parameter from `ssm.StringParameter.valueForStringParameter(scope, name)` called
618
+ without a version, carrying the name as the `Default`.
619
+
620
+ `AWS::SSM::Parameter::Value<List<String>>` resolves to the stored comma-separated string split into
621
+ a list, which `Fn::Select` then reads by index. `AWS::SSM::Parameter::Value<CommaDelimitedList>`
622
+ resolves the same way. `ssm.StringListParameter.fromListParameterAttributes` without a version emits
623
+ the first of the two.
624
+
625
+ The `Parameters` section is read before any resource is created, as it is on real AWS. A name a
626
+ resource of the same stack goes on to create is never there in time, whatever the template says
627
+ about `DependsOn`.
628
+
629
+ The stored value goes unchecked against the inner type. A name held against something other than an
630
+ image ID resolves under `AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>`, where real CloudFormation
631
+ refuses the stack.
632
+
633
+ ### A name the simulation cannot answer
634
+
635
+ The same best-effort answer a dynamic reference gets. A name Parameter Store has never held resolves
636
+ to `dummy-value-for-<name>`, and the stack carries on deploying. A `SecureString` resolves that way
637
+ too, since real CloudFormation refuses to read one into a template Parameter.
638
+
639
+ The substitution is recorded on
640
+ [`stack.ignoredProperties`](https://yulinsim.dev/services/cloudformation/#properties-a-resource-was-created-without).
641
+ The `logicalId` names the template Parameter, the `resourceType` gives its declared type, and the
642
+ `path` is `Parameters.<parameter name>`.
643
+
644
+ ## Reading configuration in a Lambda handler
645
+
646
+ Function code that reads its configuration on cold start needs no special treatment. Any
647
+ `@aws-sdk/client-ssm` client the handler creates is intercepted and dispatched with the function's
648
+ execution role as the caller. The role's policy decides whether the read succeeds.
649
+
650
+ ```typescript sim-ssm-lambda-handler-config
651
+ /**
652
+ * A simulated Lambda handler reading its configuration from Parameter Store.
653
+ */
654
+
655
+ import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
656
+ import { CreateFunctionCommand, InvokeCommand } from "@aws-sdk/client-lambda";
657
+ import { PutParameterCommand } from "@aws-sdk/client-ssm";
658
+
659
+ import { SimAws } from "@kensio/yulin";
660
+ import { makeLambdaCodeZip } from "@kensio/yulin/lambda";
661
+
662
+ const simAws = new SimAws();
663
+ const accountId = simAws.defaultAccountId;
664
+ const regionName = simAws.defaultRegionName;
665
+
666
+ await simAws.ssm().putParameter(
667
+ new PutParameterCommand({
668
+ Name: "/myapp/prod/db-host",
669
+ Type: "String",
670
+ Value: "db.internal",
671
+ }),
672
+ );
673
+
674
+ const role = await simAws.iam().createRole(
675
+ new CreateRoleCommand({
676
+ RoleName: "ConfigReaderRole",
677
+ AssumeRolePolicyDocument: JSON.stringify({
678
+ Version: "2012-10-17",
679
+ Statement: {
680
+ Effect: "Allow",
681
+ Principal: { Service: "lambda.amazonaws.com" },
682
+ Action: "sts:AssumeRole",
683
+ },
684
+ }),
685
+ }),
686
+ );
687
+
688
+ await simAws.iam().putRolePolicy(
689
+ new PutRolePolicyCommand({
690
+ RoleName: "ConfigReaderRole",
691
+ PolicyName: "ReadConfig",
692
+ PolicyDocument: JSON.stringify({
693
+ Version: "2012-10-17",
694
+ Statement: {
695
+ Effect: "Allow",
696
+ Action: "ssm:GetParameter",
697
+ Resource: `arn:aws:ssm:${regionName}:${accountId}:parameter/myapp/prod/*`,
698
+ },
699
+ }),
700
+ }),
701
+ );
702
+
703
+ const handlerCode = [
704
+ 'const { SSMClient, GetParameterCommand } = require("@aws-sdk/client-ssm");',
705
+ "exports.handler = async () => {",
706
+ " const client = new SSMClient({});",
707
+ ' const command = new GetParameterCommand({ Name: "/myapp/prod/db-host" });',
708
+ " const out = await client.send(command);",
709
+ " return out.Parameter.Value;",
710
+ "};",
711
+ ].join("\n");
712
+
713
+ const zipFile = makeLambdaCodeZip({ "index.js": handlerCode });
714
+
715
+ await simAws.lambda().createFunction(
716
+ new CreateFunctionCommand({
717
+ FunctionName: "config-reader",
718
+ Role: role.Role.Arn,
719
+ Handler: "index.handler",
720
+ Code: { ZipFile: zipFile },
721
+ }),
722
+ );
723
+
724
+ await simAws.backgroundTasksComplete();
725
+
726
+ const invoked = await simAws
727
+ .lambda()
728
+ .invoke(new InvokeCommand({ FunctionName: "config-reader" }));
729
+
730
+ console.log(Buffer.from(invoked.Payload ?? []).toString("utf8")); // "db.internal"
731
+ ```
732
+
733
+ ## Account and region scoping
734
+
735
+ A parameter belongs to one account and region, as it does on real AWS. The same name in another
736
+ scope is another parameter.
737
+
738
+ ```typescript sim-ssm-scoping
739
+ /**
740
+ * The same simulated parameter name in two Account and Region scopes.
741
+ */
742
+
743
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
744
+
745
+ import { SimAws } from "@kensio/yulin";
746
+
747
+ const simAws = new SimAws();
748
+
749
+ await simAws
750
+ .account("111111111111")
751
+ .region("eu-west-2")
752
+ .ssm()
753
+ .putParameter(
754
+ new PutParameterCommand({
755
+ Name: "/myapp/db-host",
756
+ Type: "String",
757
+ Value: "eu.db.internal",
758
+ }),
759
+ );
760
+
761
+ await simAws
762
+ .account("222222222222")
763
+ .region("us-east-1")
764
+ .ssm()
765
+ .putParameter(
766
+ new PutParameterCommand({
767
+ Name: "/myapp/db-host",
768
+ Type: "String",
769
+ Value: "us.db.internal",
770
+ }),
771
+ );
772
+
773
+ const read = await simAws
774
+ .account("111111111111")
775
+ .region("eu-west-2")
776
+ .ssm()
777
+ .getParameter(new GetParameterCommand({ Name: "/myapp/db-host" }));
778
+
779
+ console.log(read.Parameter?.ARN);
780
+ // "arn:aws:ssm:eu-west-2:111111111111:parameter/myapp/db-host"
781
+ ```
782
+
783
+ ## SecureString parameters
784
+
785
+ A `SecureString` value is encrypted through simulated KMS, under the `aws/ssm` AWS managed key unless
786
+ the request names a key of its own. Simulated KMS creates that managed key the first time something
787
+ asks for it, with no setup needed.
788
+
789
+ A read returns the ciphertext unless it asks for decryption. This is the mistake that is easy to make
790
+ and hard to see. A handler that forgets `WithDecryption` parses a base64 blob as if it were a
791
+ password.
792
+
793
+ ```typescript sim-ssm-secure-string
794
+ /**
795
+ * Writing and reading a simulated SecureString parameter.
796
+ */
797
+
798
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
799
+
800
+ import { SimAws } from "@kensio/yulin";
801
+
802
+ const simAws = new SimAws();
803
+ const ssm = simAws.ssm();
804
+
805
+ await ssm.putParameter(
806
+ new PutParameterCommand({
807
+ Name: "/myapp/prod/db-password",
808
+ Type: "SecureString",
809
+ Value: "hunter2",
810
+ }),
811
+ );
812
+
813
+ const encrypted = await ssm.getParameter(
814
+ new GetParameterCommand({ Name: "/myapp/prod/db-password" }),
815
+ );
816
+
817
+ console.log(encrypted.Parameter?.Value); // a base64 ciphertext, not "hunter2"
818
+
819
+ const decrypted = await ssm.getParameter(
820
+ new GetParameterCommand({
821
+ Name: "/myapp/prod/db-password",
822
+ WithDecryption: true,
823
+ }),
824
+ );
825
+
826
+ console.log(decrypted.Parameter?.Value); // "hunter2"
827
+ ```
828
+
829
+ `WithDecryption` on a `String` or `StringList` parameter is ignored, as real Parameter Store ignores
830
+ it.
831
+
832
+ Pass `KeyId` to encrypt under a customer managed key instead. A `KeyId` naming a key that is absent,
833
+ disabled, or pending deletion fails with `InvalidKeyId`. That is how real Parameter Store reports
834
+ every KMS key problem.
835
+
836
+ Each value is bound to its own parameter's ARN as the KMS encryption context, under the
837
+ `PARAMETER_ARN` key. A ciphertext lifted out of one parameter cannot be decrypted as another.
838
+
839
+ ### A customer managed key needs its own permission
840
+
841
+ Encrypting and decrypting go to simulated KMS as the caller, not as the service. Under a customer
842
+ managed key a write needs `kms:Encrypt` on the key on top of `ssm:PutParameter` on the parameter, and
843
+ a decrypting read needs `kms:Decrypt` on top of `ssm:GetParameter`. A role granted one and not the
844
+ other fails here, ahead of a deployment.
845
+
846
+ ```typescript sim-ssm-secure-string-permissions
847
+ /**
848
+ * A Role allowed to read a simulated SecureString but not to decrypt it.
849
+ */
850
+
851
+ import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
852
+ import { CreateKeyCommand } from "@aws-sdk/client-kms";
853
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
854
+
855
+ import { SimAws } from "@kensio/yulin";
856
+
857
+ const simAws = new SimAws();
858
+ const accountId = simAws.defaultAccountId;
859
+
860
+ const key = await simAws
861
+ .kms()
862
+ .createKey(new CreateKeyCommand({ Description: "Parameter key" }));
863
+
864
+ await simAws.ssm().putParameter(
865
+ new PutParameterCommand({
866
+ Name: "/myapp/prod/db-password",
867
+ Type: "SecureString",
868
+ Value: "hunter2",
869
+ KeyId: key.KeyMetadata?.Arn,
870
+ }),
871
+ );
872
+
873
+ const role = await simAws.iam().createRole(
874
+ new CreateRoleCommand({
875
+ RoleName: "ConfigReader",
876
+ AssumeRolePolicyDocument: JSON.stringify({
877
+ Version: "2012-10-17",
878
+ Statement: {
879
+ Effect: "Allow",
880
+ Principal: { AWS: `arn:aws:iam::${accountId}:root` },
881
+ Action: "sts:AssumeRole",
882
+ },
883
+ }),
884
+ }),
885
+ );
886
+
887
+ // The parameter is allowed, the key is not.
888
+ await simAws.iam().putRolePolicy(
889
+ new PutRolePolicyCommand({
890
+ RoleName: "ConfigReader",
891
+ PolicyName: "ReadDbPassword",
892
+ PolicyDocument: JSON.stringify({
893
+ Version: "2012-10-17",
894
+ Statement: {
895
+ Effect: "Allow",
896
+ Action: "ssm:GetParameter",
897
+ Resource: "*",
898
+ },
899
+ }),
900
+ }),
901
+ );
902
+
903
+ const caller = { kind: "arn", arn: role.Role.Arn } as const;
904
+
905
+ try {
906
+ await simAws.ssm().getParameter(
907
+ new GetParameterCommand({
908
+ Name: "/myapp/prod/db-password",
909
+ WithDecryption: true,
910
+ }),
911
+ { caller },
912
+ );
913
+ } catch (error) {
914
+ console.log((error as Error).name); // "AccessDenied"
915
+ }
916
+ ```
917
+
918
+ ### The aws/ssm managed key needs kms:Decrypt too
919
+
920
+ A parameter naming no key is encrypted under the `aws/ssm` AWS managed key. Parameter Store supplies
921
+ `kms:ViaService`, and that key's policy allows the account's principals to use it through Systems
922
+ Manager. What the policy admits is whoever the request came from. Parameter Store decrypts with the
923
+ caller's own permissions, and a decrypting read needs `kms:Decrypt` on top of `ssm:GetParameter`. A
924
+ role holding the parameter permission alone reads the ciphertext and is refused when it asks for
925
+ decryption, as it is in a real account.
926
+
927
+ The managed key's id is unknown when a template is synthesized. A policy scopes the grant with a
928
+ `kms:ViaService` condition naming `ssm.<region>.amazonaws.com`, and simulated IAM evaluates that
929
+ condition against the region the parameter belongs to.
930
+
931
+ `GetParameters` and `GetParametersByPath` decrypt through the same path, and refuse the same way for
932
+ a caller without the key permission.
933
+
934
+ The same role cannot take the ciphertext to KMS itself, because the managed key's policy applies
935
+ only to a request that reached KMS through Systems Manager.
936
+
937
+ ```typescript sim-ssm-secure-string-managed-key
938
+ /**
939
+ * Reading a simulated SecureString under the aws/ssm managed key.
940
+ */
941
+
942
+ import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
943
+ import { GetParameterCommand, PutParameterCommand } from "@aws-sdk/client-ssm";
944
+
945
+ import { SimAws } from "@kensio/yulin";
946
+
947
+ const simAws = new SimAws();
948
+ const accountId = simAws.defaultAccountId;
949
+
950
+ await simAws.ssm().putParameter(
951
+ new PutParameterCommand({
952
+ Name: "/myapp/prod/db-password",
953
+ Type: "SecureString",
954
+ Value: "hunter2",
955
+ }),
956
+ );
957
+
958
+ const role = await simAws.iam().createRole(
959
+ new CreateRoleCommand({
960
+ RoleName: "ConfigReader",
961
+ AssumeRolePolicyDocument: JSON.stringify({
962
+ Version: "2012-10-17",
963
+ Statement: {
964
+ Effect: "Allow",
965
+ Principal: { AWS: `arn:aws:iam::${accountId}:root` },
966
+ Action: "sts:AssumeRole",
967
+ },
968
+ }),
969
+ }),
970
+ );
971
+
972
+ // The parameter, and the key through Systems Manager.
973
+ await simAws.iam().putRolePolicy(
974
+ new PutRolePolicyCommand({
975
+ RoleName: "ConfigReader",
976
+ PolicyName: "ReadDbPassword",
977
+ PolicyDocument: JSON.stringify({
978
+ Version: "2012-10-17",
979
+ Statement: [
980
+ { Effect: "Allow", Action: "ssm:GetParameter", Resource: "*" },
981
+ {
982
+ Effect: "Allow",
983
+ Action: "kms:Decrypt",
984
+ Resource: "*",
985
+ Condition: {
986
+ StringEquals: {
987
+ "kms:ViaService": `ssm.${simAws.defaultRegionName}.amazonaws.com`,
988
+ },
989
+ },
990
+ },
991
+ ],
992
+ }),
993
+ }),
994
+ );
995
+
996
+ const read = await simAws.ssm().getParameter(
997
+ new GetParameterCommand({
998
+ Name: "/myapp/prod/db-password",
999
+ WithDecryption: true,
1000
+ }),
1001
+ { caller: { kind: "arn", arn: role.Role.Arn } },
1002
+ );
1003
+
1004
+ console.log(read.Parameter?.Value); // "hunter2"
1005
+ ```
1006
+
1007
+ `DescribeParameters` reports the key each `SecureString` is encrypted under as `KeyId`.
1008
+
1009
+ ## Available functionality
1010
+
1011
+ Sim SSM currently supports:
1012
+
1013
+ - `PutParameterCommand`, creating a parameter or overwriting one
1014
+ - `GetParameterCommand`, by name, by `name:version` or by `name:label`
1015
+ - `GetParametersCommand`, reporting names it could not resolve in `InvalidParameters`
1016
+ - `GetParametersByPathCommand`, with and without `Recursive`
1017
+ - `DeleteParameterCommand` and `DeleteParametersCommand`
1018
+ - `DescribeParametersCommand`
1019
+ - `String`, `StringList` and `SecureString` parameter types
1020
+ - `SecureString` values encrypted through simulated KMS, decrypted only with `WithDecryption`
1021
+ - The `AWS::SSM::Parameter` CloudFormation resource, including `Ref` and `Fn::GetAtt`
1022
+ - `{{resolve:ssm:...}}` dynamic references in CloudFormation resource properties, by version or by
1023
+ current value, embedded in a longer string and inside `Fn::Sub`
1024
+ - `{{resolve:ssm-secure:...}}` dynamic references, decrypting the `SecureString` through the KMS key
1025
+ it was written under, in the eleven resource properties CloudFormation reads one in
1026
+ - `StringList` parameters read through a dynamic reference as the comma-separated string `Fn::Split`
1027
+ then splits
1028
+ - `AWS::SSM::Parameter::Value<String>` template parameters, resolving `Ref` to the stored value
1029
+ - `AWS::SSM::Parameter::Value<List<String>>` and `<CommaDelimitedList>` template parameters,
1030
+ resolving `Ref` to the stored string split into a list
1031
+ - Parameter name validation, including hierarchy depth and the reserved `aws` and `ssm` prefixes
1032
+ - Authorization of every operation by simulated IAM, against the real IAM action and ARN
1033
+ - Calls made from inside a simulated Lambda handler, authorized as the function's execution role
1034
+
1035
+ ## Limitations
1036
+
1037
+ Current documented limitations:
1038
+
1039
+ - Only standard tier `SecureString` encryption is simulated, which encrypts under the KMS key
1040
+ directly. The advanced tier's envelope encryption through the AWS Encryption SDK is left out, and
1041
+ `kms:GenerateDataKey` is never needed.
1042
+ - Parameter labels are left out. `LabelParameterVersion` is unimplemented, so a label can never be
1043
+ created, and a `name:label` selector is refused with an error saying so.
1044
+ - `GetParameterHistory` is absent, though earlier versions stay readable by number.
1045
+ - The advanced tier is left out. `Tier: Advanced` and `Tier: Intelligent-Tiering` are refused, and
1046
+ every parameter reports `Tier: Standard` with the 4KB standard tier value limit.
1047
+ - Parameter policies (expiration and notification) are left out. `Policies` is refused, and
1048
+ `DescribeParameters` always reports an empty `Policies` list.
1049
+ - Tags are left out. `Tags` on `PutParameter` is refused, and `AddTagsToResource`,
1050
+ `RemoveTagsFromResource` and `ListTagsForResource` are absent.
1051
+ - `AllowedPattern` is refused outright. Ignoring it would store a value it was meant to reject,
1052
+ without complaint.
1053
+ - `KeyId` on a `String` or `StringList` parameter is refused, since nothing would encrypt a value
1054
+ stored in the clear.
1055
+ - Writing a `SecureString` under the `aws/ssm` managed key asks the caller for no KMS permission,
1056
+ where AWS documents `kms:Encrypt` for a standard tier write. A write under a customer managed key
1057
+ does need it.
1058
+ - `DataType` other than `text` is refused. Real Parameter Store validates an `aws:ec2:image` value
1059
+ against EC2, which this simulation cannot do.
1060
+ - Filters are refused outright. `GetParametersByPath` refuses `ParameterFilters`, and
1061
+ `DescribeParameters` refuses `Filters` and `ParameterFilters`. Parameters are listed in name order.
1062
+ - `DescribeParameters` refuses `Shared`. Parameters cannot be shared between simulated accounts, and
1063
+ there is no resource policy support, so cross-account access to a parameter cannot be granted.
1064
+ - Every version is kept. Real Parameter Store keeps the hundred most recent versions and deletes the
1065
+ oldest as new ones are made, which can fail with `ParameterMaxVersionLimitExceeded`.
1066
+ - There is no per-account parameter count limit, so `ParameterLimitExceeded` never happens.
1067
+ - Deletion is immediate. Real Parameter Store asks for thirty seconds before a deleted name is
1068
+ reused, where here the name is free straight away.
1069
+ - `AWS::SSM::Parameter` supports `Name`, `Type`, `Value`, `Description` and `Tier`. `AllowedPattern`,
1070
+ `DataType`, `Policies` and `Tags` reach `PutParameter`, which refuses them for the reasons above.
1071
+ `Type: SecureString` is refused, as real CloudFormation refuses it for this resource type. The
1072
+ plaintext value would sit in the template.
1073
+ - The other `AWS::SSM::*` resource types (`Document`, `Association`, `MaintenanceWindow`,
1074
+ `PatchBaseline`, `ResourceDataSync` and the rest) are reported as unsupported and skipped.
1075
+ - Every deployment of an `AWS::SSM::Parameter` is a create. A name another stack already used is
1076
+ refused. A stack update that changes `Value` deletes the parameter and creates it again, where
1077
+ real CloudFormation overwrites it in place, so the parameter's version starts from 1 again.
1078
+ - A template parameter typed as `AWS::SSM::Parameter::Value<...>` is read once, while the
1079
+ `Parameters` section is. Real CloudFormation does the same, so a name that only exists once the
1080
+ stack has deployed resolves to a stand-in value here and fails the stack there.
1081
+ - The value a template parameter resolves to goes unvalidated against the inner type. The
1082
+ `AWS::EC2::*` and `AWS::Route53::HostedZone::Id` inner types name EC2 and Route53 resources, which
1083
+ this simulation holds none of.
1084
+ - A `{{resolve:ssm:...}}` or `{{resolve:ssm-secure:...}}` reference naming a parameter, or a
1085
+ version, that simulated Parameter Store has never held resolves to `dummy-value-for-<name>` and
1086
+ records the substitution. Real CloudFormation fails the stack. A template parameter naming one
1087
+ gets the same stand-in value.
1088
+ - An `ssm-secure` reference reads the stack's own account and region. A parameter in another account
1089
+ is out of reach on real CloudFormation as well.
1090
+ - Public parameters under `/aws/service/...` do not exist, and names under the reserved `aws` and
1091
+ `ssm` prefixes are refused, as they are on real AWS.
1092
+ - The Parameters and Secrets Lambda extension HTTP endpoint is absent. Handler code has to use the
1093
+ SDK.
1094
+ - Systems Manager is otherwise left out. Run Command, Session Manager, Patch Manager, State Manager,
1095
+ Automation, inventory and maintenance windows are all absent.
1096
+ - SSM is not served as an HTTP API by `serveSimAws`.