@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.
- package/README.md +13 -0
- package/dist/sdk/module/sim-sdk-module-client-interceptor.d.ts +5 -0
- package/dist/sdk/module/sim-sdk-module-client-interceptor.js +14 -0
- package/dist/sdk/module/sim-sdk-static-client-factory.d.ts +26 -0
- package/dist/sdk/module/sim-sdk-static-client-factory.js +59 -0
- package/dist/sdk/send-patch.d.ts +8 -0
- package/dist/sdk/send-patch.js +11 -0
- package/dist/service/aws/caller/sim-aws-ambient-caller.d.ts +23 -0
- package/dist/service/aws/caller/sim-aws-ambient-caller.js +12 -0
- package/dist/service/aws/caller/sim-aws-caller-resolver.d.ts +39 -6
- package/dist/service/aws/caller/sim-aws-caller-resolver.js +32 -30
- package/dist/service/aws/caller/sim-aws-caller.d.ts +9 -0
- package/dist/service/aws/caller/sim-aws-resolved-caller.d.ts +19 -0
- package/dist/service/aws/caller/sim-aws-resolved-caller.js +26 -0
- package/dist/service/aws/factory/sim-aws-account-region-service-builder.d.ts +12 -0
- package/dist/service/aws/factory/sim-aws-account-region-service-builder.js +6 -0
- package/dist/service/aws/factory/sim-aws-account-service-cache.d.ts +12 -0
- package/dist/service/aws/factory/sim-aws-account-service-cache.js +9 -0
- package/dist/service/aws/factory/sim-aws-registered-service-builder.js +3 -1
- package/dist/service/aws/factory/sim-aws-service-factory.d.ts +5 -0
- package/dist/service/aws/factory/sim-aws-service-factory.js +14 -0
- package/dist/service/aws/sim-aws-properties.d.ts +15 -0
- package/dist/service/aws/sim-aws.js +2 -1
- package/dist/service/cloudformation/command/create-stack/create-stack.handler.d.ts +4 -0
- package/dist/service/cloudformation/command/create-stack/create-stack.handler.js +4 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.js +2 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-plan.d.ts +11 -2
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-plan.js +2 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +6 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +11 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js +17 -15
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.d.ts +12 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.js +2 -1
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cache-policy-cfn.d.ts +23 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cache-policy-cfn.js +30 -0
- package/dist/service/cloudformation/resource/cfn/cloudfront/sim-cloudfront-cfn-value-adapter.js +8 -0
- package/dist/service/cloudformation/resource/name/sim-cfn-generated-resource-name.d.ts +29 -12
- package/dist/service/cloudformation/resource/name/sim-cfn-generated-resource-name.js +51 -20
- package/dist/service/cloudformation/stack/deploy/sim-cfn-resource-order.d.ts +19 -0
- package/dist/service/cloudformation/stack/deploy/sim-cfn-resource-order.js +6 -0
- package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-batch-creator.d.ts +7 -0
- package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-batch-creator.js +9 -2
- package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-creator.d.ts +2 -0
- package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-creator.js +2 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.d.ts +6 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.js +4 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.js +2 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.type.d.ts +6 -0
- package/dist/service/cloudfront/behaviour/sim-cloud-front-behavior.d.ts +5 -0
- package/dist/service/cloudfront/cache-policy/sim-cf-cache-policy-registry.d.ts +37 -0
- package/dist/service/cloudfront/cache-policy/sim-cf-cache-policy-registry.js +50 -0
- package/dist/service/cloudfront/cache-policy/sim-cf-cache-policy.d.ts +25 -0
- package/dist/service/cloudfront/cache-policy/sim-cf-cache-policy.js +21 -0
- package/dist/service/cloudfront/cache-policy/sim-cf-managed-cache-policies.d.ts +28 -0
- package/dist/service/cloudfront/cache-policy/sim-cf-managed-cache-policies.js +48 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.d.ts +8 -0
- package/dist/service/cloudfront/cff/function-code-input/cff-function-code-input.js +13 -0
- package/dist/service/cloudfront/cff/sim-cf-function-commands.d.ts +52 -0
- package/dist/service/cloudfront/cff/sim-cf-function-commands.js +51 -0
- package/dist/service/cloudfront/cff/sim-cff-configuration.d.ts +41 -0
- package/dist/service/cloudfront/cff/sim-cff-configuration.js +34 -0
- package/dist/service/cloudfront/cff/sim-cff-stage.d.ts +23 -0
- package/dist/service/cloudfront/cff/sim-cff-stage.js +30 -0
- package/dist/service/cloudfront/cff/sim-cloudfront-function.d.ts +6 -1
- package/dist/service/cloudfront/cff/sim-cloudfront-function.js +6 -0
- package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-config.d.ts +27 -0
- package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-config.js +42 -0
- package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-creator.d.ts +24 -0
- package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-creator.js +32 -0
- 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
- package/dist/service/cloudfront/cfn/distro/{sim-cfn-cf-distro-response-headers-policy.js → sim-cfn-cf-distro-behavior-policies.js} +11 -37
- package/dist/service/cloudfront/cfn/distro/sim-cfn-cf-distro-creator.d.ts +6 -5
- package/dist/service/cloudfront/cfn/distro/sim-cfn-cf-distro-creator.js +8 -7
- package/dist/service/cloudfront/cfn/distro/sim-cfn-cf-distro-policy-drops.d.ts +23 -0
- package/dist/service/cloudfront/cfn/distro/sim-cfn-cf-distro-policy-drops.js +50 -0
- package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.d.ts +1 -0
- package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.js +10 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.command.d.ts +1 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts +2 -0
- package/dist/service/cloudfront/command/create-function/create-function.handler.js +7 -1
- package/dist/service/cloudfront/command/function/sim-cf-describe-function.d.ts +22 -0
- package/dist/service/cloudfront/command/function/sim-cf-describe-function.js +32 -0
- package/dist/service/cloudfront/command/function/sim-cf-function-access.d.ts +48 -0
- package/dist/service/cloudfront/command/function/sim-cf-function-access.js +48 -0
- package/dist/service/cloudfront/command/function/sim-cf-function-command.types.d.ts +97 -0
- package/dist/service/cloudfront/command/function/sim-cf-function-command.types.js +10 -0
- package/dist/service/cloudfront/command/function/sim-cf-function-lookup.d.ts +12 -0
- package/dist/service/cloudfront/command/function/sim-cf-function-lookup.js +21 -0
- package/dist/service/cloudfront/command/function/sim-cf-function-summary.d.ts +11 -0
- package/dist/service/cloudfront/command/function/sim-cf-function-summary.js +30 -0
- package/dist/service/cloudfront/command/function/sim-cf-get-function.d.ts +23 -0
- package/dist/service/cloudfront/command/function/sim-cf-get-function.js +33 -0
- package/dist/service/cloudfront/command/function/sim-cf-list-functions.d.ts +22 -0
- package/dist/service/cloudfront/command/function/sim-cf-list-functions.js +38 -0
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts +2 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-cache-policy.d.ts +18 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-cache-policy.js +30 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-policies.d.ts +28 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-policies.js +41 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts +2 -2
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js +6 -3
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.d.ts +0 -10
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.js +0 -19
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.d.ts +2 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.js +4 -2
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.d.ts +3 -3
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.js +5 -5
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts +3 -3
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js +4 -4
- package/dist/service/cloudfront/distribution/sim-cf-distribution-configuration-state.d.ts +3 -1
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.d.ts +2 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +21 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.js +25 -0
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.js +2 -10
- package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store.js +2 -1
- package/dist/service/cloudfront/sdk/sim-cloudfront-sdk-command-router.js +12 -0
- package/dist/service/cloudfront/sim-cf-authorize.d.ts +16 -0
- package/dist/service/cloudfront/sim-cf-authorize.js +19 -0
- package/dist/service/cloudfront/sim-cf-etag.d.ts +7 -0
- package/dist/service/cloudfront/sim-cf-etag.js +10 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts +8 -12
- package/dist/service/cloudfront/sim-cloudfront-commands.js +8 -17
- package/dist/service/cloudfront/sim-cloudfront-policies.d.ts +43 -0
- package/dist/service/cloudfront/sim-cloudfront-policies.js +53 -0
- package/dist/service/cloudfront/sim-cloudfront.d.ts +13 -17
- package/dist/service/cloudfront/sim-cloudfront.js +22 -25
- package/dist/service/ecr/authorize/sim-ecr-authorizer.d.ts +31 -0
- package/dist/service/ecr/authorize/sim-ecr-authorizer.js +38 -0
- package/dist/service/ecr/cfn/repository/sim-cfn-ecr-repository-creator.d.ts +11 -2
- package/dist/service/ecr/cfn/repository/sim-cfn-ecr-repository-creator.js +11 -2
- package/dist/service/ecr/cfn/sim-ecr-cfn-resource-factory.d.ts +4 -2
- package/dist/service/ecr/cfn/sim-ecr-cfn-resource-factory.js +8 -9
- package/dist/service/ecr/cfn/sim-ecr-cfn-unsupported-resource.d.ts +7 -0
- package/dist/service/ecr/cfn/sim-ecr-cfn-unsupported-resource.js +9 -0
- package/dist/service/ecr/sim-ecr.d.ts +7 -0
- package/dist/service/ecr/sim-ecr.js +16 -4
- package/dist/service/ecs/command/authorize/sim-ecs-authorizer.d.ts +12 -0
- package/dist/service/ecs/command/authorize/sim-ecs-authorizer.js +21 -0
- package/dist/service/ecs/command/register-task-definition/register-task-definition.handler.js +1 -0
- package/dist/service/ecs/sim-ecs-service-principal.d.ts +8 -0
- package/dist/service/ecs/sim-ecs-service-principal.js +8 -0
- package/dist/service/eventbridge/command/authorize/sim-event-bridge-authorizer.d.ts +12 -0
- package/dist/service/eventbridge/command/authorize/sim-event-bridge-authorizer.js +21 -0
- package/dist/service/eventbridge/command/rule/sim-event-bridge-rule-access.d.ts +13 -0
- package/dist/service/eventbridge/command/rule/sim-event-bridge-rule-access.js +9 -0
- package/dist/service/eventbridge/command/target/sim-event-bridge-put-targets.js +1 -0
- package/dist/service/firehose/command/authorize/sim-firehose-authorizer.d.ts +12 -0
- package/dist/service/firehose/command/authorize/sim-firehose-authorizer.js +20 -0
- package/dist/service/firehose/command/sim-firehose-delivery-stream-access.d.ts +4 -0
- package/dist/service/firehose/command/sim-firehose-delivery-stream-access.js +6 -0
- package/dist/service/firehose/command/stream/sim-firehose-create-delivery-stream.js +3 -1
- package/dist/service/firehose/sim-firehose-service-principal.d.ts +8 -0
- package/dist/service/firehose/sim-firehose-service-principal.js +8 -0
- package/dist/service/firehose/source/sim-firehose-source.d.ts +5 -0
- package/dist/service/firehose/source/sim-firehose-source.js +5 -0
- package/dist/service/glue/cfn/database/sim-cfn-glue-database-properties.js +2 -2
- package/dist/service/glue/cfn/sim-cfn-glue-generated-name.d.ts +10 -0
- package/dist/service/glue/cfn/sim-cfn-glue-generated-name.js +25 -0
- package/dist/service/glue/cfn/table/sim-cfn-glue-table-properties.js +2 -3
- package/dist/service/iam/authorize/allow/sim-iam-allow-requirement.d.ts +33 -2
- package/dist/service/iam/authorize/allow/sim-iam-allow-requirement.js +33 -2
- package/dist/service/iam/authorize/allow/sim-iam-allow-statements.d.ts +4 -3
- package/dist/service/iam/authorize/allow/sim-iam-allow-statements.js +9 -3
- package/dist/service/iam/authorize/context/sim-iam-auth-z-allow-requirement.d.ts +14 -5
- package/dist/service/iam/authorize/context/sim-iam-auth-z-allow-requirement.js +16 -12
- package/dist/service/iam/authorize/context/sim-iam-auth-z-caller-context-builder.d.ts +36 -7
- package/dist/service/iam/authorize/context/sim-iam-auth-z-caller-context-builder.js +22 -11
- package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.d.ts +10 -71
- package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.js +7 -2
- package/dist/service/iam/authorize/context/sim-iam-auth-z-input.d.ts +87 -0
- package/dist/service/iam/authorize/context/sim-iam-auth-z-input.js +1 -0
- package/dist/service/iam/authorize/match/sim-iam-policy-principal-matcher.d.ts +21 -3
- package/dist/service/iam/authorize/match/sim-iam-policy-principal-matcher.js +34 -10
- package/dist/service/iam/authorize/match/sim-iam-principal-match.d.ts +29 -8
- package/dist/service/iam/authorize/match/sim-iam-principal-match.js +38 -13
- package/dist/service/iam/authorize/pass-role/sim-iam-pass-role-authorizer.d.ts +74 -0
- package/dist/service/iam/authorize/pass-role/sim-iam-pass-role-authorizer.js +92 -0
- package/dist/service/iam/authorize/sim-iam-account-auth-z.d.ts +21 -5
- package/dist/service/iam/authorize/sim-iam-account-auth-z.js +7 -3
- package/dist/service/iam/authorize/sim-iam-authorizer.d.ts +5 -2
- package/dist/service/iam/authorize/sim-iam-authorizer.js +3 -1
- package/dist/service/iam/authorize/sim-iam-inter-service-auth-z.d.ts +1 -1
- package/dist/service/iam/authorize/sim-iam-wildcard.js +39 -4
- package/dist/service/iam/cfn/managed-policy/sim-cfn-iam-managed-policy-creator.js +2 -1
- package/dist/service/iam/cfn/name/sim-cfn-iam-generated-name.d.ts +16 -0
- package/dist/service/iam/cfn/name/sim-cfn-iam-generated-name.js +36 -0
- package/dist/service/iam/cfn/role/sim-cfn-iam-role-properties-parser.js +9 -8
- package/dist/service/iam/cfn/sim-cfn-iam-optional-string.d.ts +17 -0
- package/dist/service/iam/cfn/sim-cfn-iam-optional-string.js +17 -0
- package/dist/service/iam/cfn/user/sim-cfn-iam-user-properties-parser.js +4 -8
- package/dist/service/iam/command/policy/create-policy/create-policy-input-resolver.js +2 -0
- package/dist/service/iam/command/policy/put-role-policy/put-role-policy.handler.js +5 -0
- package/dist/service/iam/command/policy/put-user-policy/put-user-policy.handler.js +5 -0
- package/dist/service/iam/command/role/create-role/create-role.handler.js +4 -1
- package/dist/service/iam/error/sim-iam.error.d.ts +11 -0
- package/dist/service/iam/error/sim-iam.error.js +13 -0
- package/dist/service/iam/index.d.ts +1 -0
- package/dist/service/iam/policy/sim-iam-policy-document-of-size.d.ts +18 -0
- package/dist/service/iam/policy/sim-iam-policy-document-of-size.js +41 -0
- package/dist/service/iam/role/sim-iam-deploy-role.d.ts +56 -0
- package/dist/service/iam/role/sim-iam-deploy-role.js +50 -0
- package/dist/service/iam/role/sim-iam-role-with-policy.factory.d.ts +11 -0
- package/dist/service/iam/role/sim-iam-role-with-policy.factory.js +4 -2
- package/dist/service/iam/sim-iam-account-parts.d.ts +16 -0
- package/dist/service/iam/sim-iam-account-parts.js +2 -0
- package/dist/service/iam/sim-iam.d.ts +12 -2
- package/dist/service/iam/sim-iam.js +12 -0
- package/dist/service/iam/validate/size/sim-iam-policy-document-size.d.ts +57 -0
- package/dist/service/iam/validate/size/sim-iam-policy-document-size.js +71 -0
- package/dist/service/kms/command/authorize/sim-kms-authorizer.d.ts +3 -1
- package/dist/service/kms/command/authorize/sim-kms-authorizer.js +4 -1
- package/dist/service/kms/command/sim-kms-request-options.d.ts +11 -0
- package/dist/service/kms/key/sim-kms-key-policy.d.ts +5 -4
- package/dist/service/kms/key/sim-kms-key-policy.js +4 -3
- package/dist/service/lambda/cfn/function/sim-cfn-lambda-function-properties-parser.d.ts +2 -2
- package/dist/service/lambda/cfn/function/sim-cfn-lambda-function-properties-parser.js +4 -3
- package/dist/service/lambda/cfn/function/sim-cfn-lambda-generated-function-name.d.ts +10 -0
- package/dist/service/lambda/cfn/function/sim-cfn-lambda-generated-function-name.js +25 -0
- package/dist/service/lambda/command/authorize/sim-lambda-resource-policies.d.ts +1 -1
- package/dist/service/lambda/command/create-function/create-function-authorizer.d.ts +9 -2
- package/dist/service/lambda/command/create-function/create-function-authorizer.js +16 -2
- package/dist/service/lambda/command/create-function/create-function.handler.js +1 -1
- package/dist/service/lambda/command/update-function-configuration/update-function-configuration-authorizer.d.ts +7 -2
- package/dist/service/lambda/command/update-function-configuration/update-function-configuration-authorizer.js +14 -2
- package/dist/service/lambda/command/update-function-configuration/update-function-configuration.handler.js +1 -1
- package/dist/service/lambda/function/logging/sim-lambda-function-logging.d.ts +10 -1
- package/dist/service/lambda/function/logging/sim-lambda-function-logging.js +25 -1
- package/dist/service/lambda/function/logging/sim-lambda-invoke-error-log.d.ts +13 -0
- package/dist/service/lambda/function/logging/sim-lambda-invoke-error-log.js +18 -0
- package/dist/service/lambda/sim-lambda-service-principal.d.ts +7 -0
- package/dist/service/lambda/sim-lambda-service-principal.js +7 -0
- package/dist/service/logs/cfn/delivery/sim-cfn-delivery-authorization.d.ts +46 -0
- package/dist/service/logs/cfn/delivery/sim-cfn-delivery-authorization.js +49 -0
- package/dist/service/logs/cfn/delivery/sim-cfn-delivery-creator.d.ts +5 -0
- package/dist/service/logs/cfn/delivery/sim-cfn-delivery-creator.js +6 -0
- package/dist/service/logs/cfn/delivery/sim-cfn-delivery-destination-creator.d.ts +5 -0
- package/dist/service/logs/cfn/delivery/sim-cfn-delivery-destination-creator.js +6 -0
- package/dist/service/logs/cfn/delivery/sim-cfn-delivery-source-creator.d.ts +5 -0
- package/dist/service/logs/cfn/delivery/sim-cfn-delivery-source-creator.js +6 -0
- package/dist/service/logs/cfn/group/sim-cfn-log-group-creator.d.ts +9 -2
- package/dist/service/logs/cfn/group/sim-cfn-log-group-creator.js +34 -5
- package/dist/service/logs/cfn/sim-logs-cfn-resource-deleter.js +1 -1
- package/dist/service/logs/cfn/sim-logs-cfn-resource-factory.d.ts +4 -0
- package/dist/service/logs/cfn/sim-logs-cfn-resource-factory.js +9 -4
- package/dist/service/logs/sim-logs-commands.d.ts +3 -0
- package/dist/service/logs/sim-logs-commands.js +4 -0
- package/dist/service/logs/sim-logs.js +6 -1
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-creator.d.ts +2 -2
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-creator.js +4 -3
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-generated-name.d.ts +12 -0
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-generated-name.js +22 -0
- package/dist/service/s3/command/authorize/sim-s3-bucket-resource-policies.d.ts +1 -1
- package/dist/service/scheduler/command/authorize/sim-scheduler-authorizer.d.ts +10 -1
- package/dist/service/scheduler/command/authorize/sim-scheduler-authorizer.js +19 -1
- package/dist/service/scheduler/command/schedule/sim-scheduler-create-schedule.js +1 -0
- package/dist/service/scheduler/command/schedule/sim-scheduler-schedule-access.d.ts +8 -0
- package/dist/service/scheduler/command/schedule/sim-scheduler-schedule-access.js +9 -0
- package/dist/service/scheduler/command/schedule/sim-scheduler-update-schedule.js +1 -0
- package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-generated-name.d.ts +15 -0
- package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-generated-name.js +22 -0
- package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-secret-properties.d.ts +4 -10
- package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-secret-properties.js +13 -31
- package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-secret-value.d.ts +17 -0
- package/dist/service/secretsmanager/cfn/secret/sim-cfn-secrets-manager-secret-value.js +30 -0
- package/dist/service/secretsmanager/secret/sim-secrets-manager-secret-name.d.ts +6 -0
- package/dist/service/secretsmanager/secret/sim-secrets-manager-secret-name.js +8 -3
- package/dist/service/sns/command/authorize/sim-sns-topic-resource-policies.d.ts +1 -1
- package/dist/service/sqs/command/authorize/sim-sqs-queue-resource-policies.d.ts +1 -1
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-generated-parameter-name.d.ts +16 -0
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-generated-parameter-name.js +23 -0
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.d.ts +2 -4
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.js +5 -5
- package/dist/service/ssm/parameter/sim-ssm-kms-crypto.d.ts +6 -4
- package/dist/service/ssm/parameter/sim-ssm-kms-crypto.js +4 -4
- package/dist/service/ssm/parameter/sim-ssm-parameter-arn.d.ts +17 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-arn.js +20 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-kms.d.ts +15 -9
- package/dist/service/ssm/parameter/sim-ssm-parameter-kms.js +20 -10
- package/dist/service/ssm/parameter/sim-ssm-parameter-name.js +3 -12
- package/dist/service/stepfunctions/command/authorize/sim-step-functions-authorizer.d.ts +41 -0
- package/dist/service/stepfunctions/command/authorize/sim-step-functions-authorizer.js +64 -0
- package/dist/service/stepfunctions/command/machine/sim-state-machine-create.d.ts +5 -2
- package/dist/service/stepfunctions/command/machine/sim-state-machine-create.js +6 -2
- package/dist/service/stepfunctions/command/machine/sim-state-machine-delete.d.ts +26 -0
- package/dist/service/stepfunctions/command/machine/sim-state-machine-delete.js +29 -0
- package/dist/service/stepfunctions/command/machine/sim-state-machine-lookup.d.ts +7 -0
- package/dist/service/stepfunctions/command/machine/sim-state-machine-lookup.js +12 -3
- package/dist/service/stepfunctions/command/machine/sim-state-machine-update.d.ts +19 -0
- package/dist/service/stepfunctions/command/machine/{sim-state-machine-writes.js → sim-state-machine-update.js} +3 -14
- package/dist/service/stepfunctions/sim-step-functions.d.ts +8 -2
- package/dist/service/stepfunctions/sim-step-functions.js +26 -9
- package/dist/service/sts/auth-z/assume-role-auth-z-coordinator.d.ts +9 -2
- package/dist/service/sts/auth-z/assume-role-auth-z-coordinator.js +2 -2
- package/dist/service/sts/auth-z/assume-role-source-account-auth-z.d.ts +10 -4
- package/dist/service/sts/auth-z/assume-role-source-account-auth-z.js +8 -7
- package/dist/service/sts/auth-z/assume-role-target-auth-z.d.ts +2 -2
- package/dist/service/sts/auth-z/assume-role-trust-policy-authorizer.d.ts +6 -2
- package/dist/service/sts/auth-z/assume-role-trust-policy-authorizer.js +14 -11
- package/dist/service/sts/command/assume-role/assume-role.handler.d.ts +10 -1
- package/dist/service/sts/command/assume-role/assume-role.handler.js +6 -2
- package/dist/service/sts/command/get-caller-identity/get-caller-identity.handler.d.ts +10 -1
- package/dist/service/sts/command/get-caller-identity/get-caller-identity.handler.js +5 -1
- package/dist/service/sts/service-role/sim-service-role.js +5 -1
- package/dist/service/sts/sim-sts.d.ts +18 -1
- package/dist/service/sts/sim-sts.js +8 -0
- package/dist/util/memo/bounded-memo.d.ts +36 -0
- package/dist/util/memo/bounded-memo.js +58 -0
- package/docs/README.md +54 -0
- package/docs/ai-skill/README.md +69 -0
- package/docs/cli/README.md +284 -0
- package/docs/factories/README.md +140 -0
- package/docs/lint/README.md +176 -0
- package/docs/non-aws-dependencies/README.md +261 -0
- package/docs/sdk/README.md +274 -0
- package/docs/serve/README.md +1126 -0
- package/docs/services/acm/README.md +823 -0
- package/docs/services/apigateway/README.md +1919 -0
- package/docs/services/apigatewayv2/README.md +2678 -0
- package/docs/services/athena/README.md +1044 -0
- package/docs/services/bedrock/README.md +350 -0
- package/docs/services/cloudformation/README.md +3625 -0
- package/docs/services/cloudfront/README.md +3098 -0
- package/docs/services/cloudwatch/README.md +422 -0
- package/docs/services/cognito/README.md +4924 -0
- package/docs/services/dynamodb/README.md +3785 -0
- package/docs/services/ecr/README.md +302 -0
- package/docs/services/ecs/README.md +2021 -0
- package/docs/services/elbv2/README.md +1901 -0
- package/docs/services/eventbridge/README.md +1118 -0
- package/docs/services/firehose/README.md +811 -0
- package/docs/services/glue/README.md +507 -0
- package/docs/services/iam/README.md +1578 -0
- package/docs/services/kinesis/README.md +455 -0
- package/docs/services/kms/README.md +664 -0
- package/docs/services/lambda/README.md +3719 -0
- package/docs/services/logs/README.md +882 -0
- package/docs/services/organizations/README.md +574 -0
- package/docs/services/personalize/README.md +835 -0
- package/docs/services/rekognition/README.md +1070 -0
- package/docs/services/route53/README.md +1783 -0
- package/docs/services/s3/README.md +3029 -0
- package/docs/services/scheduler/README.md +814 -0
- package/docs/services/secretsmanager/README.md +670 -0
- package/docs/services/ses/README.md +1013 -0
- package/docs/services/sns/README.md +1904 -0
- package/docs/services/sqs/README.md +1185 -0
- package/docs/services/ssm/README.md +1096 -0
- package/docs/services/stepfunctions/README.md +1341 -0
- package/docs/services/sts/README.md +245 -0
- package/docs/services/wafv2/README.md +1380 -0
- package/docs/terraform/README.md +248 -0
- package/docs/time/README.md +284 -0
- package/llms.txt +59 -0
- package/package.json +7 -4
- package/dist/service/stepfunctions/command/machine/sim-state-machine-writes.d.ts +0 -25
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Non-AWS dependencies
|
|
2
|
+
|
|
3
|
+
Most applications talk to something other than AWS, such as a Redis or a Postgres. This page covers
|
|
4
|
+
what happens to those when the application runs under Yulin.
|
|
5
|
+
|
|
6
|
+
## Two kinds of dependency
|
|
7
|
+
|
|
8
|
+
A simulated Lambda function and a simulated ECS container both run your own code in the same Node.js
|
|
9
|
+
process as the test. Everything that code talks to falls into one of two categories.
|
|
10
|
+
|
|
11
|
+
Simulated AWS services are handled by Yulin. A DynamoDB call reaches an in-memory table and an S3
|
|
12
|
+
call reaches an in-memory bucket, with no network involved. [AWS SDK interception](https://yulinsim.dev/sdk/)
|
|
13
|
+
is how an ordinary SDK client in the code under test gets there.
|
|
14
|
+
|
|
15
|
+
Everything else is yours to provide, and connects the way it normally would. Yulin leaves it alone
|
|
16
|
+
entirely, with no simulation and no interception. Code that opens a Redis connection opens a real
|
|
17
|
+
one, to whatever address it was given.
|
|
18
|
+
|
|
19
|
+
## Pointing the code at your own dependency
|
|
20
|
+
|
|
21
|
+
A deployed Lambda function or ECS container reads its connection details from environment variables.
|
|
22
|
+
The simulated ones do the same. A function's `Environment.Variables` and a container definition's
|
|
23
|
+
`environment` are visible through `process.env` while the code runs, so pointing the application
|
|
24
|
+
somewhere else means setting the value it already reads. No Yulin feature is involved, and the code
|
|
25
|
+
under test stays as it is.
|
|
26
|
+
|
|
27
|
+
```typescript non-aws-dependency-lambda
|
|
28
|
+
/**
|
|
29
|
+
* Pointing a simulated Lambda function at a dependency Yulin does not
|
|
30
|
+
* simulate, alongside one it does.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import { CreateFunctionCommand, InvokeCommand } from "@aws-sdk/client-lambda";
|
|
34
|
+
|
|
35
|
+
import { SimAws } from "@kensio/yulin";
|
|
36
|
+
import { makeLambdaZipFileInput } from "@kensio/yulin/lambda";
|
|
37
|
+
|
|
38
|
+
const simAws = new SimAws();
|
|
39
|
+
const lambda = simAws.lambda();
|
|
40
|
+
|
|
41
|
+
await lambda.createFunction(
|
|
42
|
+
new CreateFunctionCommand({
|
|
43
|
+
FunctionName: "rates",
|
|
44
|
+
Role: "arn:aws:iam::111111111111:role/RatesRole",
|
|
45
|
+
Environment: {
|
|
46
|
+
Variables: {
|
|
47
|
+
// Simulated by Yulin, reached with no network involved.
|
|
48
|
+
TABLE_NAME: "rates",
|
|
49
|
+
// Yours. A deployment points this at ElastiCache. A test points it
|
|
50
|
+
// at whatever it wants the code to talk to instead.
|
|
51
|
+
CACHE_URL: "redis://127.0.0.1:6379",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
Code: {
|
|
55
|
+
ZipFile: makeLambdaZipFileInput(() => ({
|
|
56
|
+
// Building a Redis client from the second value involves nothing of
|
|
57
|
+
// Yulin's. It is an ordinary environment variable read.
|
|
58
|
+
tableName: process.env["TABLE_NAME"],
|
|
59
|
+
cacheUrl: process.env["CACHE_URL"],
|
|
60
|
+
})),
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const output = await lambda.invoke(
|
|
66
|
+
new InvokeCommand({ FunctionName: "rates" }),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
if (output.Payload === undefined) throw new Error("No invoke Payload");
|
|
70
|
+
// {"tableName":"rates","cacheUrl":"redis://127.0.0.1:6379"}
|
|
71
|
+
console.log(Buffer.from(output.Payload).toString());
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
What that address points at is up to the test. A Redis running on localhost, one the test suite
|
|
75
|
+
starts in a container, or a stand-in the test defines itself all work, because the application is
|
|
76
|
+
doing what it always does with the value it is given.
|
|
77
|
+
|
|
78
|
+
## A container reading from both
|
|
79
|
+
|
|
80
|
+
The worked example below runs one simulated ECS container that writes to a simulated DynamoDB table
|
|
81
|
+
and reads from a cache of its own. The two categories sit next to each other in the same handler and
|
|
82
|
+
are configured the same way, through the container definition's `environment`.
|
|
83
|
+
|
|
84
|
+
The cache here is a stand-in defined by the example, and it works with no server running. A real
|
|
85
|
+
client built from `CACHE_URL` would go in the same place.
|
|
86
|
+
|
|
87
|
+
```typescript non-aws-dependency-ecs
|
|
88
|
+
/**
|
|
89
|
+
* A simulated ECS container writing to a simulated DynamoDB table and reading
|
|
90
|
+
* from a cache of its own.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
import {
|
|
94
|
+
CreateTableCommand,
|
|
95
|
+
DynamoDBClient,
|
|
96
|
+
GetItemCommand,
|
|
97
|
+
PutItemCommand,
|
|
98
|
+
} from "@aws-sdk/client-dynamodb";
|
|
99
|
+
import {
|
|
100
|
+
CreateClusterCommand,
|
|
101
|
+
RegisterTaskDefinitionCommand,
|
|
102
|
+
RunTaskCommand,
|
|
103
|
+
} from "@aws-sdk/client-ecs";
|
|
104
|
+
import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
|
|
105
|
+
|
|
106
|
+
import { SimSdk } from "@kensio/yulin/sdk";
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Where the worker reads exchange rates from.
|
|
110
|
+
*
|
|
111
|
+
* A deployment builds a Redis client from the URL. This example stands one in,
|
|
112
|
+
* so nothing has to be running for it to work.
|
|
113
|
+
*/
|
|
114
|
+
class RateCache {
|
|
115
|
+
constructor(private readonly url: string) {}
|
|
116
|
+
|
|
117
|
+
rate(currency: string): Promise<string> {
|
|
118
|
+
console.log(`reading ${currency} from ${this.url}`);
|
|
119
|
+
// reading GBP from redis://127.0.0.1:6379
|
|
120
|
+
return Promise.resolve("1.27");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
using simSdk = new SimSdk();
|
|
125
|
+
const { simAws } = simSdk;
|
|
126
|
+
const ecs = simAws.ecs();
|
|
127
|
+
|
|
128
|
+
simSdk.intercept(DynamoDBClient);
|
|
129
|
+
|
|
130
|
+
await simAws.dynamoDb().createTable(
|
|
131
|
+
new CreateTableCommand({
|
|
132
|
+
TableName: "rates",
|
|
133
|
+
KeySchema: [{ AttributeName: "currency", KeyType: "HASH" }],
|
|
134
|
+
AttributeDefinitions: [{ AttributeName: "currency", AttributeType: "S" }],
|
|
135
|
+
BillingMode: "PAY_PER_REQUEST",
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const taskRole = await simAws.iam().createRole(
|
|
140
|
+
new CreateRoleCommand({
|
|
141
|
+
RoleName: "RatesTaskRole",
|
|
142
|
+
AssumeRolePolicyDocument: JSON.stringify({
|
|
143
|
+
Version: "2012-10-17",
|
|
144
|
+
Statement: {
|
|
145
|
+
Effect: "Allow",
|
|
146
|
+
Principal: { Service: "ecs-tasks.amazonaws.com" },
|
|
147
|
+
Action: "sts:AssumeRole",
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
150
|
+
}),
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
await simAws.iam().putRolePolicy(
|
|
154
|
+
new PutRolePolicyCommand({
|
|
155
|
+
RoleName: "RatesTaskRole",
|
|
156
|
+
PolicyName: "WriteRates",
|
|
157
|
+
PolicyDocument: JSON.stringify({
|
|
158
|
+
Version: "2012-10-17",
|
|
159
|
+
Statement: {
|
|
160
|
+
Effect: "Allow",
|
|
161
|
+
Action: "dynamodb:PutItem",
|
|
162
|
+
Resource:
|
|
163
|
+
`arn:aws:dynamodb:${simAws.defaultRegionName}:` +
|
|
164
|
+
`${simAws.defaultAccountId}:table/rates`,
|
|
165
|
+
},
|
|
166
|
+
}),
|
|
167
|
+
}),
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
await ecs.createCluster(new CreateClusterCommand({}));
|
|
171
|
+
|
|
172
|
+
ecs.bindContainer({
|
|
173
|
+
family: "rates-worker",
|
|
174
|
+
containerName: "app",
|
|
175
|
+
run: async () => {
|
|
176
|
+
// Both reads happen inside the handler, so they see the container's own
|
|
177
|
+
// variables rather than the test process's.
|
|
178
|
+
const cache = new RateCache(process.env["CACHE_URL"] ?? "");
|
|
179
|
+
const rate = await cache.rate("GBP");
|
|
180
|
+
|
|
181
|
+
await new DynamoDBClient({}).send(
|
|
182
|
+
new PutItemCommand({
|
|
183
|
+
TableName: process.env["TABLE_NAME"],
|
|
184
|
+
Item: { currency: { S: "GBP" }, rate: { S: rate } },
|
|
185
|
+
}),
|
|
186
|
+
);
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
await ecs.registerTaskDefinition(
|
|
191
|
+
new RegisterTaskDefinitionCommand({
|
|
192
|
+
family: "rates-worker",
|
|
193
|
+
taskRoleArn: taskRole.Role.Arn,
|
|
194
|
+
containerDefinitions: [
|
|
195
|
+
{
|
|
196
|
+
name: "app",
|
|
197
|
+
image: "rates-worker:1",
|
|
198
|
+
environment: [
|
|
199
|
+
// Simulated by Yulin, reached with no network involved.
|
|
200
|
+
{ name: "TABLE_NAME", value: "rates" },
|
|
201
|
+
// Yours, connected to the way it normally would be.
|
|
202
|
+
{ name: "CACHE_URL", value: "redis://127.0.0.1:6379" },
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
}),
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
await ecs.runTask(new RunTaskCommand({ taskDefinition: "rates-worker" }));
|
|
210
|
+
await simAws.backgroundTasksComplete();
|
|
211
|
+
|
|
212
|
+
const stored = await simAws.dynamoDb().getItem(
|
|
213
|
+
new GetItemCommand({
|
|
214
|
+
TableName: "rates",
|
|
215
|
+
Key: { currency: { S: "GBP" } },
|
|
216
|
+
}),
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
console.log(stored.Item?.["rate"]?.S); // "1.27"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The DynamoDB write is authorized as the task role, in the same way it would be in a deployment. The
|
|
223
|
+
cache read passes through no authorization at all, because IAM has no part in it.
|
|
224
|
+
|
|
225
|
+
## Sidecar containers are not started
|
|
226
|
+
|
|
227
|
+
A task definition sometimes declares the dependency itself as a second container, such as a Redis
|
|
228
|
+
running next to the application in the same task. Yulin never looks inside a container image, and
|
|
229
|
+
the only thing it can run is JavaScript or TypeScript in its own process. An image holding a Redis
|
|
230
|
+
server is beyond it.
|
|
231
|
+
|
|
232
|
+
The container is stored and reported back as declared, and it is recorded as not simulated when the
|
|
233
|
+
task runs, with a reason saying so. An application expecting it has to be given something else to
|
|
234
|
+
talk to. Set the variable holding the address to something that answers, whether that is a Redis you
|
|
235
|
+
run yourself or a stand-in, in the same way as for any other dependency of your own.
|
|
236
|
+
|
|
237
|
+
## Reads happen inside the handler
|
|
238
|
+
|
|
239
|
+
Handler code gets the function's or the container's variables while it runs, and reads the host
|
|
240
|
+
process environment otherwise. A read at module scope, as in `const url = process.env.CACHE_URL` at
|
|
241
|
+
the top of a file, happens when the test imports that file rather than when the code runs. It sees
|
|
242
|
+
the host value.
|
|
243
|
+
|
|
244
|
+
That matters here because a connection is often built at module scope. Read inside the handler, or
|
|
245
|
+
build the client there, to get the configured value. Sim Lambda warns on the console when the
|
|
246
|
+
difference changes what the code sees, which is covered under
|
|
247
|
+
[environment variables](https://yulinsim.dev/services/lambda/#environment-variables) on the simulated Lambda
|
|
248
|
+
page. Zip code running in the vm runtime is unaffected, because it is imported during an invocation.
|
|
249
|
+
|
|
250
|
+
## Limitations
|
|
251
|
+
|
|
252
|
+
Current documented limitations:
|
|
253
|
+
|
|
254
|
+
- Everything outside the simulated AWS services is yours to run and to tear down. Yulin starts none
|
|
255
|
+
of it.
|
|
256
|
+
- A dependency declared as a sidecar container in an ECS task definition is not started, because
|
|
257
|
+
Yulin never runs a container image.
|
|
258
|
+
- A connection built at module scope reads the host environment rather than the function's or the
|
|
259
|
+
container's, since the value is read before anything runs.
|
|
260
|
+
- There is no interception point for a non-AWS dependency. The way to send the code somewhere else
|
|
261
|
+
is the environment variable it already reads, or an injection point in the code itself.
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Simulated AWS SDK
|
|
2
|
+
|
|
3
|
+
Yulin can intercept AWS SDK clients and route their Commands to simulated AWS services. The code
|
|
4
|
+
under test uses the AWS SDK as it would in production, and needs no knowledge of the simulator.
|
|
5
|
+
|
|
6
|
+
This is the recommended way to test implementation code that already uses the AWS SDK. Direct
|
|
7
|
+
interaction with `SimAws` remains useful for seeding and inspecting simulated state from within
|
|
8
|
+
tests.
|
|
9
|
+
|
|
10
|
+
## How it works
|
|
11
|
+
|
|
12
|
+
`SimSdk` replaces the `send` method of an intercepted SDK client. Each sent Command is routed by
|
|
13
|
+
name to the matching operation of a simulated AWS service, and the result comes back to the caller
|
|
14
|
+
as a normal SDK response. Every Command is served in process.
|
|
15
|
+
|
|
16
|
+
Every `SimSdk` owns a simulated AWS environment. You can let it create its own, or give it an
|
|
17
|
+
existing one to share:
|
|
18
|
+
|
|
19
|
+
- `new SimSdk()` creates an isolated `SimAws` internally, available as `simSdk.simAws`.
|
|
20
|
+
- `new SimSdk({ simAws })` wraps a `SimAws` you already have.
|
|
21
|
+
|
|
22
|
+
## Basic usage
|
|
23
|
+
|
|
24
|
+
Intercept an SDK client class, then use the SDK as normal:
|
|
25
|
+
|
|
26
|
+
```typescript sim-sdk-intercept-s3
|
|
27
|
+
/**
|
|
28
|
+
* Intercepting the S3 SDK client with simulated AWS behind it.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import {
|
|
32
|
+
CreateBucketCommand,
|
|
33
|
+
GetObjectCommand,
|
|
34
|
+
PutObjectCommand,
|
|
35
|
+
S3Client,
|
|
36
|
+
} from "@aws-sdk/client-s3";
|
|
37
|
+
import { SimSdk } from "@kensio/yulin/sdk";
|
|
38
|
+
|
|
39
|
+
const simSdk = new SimSdk();
|
|
40
|
+
simSdk.intercept(S3Client); // Intercepts every instance of the class.
|
|
41
|
+
|
|
42
|
+
// From here on, this is ordinary AWS SDK code.
|
|
43
|
+
const s3Client = new S3Client({ region: "eu-west-2" });
|
|
44
|
+
await s3Client.send(new CreateBucketCommand({ Bucket: "foo-bucket" }));
|
|
45
|
+
await s3Client.send(
|
|
46
|
+
new PutObjectCommand({
|
|
47
|
+
Bucket: "foo-bucket",
|
|
48
|
+
Key: "hello.txt",
|
|
49
|
+
Body: "Hello, world!",
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const output = await s3Client.send(
|
|
54
|
+
new GetObjectCommand({ Bucket: "foo-bucket", Key: "hello.txt" }),
|
|
55
|
+
);
|
|
56
|
+
console.log(await output.Body?.transformToString()); // "Hello, world!"
|
|
57
|
+
|
|
58
|
+
simSdk.restoreAll();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
You can intercept a client class or a client instance:
|
|
62
|
+
|
|
63
|
+
- **A class** (`simSdk.intercept(S3Client)`) intercepts every instance of it, including instances
|
|
64
|
+
the code under test constructs later. This is the most common choice.
|
|
65
|
+
- **An instance** (`simSdk.intercept(s3Client)`) intercepts only that instance. Use it when one
|
|
66
|
+
client should hit the simulator and the others are handled some other way.
|
|
67
|
+
|
|
68
|
+
A client can only have one interception at a time. Intercepting an already-intercepted client
|
|
69
|
+
throws a diagnostic error, and the existing interception stays in place.
|
|
70
|
+
|
|
71
|
+
## Account and Region scope
|
|
72
|
+
|
|
73
|
+
Each sent Command resolves its own simulated Account and Region scope:
|
|
74
|
+
|
|
75
|
+
1. The **Region** comes from the sending client's own configuration, such as
|
|
76
|
+
`new S3Client({ region: "eu-west-2" })`, falling back to the simulation default.
|
|
77
|
+
2. The **Account** comes from the ambient `simAws.runAs(...)` caller when one is set, falling back
|
|
78
|
+
to the simulation default Account.
|
|
79
|
+
|
|
80
|
+
The resolved caller reaches the simulated service, and simulated [IAM](https://yulinsim.dev/services/iam/)
|
|
81
|
+
authorization applies to it exactly as it does for direct sim service use. A caller without
|
|
82
|
+
permission for a Command is denied, as on real AWS. Where no caller can be identified, Commands run
|
|
83
|
+
as the simulation's `defaultCaller`, and as the default Account root where the simulation was given
|
|
84
|
+
none. See
|
|
85
|
+
[Name the caller a simulation uses by default](https://yulinsim.dev/services/iam/#name-the-caller-a-simulation-uses-by-default).
|
|
86
|
+
|
|
87
|
+
`runAs` runs a function with an ambient simulated caller, such as an IAM Role. Commands sent during
|
|
88
|
+
the run are attributed to that caller, with no changes to the client or the code under test. A
|
|
89
|
+
direct sim service call inside the run is attributed to it too, covered in
|
|
90
|
+
[Run a block of calls as one caller](https://yulinsim.dev/services/iam/#run-a-block-of-calls-as-one-caller):
|
|
91
|
+
|
|
92
|
+
```typescript sim-sdk-run-as
|
|
93
|
+
/**
|
|
94
|
+
* Attributing intercepted SDK Commands to a caller with runAs.
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
|
|
98
|
+
import {
|
|
99
|
+
CreateBucketCommand,
|
|
100
|
+
ListBucketsCommand,
|
|
101
|
+
S3Client,
|
|
102
|
+
} from "@aws-sdk/client-s3";
|
|
103
|
+
import { SimAws } from "@kensio/yulin";
|
|
104
|
+
import { SimSdk } from "@kensio/yulin/sdk";
|
|
105
|
+
|
|
106
|
+
const simAws = new SimAws();
|
|
107
|
+
const simSdk = new SimSdk({ simAws });
|
|
108
|
+
|
|
109
|
+
// Seed a Bucket, and a Role allowed to list Buckets, in a simulated Account.
|
|
110
|
+
const account = simAws.account("222222222222");
|
|
111
|
+
await account
|
|
112
|
+
.s3()
|
|
113
|
+
.createBucket(new CreateBucketCommand({ Bucket: "team-bucket" }));
|
|
114
|
+
await account.iam().createRole(
|
|
115
|
+
new CreateRoleCommand({
|
|
116
|
+
RoleName: "TeamRole",
|
|
117
|
+
AssumeRolePolicyDocument: JSON.stringify({
|
|
118
|
+
Version: "2012-10-17",
|
|
119
|
+
Statement: {
|
|
120
|
+
Effect: "Allow",
|
|
121
|
+
Principal: { AWS: "arn:aws:iam::222222222222:root" },
|
|
122
|
+
Action: "sts:AssumeRole",
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
}),
|
|
126
|
+
);
|
|
127
|
+
await account.iam().putRolePolicy(
|
|
128
|
+
new PutRolePolicyCommand({
|
|
129
|
+
RoleName: "TeamRole",
|
|
130
|
+
PolicyName: "list-buckets",
|
|
131
|
+
PolicyDocument: JSON.stringify({
|
|
132
|
+
Version: "2012-10-17",
|
|
133
|
+
Statement: {
|
|
134
|
+
Effect: "Allow",
|
|
135
|
+
Action: "s3:ListAllMyBuckets",
|
|
136
|
+
Resource: "*",
|
|
137
|
+
},
|
|
138
|
+
}),
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const s3Client = new S3Client({ region: "us-east-1" });
|
|
143
|
+
simSdk.intercept(s3Client);
|
|
144
|
+
|
|
145
|
+
await simAws.runAs(
|
|
146
|
+
{ kind: "arn", arn: "arn:aws:iam::222222222222:role/TeamRole" },
|
|
147
|
+
async () => {
|
|
148
|
+
// Sent as the TeamRole caller: resolved in Account 222222222222 and
|
|
149
|
+
// authorized against the Role's simulated IAM permissions.
|
|
150
|
+
const output = await s3Client.send(new ListBucketsCommand({}));
|
|
151
|
+
console.log(output.Buckets); // [{ Name: "team-bucket" }]
|
|
152
|
+
},
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
simSdk.restoreAll();
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The ambient caller belongs to its own `SimAws` instance. Separate simulations in the same process
|
|
159
|
+
each keep their own.
|
|
160
|
+
|
|
161
|
+
## Restoring interception
|
|
162
|
+
|
|
163
|
+
Restoring puts back the client's real SDK `send`:
|
|
164
|
+
|
|
165
|
+
- `interception.restore()` restores one interception. `simSdk.intercept(...)` returns the handle.
|
|
166
|
+
- `simSdk.restoreAll()` restores everything intercepted through that `SimSdk`.
|
|
167
|
+
- `SimSdk` and interception handles are disposable. `using simSdk = new SimSdk();` restores
|
|
168
|
+
automatically at the end of the scope.
|
|
169
|
+
|
|
170
|
+
## Choosing Commands to intercept
|
|
171
|
+
|
|
172
|
+
By default every Command sent through an intercepted client is routed to the simulator. To
|
|
173
|
+
intercept only specific Commands, pass an allow list of Command classes or names:
|
|
174
|
+
`simSdk.intercept(s3Client, { commands: [GetObjectCommand] })`. Commands outside the allow list
|
|
175
|
+
throw a diagnostic error.
|
|
176
|
+
|
|
177
|
+
## The DynamoDB document client
|
|
178
|
+
|
|
179
|
+
`@aws-sdk/lib-dynamodb` takes plain JavaScript values. Application code writes
|
|
180
|
+
`{ id: "a", count: 1 }` where the base client wants `{ id: { S: "a" }, count: { N: "1" } }`.
|
|
181
|
+
Intercept the document client and its Commands reach simulated DynamoDB with the values already
|
|
182
|
+
converted. Code written against the document client runs against the simulator unchanged.
|
|
183
|
+
|
|
184
|
+
```typescript sim-sdk-document-client
|
|
185
|
+
/**
|
|
186
|
+
* An intercepted DynamoDB document client, writing plain JavaScript values.
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
import { CreateTableCommand, DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
190
|
+
import {
|
|
191
|
+
DynamoDBDocumentClient,
|
|
192
|
+
GetCommand,
|
|
193
|
+
PutCommand,
|
|
194
|
+
} from "@aws-sdk/lib-dynamodb";
|
|
195
|
+
|
|
196
|
+
import { SimSdk } from "@kensio/yulin/sdk";
|
|
197
|
+
|
|
198
|
+
using simSdk = new SimSdk();
|
|
199
|
+
|
|
200
|
+
const documents = DynamoDBDocumentClient.from(
|
|
201
|
+
new DynamoDBClient({ region: "eu-west-2" }),
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
// The document client is what gets intercepted, not the client it was built
|
|
205
|
+
// from.
|
|
206
|
+
simSdk.intercept(documents);
|
|
207
|
+
|
|
208
|
+
// A document client forwards a Command it has no document form of, so the
|
|
209
|
+
// table is created through the same client.
|
|
210
|
+
await documents.send(
|
|
211
|
+
new CreateTableCommand({
|
|
212
|
+
TableName: "OrdersTable",
|
|
213
|
+
KeySchema: [{ AttributeName: "orderId", KeyType: "HASH" }],
|
|
214
|
+
AttributeDefinitions: [{ AttributeName: "orderId", AttributeType: "S" }],
|
|
215
|
+
BillingMode: "PAY_PER_REQUEST",
|
|
216
|
+
}),
|
|
217
|
+
);
|
|
218
|
+
await simSdk.simAws.backgroundTasksComplete();
|
|
219
|
+
|
|
220
|
+
await documents.send(
|
|
221
|
+
new PutCommand({
|
|
222
|
+
TableName: "OrdersTable",
|
|
223
|
+
Item: { orderId: "order-1", total: 42, paid: true },
|
|
224
|
+
}),
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
const read = await documents.send(
|
|
228
|
+
new GetCommand({ TableName: "OrdersTable", Key: { orderId: "order-1" } }),
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
console.log(read.Item?.["total"]); // 42
|
|
232
|
+
console.log(read.Item?.["paid"]); // true
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`DynamoDBDocumentClient.from(client)` builds a separate object of its own class. Intercepting the
|
|
236
|
+
base client therefore leaves Commands sent through the document client alone. Intercept the
|
|
237
|
+
document client. Both can be intercepted at once, and they reach
|
|
238
|
+
the same simulated tables, since the document client shares the base client's config and so
|
|
239
|
+
resolves the same Account and Region.
|
|
240
|
+
|
|
241
|
+
The real document client converts values in middleware, which runs inside the `send` that
|
|
242
|
+
interception replaces. So the conversion happens at the interception boundary instead, using the
|
|
243
|
+
option defaults `lib-dynamodb` sets (not the `util-dynamodb` ones). Which native types map to which
|
|
244
|
+
descriptors is in [the sim DynamoDB docs](https://yulinsim.dev/services/dynamodb/#the-document-client).
|
|
245
|
+
|
|
246
|
+
## Supported services and Commands
|
|
247
|
+
|
|
248
|
+
These simulated services support SDK interception: ACM, API Gateway v2, CloudFormation, CloudFront,
|
|
249
|
+
CloudWatch, CloudWatch Logs, Cognito, DynamoDB, DynamoDB Streams, ECS, Elastic Load Balancing v2,
|
|
250
|
+
EventBridge, EventBridge Scheduler, IAM, KMS, Lambda, Rekognition, Route53, S3, Secrets Manager,
|
|
251
|
+
SES, SNS, SQS, SSM, STS and WAFv2. Each service's own docs list the Commands it
|
|
252
|
+
simulates.
|
|
253
|
+
|
|
254
|
+
A gap in that coverage is refused on send, with a different error for each kind:
|
|
255
|
+
|
|
256
|
+
- A Command the simulated service doesn't support throws `SimSdkUnsupportedCommandError`, naming the
|
|
257
|
+
Command and listing the Commands that service does support.
|
|
258
|
+
- A client for an AWS service Yulin doesn't simulate at all throws `SimSdkUnknownServiceError`,
|
|
259
|
+
naming the service. There is no Command list to report, since no simulated service was resolved.
|
|
260
|
+
|
|
261
|
+
## Limitations
|
|
262
|
+
|
|
263
|
+
- Only `client.send(command)` is intercepted. SDK utilities that bypass `send`, such as
|
|
264
|
+
`getSignedUrl`, run against real AWS. Paginators and waiters go through `send`, so they work. Presigning works without interception. Point the client at the simulated endpoint, as
|
|
265
|
+
[the sim S3 presigned URL docs](https://yulinsim.dev/services/s3/#presigned-urls) show.
|
|
266
|
+
- Simulated errors carry SDK-shaped `name` and `$metadata`, but are not instances of the real SDK
|
|
267
|
+
exception classes. Match an error by its `error.name`. An `instanceof` check against the SDK class
|
|
268
|
+
fails.
|
|
269
|
+
- The callback form of `send(command, callback)` is not supported. Use the promise form.
|
|
270
|
+
- The translate config a document client is built with,
|
|
271
|
+
`DynamoDBDocumentClient.from(client, { marshallOptions, unmarshallOptions })`, is ignored. The
|
|
272
|
+
conversion always uses the defaults. `removeUndefinedValues: true` in particular has no effect
|
|
273
|
+
here, and an `undefined` attribute is refused where AWS would have dropped it. The refusal names
|
|
274
|
+
the attribute and says so.
|