@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,284 @@
|
|
|
1
|
+
# AWS CLI
|
|
2
|
+
|
|
3
|
+
The real `aws` CLI reaches a served simulated environment over a local endpoint URL, and twenty of
|
|
4
|
+
Yulin's twenty-five SDK-facing services answer it.
|
|
5
|
+
|
|
6
|
+
[Serving on localhost](https://yulinsim.dev/serve/) is the reference for what each service serves. This page
|
|
7
|
+
covers the way in from a shell.
|
|
8
|
+
|
|
9
|
+
## An endpoint and a key to sign with
|
|
10
|
+
|
|
11
|
+
Serving binds a simulated environment to a port. A served request runs as whoever signed it, and the
|
|
12
|
+
access key to sign the first one comes from simulated IAM in the process that built the environment:
|
|
13
|
+
|
|
14
|
+
```typescript sim-cli-endpoint
|
|
15
|
+
/**
|
|
16
|
+
* Serving a simulated environment for the aws CLI to reach.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
CreateAccessKeyCommand,
|
|
21
|
+
CreateUserCommand,
|
|
22
|
+
PutUserPolicyCommand,
|
|
23
|
+
} from "@aws-sdk/client-iam";
|
|
24
|
+
import { SimAws } from "@kensio/yulin";
|
|
25
|
+
import { serveSimAws } from "@kensio/yulin/serve";
|
|
26
|
+
|
|
27
|
+
const simAws = new SimAws();
|
|
28
|
+
const simIam = simAws.iam();
|
|
29
|
+
|
|
30
|
+
await simIam.createUser(new CreateUserCommand({ UserName: "Operator" }));
|
|
31
|
+
await simIam.putUserPolicy(
|
|
32
|
+
new PutUserPolicyCommand({
|
|
33
|
+
UserName: "Operator",
|
|
34
|
+
PolicyName: "Everything",
|
|
35
|
+
PolicyDocument: JSON.stringify({
|
|
36
|
+
Version: "2012-10-17",
|
|
37
|
+
Statement: { Effect: "Allow", Action: "*", Resource: "*" },
|
|
38
|
+
}),
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
const created = await simIam.createAccessKey(
|
|
42
|
+
new CreateAccessKeyCommand({ UserName: "Operator" }),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const srv = await serveSimAws({ simAws, port: 8787 });
|
|
46
|
+
|
|
47
|
+
// Paste these into the shell the CLI runs in.
|
|
48
|
+
console.log(`export AWS_ENDPOINT_URL=http://localhost:${srv.port}`);
|
|
49
|
+
console.log(`export AWS_ACCESS_KEY_ID=${created.AccessKey.AccessKeyId}`);
|
|
50
|
+
console.log(
|
|
51
|
+
`export AWS_SECRET_ACCESS_KEY=${created.AccessKey.SecretAccessKey}`,
|
|
52
|
+
);
|
|
53
|
+
console.log(`export AWS_DEFAULT_REGION=${simAws.defaultRegionName}`);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Pin the port when the URL has to stay the same between runs. Without one the server takes whatever
|
|
57
|
+
is free.
|
|
58
|
+
|
|
59
|
+
## Configuring the CLI
|
|
60
|
+
|
|
61
|
+
Four environment variables are the whole configuration:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
export AWS_ENDPOINT_URL=http://localhost:8787
|
|
65
|
+
export AWS_ACCESS_KEY_ID=AKIAVEXOWARWMKBOA0MP
|
|
66
|
+
export AWS_SECRET_ACCESS_KEY=RzIvKRp1sd5yXfEifA1twsUTd4GlHL5JpzvECpox
|
|
67
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`sts get-caller-identity` is the call to check the wiring with. It reports the principal behind the
|
|
71
|
+
key that signed the request:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
aws sts get-caller-identity
|
|
75
|
+
{
|
|
76
|
+
"UserId": "AIDARNFLISEC7SCUNSDY",
|
|
77
|
+
"Account": "888888888888",
|
|
78
|
+
"Arn": "arn:aws:iam::888888888888:user/Operator"
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The credentials have to come from simulated IAM. Any other key is refused with `403 Forbidden`, and
|
|
83
|
+
an unsigned request reaches nothing.
|
|
84
|
+
|
|
85
|
+
A Region is required, as it is against real AWS. Changing it moves the CLI between simulated
|
|
86
|
+
Regions, and a Queue created under `eu-west-2` is invisible to `AWS_DEFAULT_REGION=us-east-1`.
|
|
87
|
+
|
|
88
|
+
### A named profile instead
|
|
89
|
+
|
|
90
|
+
A profile in the CLI's own config file carries the same four values. The simulation then stays out
|
|
91
|
+
of the ambient environment:
|
|
92
|
+
|
|
93
|
+
```ini
|
|
94
|
+
[profile sim]
|
|
95
|
+
region = us-east-1
|
|
96
|
+
endpoint_url = http://localhost:8787
|
|
97
|
+
aws_access_key_id = AKIAVEXOWARWMKBOA0MP
|
|
98
|
+
aws_secret_access_key = RzIvKRp1sd5yXfEifA1twsUTd4GlHL5JpzvECpox
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`aws --profile sim sts get-caller-identity` then reaches the simulation while a bare `aws` still
|
|
102
|
+
goes to real AWS. The profile has to carry credentials of its own. Once `--profile` is given the CLI
|
|
103
|
+
stops reading `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` from the environment.
|
|
104
|
+
|
|
105
|
+
`role_arn` and `source_profile` work too. The CLI assumes the simulated Role for itself and signs
|
|
106
|
+
with the session it gets back:
|
|
107
|
+
|
|
108
|
+
```ini
|
|
109
|
+
[profile reader]
|
|
110
|
+
region = us-east-1
|
|
111
|
+
endpoint_url = http://localhost:8787
|
|
112
|
+
role_arn = arn:aws:iam::888888888888:role/Reader
|
|
113
|
+
source_profile = sim
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Building the rest of the identities from the shell
|
|
117
|
+
|
|
118
|
+
Only the first key has to come from the process that built the simulation. `aws iam` builds
|
|
119
|
+
everything after it:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
aws iam create-user --user-name shopper
|
|
123
|
+
aws iam put-user-policy --user-name shopper --policy-name read-buckets \
|
|
124
|
+
--policy-document '{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"s3:ListAllMyBuckets","Resource":"*"}}'
|
|
125
|
+
aws iam create-access-key --user-name shopper
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`create-access-key` answers with the secret once. Signing with the new key reports the new User, and
|
|
129
|
+
simulated IAM authorizes every request against the policy it was given:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
aws s3api create-bucket --bucket nope
|
|
133
|
+
|
|
134
|
+
aws: [ERROR]: An error occurred (AccessDenied) when calling the CreateBucket operation: User:
|
|
135
|
+
arn:aws:iam::888888888888:user/shopper is not authorized to perform: s3:CreateBucket on resource:
|
|
136
|
+
arn:aws:s3:::nope
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`aws sts assume-role` answers with temporary credentials. Export the three values it returns and the
|
|
140
|
+
rest of the session runs as the Role:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
aws sts assume-role --role-arn arn:aws:iam::888888888888:role/Reader --role-session-name probe
|
|
144
|
+
export AWS_ACCESS_KEY_ID=ASIAKBEUIHDMON9VBZXF
|
|
145
|
+
export AWS_SECRET_ACCESS_KEY=jm2N56vfVtLgJEo11OtbIXbgnJBgxpUMrszPrQdl
|
|
146
|
+
export AWS_SESSION_TOKEN=11568oBDksY9czECUMiAWk9tzmvG7zlQNjtLI1WmhZFS...
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The expiry is stamped from the simulation's own clock, and
|
|
150
|
+
[advancing it](https://yulinsim.dev/time/) past the expiry stops the session authenticating.
|
|
151
|
+
|
|
152
|
+
## What answers
|
|
153
|
+
|
|
154
|
+
Twenty simulated services answer the endpoint. S3, STS, IAM, ELBv2, SNS, CloudFormation and Lambda,
|
|
155
|
+
along with the AWS JSON protocol services: DynamoDB, DynamoDB Streams, SQS, Cognito Identity
|
|
156
|
+
Provider, EventBridge, ECS, SSM, ACM, CloudWatch, CloudWatch Logs, KMS, Secrets Manager and
|
|
157
|
+
Rekognition.
|
|
158
|
+
|
|
159
|
+
A quick tour of the ones a shell reaches for most:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
aws s3 cp ./index.html s3://widgets/index.html
|
|
163
|
+
aws s3 sync ./site s3://widgets/site/
|
|
164
|
+
aws dynamodb put-item --table-name widgets --item '{"id":{"S":"w1"}}'
|
|
165
|
+
aws sqs create-queue --queue-name orders
|
|
166
|
+
aws ssm get-parameter --name /shop/url --query 'Parameter.Value' --output text
|
|
167
|
+
aws secretsmanager get-secret-value --secret-id shop/db --query SecretString --output text
|
|
168
|
+
aws logs describe-log-groups --query 'logGroups[].logGroupName' --output text
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`--query`, `--output text` and the rest of the CLI's own machinery work throughout, because they run
|
|
172
|
+
client-side over an ordinary AWS response.
|
|
173
|
+
|
|
174
|
+
[The serve docs](https://yulinsim.dev/serve/#which-services-answer) list the operations each service
|
|
175
|
+
implements. Anything outside those lists is refused as `NotImplemented`.
|
|
176
|
+
|
|
177
|
+
## CLI traps
|
|
178
|
+
|
|
179
|
+
Each of these is CLI behaviour, and each catches people out against real AWS too. They are collected
|
|
180
|
+
here because a simulated endpoint is often where someone meets them first.
|
|
181
|
+
|
|
182
|
+
### `--payload` needs `--cli-binary-format`
|
|
183
|
+
|
|
184
|
+
CLI v2 reads `--payload` as base64 by default:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
aws lambda invoke --function-name orders --payload '{"id":1}' out.json
|
|
188
|
+
|
|
189
|
+
aws: [ERROR]: Invalid base64: "{"id":1}"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Pass `--cli-binary-format raw-in-base64-out` and the same call runs the function:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
aws lambda invoke --function-name orders --payload '{"id":1}' \
|
|
196
|
+
--cli-binary-format raw-in-base64-out out.json
|
|
197
|
+
cat out.json
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`--invocation-type Event` answers `202` and runs the handler on the background scheduler. A script
|
|
201
|
+
reading what the function did waits on `simAws.backgroundTasksComplete()` first.
|
|
202
|
+
|
|
203
|
+
### S3 addressing style
|
|
204
|
+
|
|
205
|
+
The CLI needs nothing here. Its default `auto` style sends path-style requests to a custom endpoint,
|
|
206
|
+
which is what this endpoint routes. An SDK client is the one that needs `forcePathStyle: true`.
|
|
207
|
+
|
|
208
|
+
Forcing `addressing_style = virtual` in the config file breaks it. The Bucket moves into a hostname
|
|
209
|
+
the endpoint has no route for, and `list-objects-v2` comes back empty while `head-object` comes back
|
|
210
|
+
`404`.
|
|
211
|
+
|
|
212
|
+
### `aws cloudformation deploy` uses change sets
|
|
213
|
+
|
|
214
|
+
`deploy` is a CLI-side wrapper over `CreateChangeSet`, and simulated CloudFormation implements four
|
|
215
|
+
operations that do not include it:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
aws cloudformation deploy --stack-name site --template-file template.json
|
|
219
|
+
|
|
220
|
+
aws: [ERROR]: An error occurred (NotImplemented) when calling the CreateChangeSet operation:
|
|
221
|
+
Simulated CloudFormation does not serve CreateChangeSet
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
`create-stack` and `describe-stacks` do work. A deployment starts in the background and
|
|
225
|
+
`create-stack` is answered before the Resources exist, as real CloudFormation answers it.
|
|
226
|
+
|
|
227
|
+
### Presigning needs the S3 service hostname
|
|
228
|
+
|
|
229
|
+
`aws s3 presign` signs whatever endpoint the CLI is configured with, and a URL built over the
|
|
230
|
+
general endpoint has no Bucket in it for the endpoint to route on. Point the one command at
|
|
231
|
+
simulated S3's own hostname on the served port:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
aws --endpoint-url http://s3.us-east-1.sim-aws.localhost:8787 s3 presign s3://widgets/one.txt
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The URL that comes back is fetchable by anything, including `curl` and a browser. The same hostname
|
|
238
|
+
serves [presigned URLs built by the SDK](https://yulinsim.dev/services/s3/#presigned-urls).
|
|
239
|
+
|
|
240
|
+
### A bad key looks like an XML parse failure
|
|
241
|
+
|
|
242
|
+
STS, IAM and ELBv2 speak the AWS Query protocol and expect an XML body. The endpoint answers a
|
|
243
|
+
rejected signature as JSON. The CLI reports the body it could not parse:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
aws sts get-caller-identity
|
|
247
|
+
|
|
248
|
+
aws: [ERROR]: Unable to parse response (not well-formed (invalid token): line 1, column 0), invalid
|
|
249
|
+
XML received. Further retries may succeed:
|
|
250
|
+
b'{"Message":"Forbidden"}'
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
`Forbidden` in the quoted body is the real answer. The other seventeen services report the same
|
|
254
|
+
rejection as a plain `403`.
|
|
255
|
+
|
|
256
|
+
## Limitations
|
|
257
|
+
|
|
258
|
+
- Five services are refused with `501 Not Implemented`. Route 53 and CloudFront speak REST-XML, and
|
|
259
|
+
API Gateway v2, SES v2 and EventBridge Scheduler speak REST-JSON. Every one of them is reachable
|
|
260
|
+
in process through `SimAws` and through [SDK interception](https://yulinsim.dev/sdk/). Simulated ECR is
|
|
261
|
+
refused the same way and has no AWS API surface at all, since its images are registered in
|
|
262
|
+
process.
|
|
263
|
+
- An operation a served service has not implemented is refused as `NotImplemented`. That is a
|
|
264
|
+
separate answer from the protocol refusal above. `aws iam list-users` reports
|
|
265
|
+
`Simulated IAM does not serve ListUsers`, and `aws lambda list-functions` names the path it
|
|
266
|
+
arrived at.
|
|
267
|
+
- `aws cloudwatch get-metric-statistics` and `aws cloudwatch get-metric-data` fail with
|
|
268
|
+
`TypeError: time.getTime is not a function`. The JSON protocol carries a timestamp as epoch
|
|
269
|
+
seconds and the endpoint hands that number to the simulation where a `Date` is expected. Both
|
|
270
|
+
reads work in process and through SDK interception. `put-metric-data` and `list-metrics` are
|
|
271
|
+
unaffected.
|
|
272
|
+
- `aws s3 cp` and `aws s3 sync` corrupt a **download** above the CLI's 8MB threshold
|
|
273
|
+
([#717](https://github.com/KensioSoftware/yulin/issues/717)). The CLI splits
|
|
274
|
+
the download into ranged GETs, simulated S3 ignores `Range` and returns the whole Object for each
|
|
275
|
+
one, and the parts land on top of each other. A 12MB Object arrives as a 20MB file. Uploads above
|
|
276
|
+
the threshold are fine, and so is any download under it. Two ways round it, both verified.
|
|
277
|
+
`aws s3api get-object` issues one unranged GET. Raising the threshold in the config file keeps
|
|
278
|
+
`aws s3 cp` on a single GET too.
|
|
279
|
+
|
|
280
|
+
```ini
|
|
281
|
+
[profile sim]
|
|
282
|
+
s3 =
|
|
283
|
+
multipart_threshold = 5GB
|
|
284
|
+
```
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Event factories
|
|
2
|
+
|
|
3
|
+
A handler is invoked with an event, and a test of a handler has to produce one. The events AWS
|
|
4
|
+
delivers are large, most of each one is fields the handler never reads, and the two or three the
|
|
5
|
+
test is about are buried in them. Written out by hand, that literal is copied between files and
|
|
6
|
+
drifts.
|
|
7
|
+
|
|
8
|
+
Yulin exports [`@kensio/part-factory`](https://partfactory.dev/) factories for those event shapes. A
|
|
9
|
+
test made with one says what the request or the message was and leaves the rest of the event alone.
|
|
10
|
+
They are ordinary factories, made in-process, and they need no `SimAws` instance and no simulated
|
|
11
|
+
service running. A handler test that runs without a simulator is who they are for. A test that does want
|
|
12
|
+
one (a Function URL served over HTTP, a queue with a real event source mapping) gets its events from
|
|
13
|
+
the simulator, and these factories make the same shapes that simulator delivers.
|
|
14
|
+
|
|
15
|
+
## What is exported
|
|
16
|
+
|
|
17
|
+
| Factory | Import | Event |
|
|
18
|
+
| ----------------------------------------------------------------------------- | ---------------------------- | ----------------------------------- |
|
|
19
|
+
| `lambdaFunctionUrlEventFactory` | `@kensio/yulin/lambda` | A Lambda Function URL invocation |
|
|
20
|
+
| `lambdaSqsEventFactory`, `lambdaSqsEventRecordFactory` | `@kensio/yulin/lambda` | An SQS event source mapping's batch |
|
|
21
|
+
| `lambdaDynamoDbStreamEventFactory`, `lambdaDynamoDbStreamEventRecordFactory` | `@kensio/yulin/lambda` | A DynamoDB stream mapping's batch |
|
|
22
|
+
| `httpApiProxyEventFactory` | `@kensio/yulin/apigatewayv2` | An HTTP API `AWS_PROXY` invocation |
|
|
23
|
+
| `s3NotificationEventFactory`, `s3NotificationEventRecordFactory` | `@kensio/yulin/s3` | An S3 event notification |
|
|
24
|
+
| `cloudFrontViewerRequestEventFactory`, `cloudFrontViewerResponseEventFactory` | `@kensio/yulin/cloudfront` | A CloudFront Functions event |
|
|
25
|
+
|
|
26
|
+
Each service's own documentation covers what its events mean. This page is about how the factories
|
|
27
|
+
are shaped and what they have in common.
|
|
28
|
+
|
|
29
|
+
## One factory per shape, and one per record
|
|
30
|
+
|
|
31
|
+
An event that carries a list of records has two factories, one for a record and one for the event
|
|
32
|
+
around it. The record factory makes one record, and the event factory completes as many records as
|
|
33
|
+
the test asks for.
|
|
34
|
+
|
|
35
|
+
```typescript factories-records-and-events
|
|
36
|
+
/**
|
|
37
|
+
* Making the SQS event a batch of messages arrives in.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
import {
|
|
41
|
+
lambdaSqsEventFactory,
|
|
42
|
+
lambdaSqsEventRecordFactory,
|
|
43
|
+
type SimLambdaSqsEvent,
|
|
44
|
+
} from "@kensio/yulin/lambda";
|
|
45
|
+
|
|
46
|
+
function ordersHandler(event: SimLambdaSqsEvent): readonly string[] {
|
|
47
|
+
return event.Records.map(
|
|
48
|
+
(record) => (JSON.parse(record.body) as { orderId: string }).orderId,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// One record, for a test about a single message.
|
|
53
|
+
const record = lambdaSqsEventRecordFactory.make({
|
|
54
|
+
body: '{"orderId":"YL-1"}',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// [ 'YL-1' ]
|
|
58
|
+
console.log(ordersHandler({ Records: [record] }));
|
|
59
|
+
|
|
60
|
+
// A batch, saying only what each message carries. Everything else about each
|
|
61
|
+
// record — its message id, its receipt handle, the digest of its body — is
|
|
62
|
+
// filled in as a delivered record's is.
|
|
63
|
+
const event = lambdaSqsEventFactory.make({
|
|
64
|
+
Records: [{ body: '{"orderId":"YL-1"}' }, { body: '{"orderId":"YL-2"}' }],
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// [ 'YL-1', 'YL-2' ]
|
|
68
|
+
console.log(ordersHandler(event));
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The event factory exists so a test can pass partial records like that. A `DynamicFactory` whose
|
|
72
|
+
defaults hold one record would not manage it. Overrides are merged onto defaults, and merging
|
|
73
|
+
replaces a list whole rather than element by element. A partial record passed that way would reach
|
|
74
|
+
the handler as the only thing in those records, typed as a complete one and missing every field the
|
|
75
|
+
handler reads.
|
|
76
|
+
|
|
77
|
+
## Named variations
|
|
78
|
+
|
|
79
|
+
Every factory here is an `ItemFactory`. A variation with a name is a `VariantFactory` around it, the
|
|
80
|
+
same as for any other `part-factory` factory. That is usually the tidiest way to describe the kind
|
|
81
|
+
of request or message one application receives:
|
|
82
|
+
|
|
83
|
+
```typescript factories-variants
|
|
84
|
+
/**
|
|
85
|
+
* Naming the variations of an event an application receives.
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
import { VariantFactory } from "@kensio/part-factory";
|
|
89
|
+
|
|
90
|
+
import { httpApiProxyEventFactory } from "@kensio/yulin/apigatewayv2";
|
|
91
|
+
import { s3NotificationEventFactory } from "@kensio/yulin/s3";
|
|
92
|
+
|
|
93
|
+
const signedInRequestFactory = new VariantFactory(httpApiProxyEventFactory, {
|
|
94
|
+
requestContext: {
|
|
95
|
+
authorizer: { jwt: { claims: { sub: "YL-1" }, scopes: null } },
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const request = signedInRequestFactory.make({ rawPath: "/account" });
|
|
100
|
+
|
|
101
|
+
// GET /account YL-1
|
|
102
|
+
console.log(
|
|
103
|
+
request.routeKey,
|
|
104
|
+
request.requestContext.authorizer?.jwt?.claims["sub"],
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const objectRemovedFactory = new VariantFactory(s3NotificationEventFactory, {
|
|
108
|
+
Records: [{ eventName: "ObjectRemoved:Delete" }],
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const removal = objectRemovedFactory.make();
|
|
112
|
+
|
|
113
|
+
// ObjectRemoved:Delete undefined
|
|
114
|
+
console.log(
|
|
115
|
+
removal.Records[0]?.eventName,
|
|
116
|
+
// A removal reports no size, because the Object is gone.
|
|
117
|
+
removal.Records[0]?.s3.object.size,
|
|
118
|
+
);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Events that agree with themselves
|
|
122
|
+
|
|
123
|
+
A real AWS event says the same thing in more than one field, and those copies are where a
|
|
124
|
+
hand-written literal goes wrong. It asks for `/user/status` and leaves the request context saying
|
|
125
|
+
`/`, or gives an SQS record the digest of some other body, or reports a DynamoDB insert on a record
|
|
126
|
+
that carries an old image.
|
|
127
|
+
|
|
128
|
+
Each factory's defaults are computed from the overrides, so supplying either copy settles the other.
|
|
129
|
+
What that covers is listed in each factory's own documentation, and in outline it is:
|
|
130
|
+
|
|
131
|
+
- **Function URL and HTTP API events** — the path, the query, the route key, the endpoint's id,
|
|
132
|
+
hostname and `host` header, the caller's user agent and address, and the invocation time
|
|
133
|
+
- **SQS records** — the digest of the body, and the Region of the queue ARN
|
|
134
|
+
- **DynamoDB stream records** — the images the reported change would carry, the view type naming
|
|
135
|
+
the images that are there, and the Region of the stream ARN
|
|
136
|
+
- **S3 notification records** — the ARN of the Bucket named, and whether the Object still exists to
|
|
137
|
+
have a size and an eTag
|
|
138
|
+
|
|
139
|
+
Overriding both copies of one of those with different values is still allowed. A test that wants an
|
|
140
|
+
event no real invocation would produce is entitled to one. It just has to ask for it twice.
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Linting CFF JS2
|
|
2
|
+
|
|
3
|
+
CloudFront Functions run JS2, ECMAScript 5.1 with a named subset of ES 6 to 12 on top, rather than
|
|
4
|
+
a current JavaScript engine. A class or a `for...of` is a syntax error, and CloudFront refuses the
|
|
5
|
+
code when you upload it. A call to `fetch` parses, and then fails at the edge, where that global is
|
|
6
|
+
absent and there is no network to reach. Both are a long way from where the code was written, and
|
|
7
|
+
Yulin publishes lint configs that refuse the same things in the editor.
|
|
8
|
+
|
|
9
|
+
The configs apply to `**/*.cff.js` files. That is the naming
|
|
10
|
+
[sim CloudFront](https://yulinsim.dev/services/cloudfront/ "Simulated CloudFront usage docs") already uses for
|
|
11
|
+
CloudFront Function source.
|
|
12
|
+
|
|
13
|
+
Every restriction comes from the runtime's
|
|
14
|
+
[own feature list](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-javascript-runtime-20.html),
|
|
15
|
+
an allow-list, and anything outside it is unsupported. None of it is house style. A rule
|
|
16
|
+
banning syntax JS2 accepts would send you away from code that works.
|
|
17
|
+
|
|
18
|
+
## Setting it up with ESLint
|
|
19
|
+
|
|
20
|
+
`@kensio/yulin/eslint` exports a flat config to spread into your own. It restricts itself to
|
|
21
|
+
`**/*.cff.js`. The rest of your config still applies everywhere else.
|
|
22
|
+
|
|
23
|
+
```typescript cff-js2-eslint-config
|
|
24
|
+
/**
|
|
25
|
+
* An ESLint config that lints CloudFront Function files as JS2.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import eslint from "@eslint/js";
|
|
29
|
+
import { defineConfig } from "eslint/config";
|
|
30
|
+
|
|
31
|
+
import { cloudFrontFunctionsJs2 } from "@kensio/yulin/eslint";
|
|
32
|
+
|
|
33
|
+
export default defineConfig(
|
|
34
|
+
eslint.configs.recommended,
|
|
35
|
+
|
|
36
|
+
// Applies only to **/*.cff.js, so it goes after the configs it relaxes.
|
|
37
|
+
...cloudFrontFunctionsJs2,
|
|
38
|
+
);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
It goes after any config whose rules it needs to turn off. That is a short list. `const`, `let`,
|
|
42
|
+
template literals, arrow functions, rest parameters and `async`/`await` all work in JS2, and the
|
|
43
|
+
rules asking for them stay on. Only `object-shorthand` is switched off, because shorthand property
|
|
44
|
+
names are ES 6 literal syntax the runtime lacks.
|
|
45
|
+
|
|
46
|
+
`eslint` and `typescript-eslint` are optional peer dependencies, needed only if you use this export.
|
|
47
|
+
|
|
48
|
+
## Setting it up with Oxlint
|
|
49
|
+
|
|
50
|
+
`@kensio/yulin/oxlint` ships the same rules as an Oxlint config fragment to extend. The rules
|
|
51
|
+
themselves are one plugin loaded by both linters. The two configs report the same things in the same
|
|
52
|
+
places.
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"extends": ["./node_modules/@kensio/yulin/cffjs2.oxlintrc.json"],
|
|
57
|
+
"rules": {
|
|
58
|
+
"no-console": "error"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Oxlint's `extends` takes a file path rather than a package name. The path into `node_modules` is
|
|
64
|
+
written out in full. The file sits in the package root. A build that moves what it emits under
|
|
65
|
+
`dist/` leaves the path alone. The fragment brings its own `overrides` entry scoped to `**/*.cff.js`
|
|
66
|
+
and the JS plugin the rules live in, and leaves every other file to your own rules.
|
|
67
|
+
|
|
68
|
+
The plugin is loaded through Oxlint's JS plugin support, which needs Oxlint 1.77 or later.
|
|
69
|
+
|
|
70
|
+
## What is reported
|
|
71
|
+
|
|
72
|
+
Each restriction is its own rule, under the `cff-js2` name in both linters.
|
|
73
|
+
|
|
74
|
+
| Rule | What it refuses |
|
|
75
|
+
| ------------------------------- | -------------------------------------------------------- |
|
|
76
|
+
| `cff-js2/no-import` | `import` declarations, apart from `cloudfront` |
|
|
77
|
+
| `cff-js2/only-handler-export` | Any export other than `export function handler(...)` |
|
|
78
|
+
| `cff-js2/only-built-in-require` | Requiring anything but `querystring`, `crypto`, `buffer` |
|
|
79
|
+
| `cff-js2/no-class` | Class declarations and expressions |
|
|
80
|
+
| `cff-js2/no-generator` | Generators and `yield` |
|
|
81
|
+
| `cff-js2/no-destructuring` | Object and array destructuring |
|
|
82
|
+
| `cff-js2/no-spread` | Spread syntax, but not rest parameters |
|
|
83
|
+
| `cff-js2/no-for-of` | `for...of`, in favour of an index-based loop |
|
|
84
|
+
| `cff-js2/no-unavailable-global` | Globals the runtime does not have, such as `fetch` |
|
|
85
|
+
|
|
86
|
+
`cff-js2/no-unavailable-global` covers three groups. `fetch`, `XMLHttpRequest` and `WebSocket` need
|
|
87
|
+
a network the runtime lacks. `process` needs Node.js. `setTimeout`, `setInterval`, `setImmediate`
|
|
88
|
+
and `clearTimeout` need an event loop a Function never gets. The rule resolves names through scope
|
|
89
|
+
rather than matching them as text, and a local variable named `fetch` or a property named
|
|
90
|
+
`event.fetch` is left alone. Each report says why the global is missing, because `fetch` being
|
|
91
|
+
absent for want of a network and `setTimeout` for want of an event loop call for different rewrites.
|
|
92
|
+
|
|
93
|
+
Alongside these, both configs turn on `no-eval`, `no-new-func` and `no-implied-eval`, which the
|
|
94
|
+
runtime refuses outright. They also set `no-unused-vars` to leave `handler` alone, since it is the
|
|
95
|
+
entry point CloudFront calls.
|
|
96
|
+
|
|
97
|
+
## What is not reported
|
|
98
|
+
|
|
99
|
+
These all work in JS2 and no rule here objects to them:
|
|
100
|
+
|
|
101
|
+
- Template literals, including interpolation and nesting
|
|
102
|
+
- Arrow functions and rest parameters
|
|
103
|
+
- `const` and `let`
|
|
104
|
+
- `async` and `await`
|
|
105
|
+
- `Promise`, including `all`, `allSettled`, `any` and `race`
|
|
106
|
+
- `Buffer`, and `require` of `querystring`, `crypto` or `buffer`
|
|
107
|
+
- `import cf from "cloudfront"`, which a Function needs for `cf.kvs()` and
|
|
108
|
+
`cf.updateRequestOrigin()`
|
|
109
|
+
- `String.prototype.replaceAll`, `atob`, `btoa` and numeric separators
|
|
110
|
+
|
|
111
|
+
## Turning one restriction off
|
|
112
|
+
|
|
113
|
+
Rules are individual. A restriction you disagree with can be switched off on its own. In ESLint:
|
|
114
|
+
|
|
115
|
+
```typescript cff-js2-eslint-relax
|
|
116
|
+
/**
|
|
117
|
+
* Allowing class syntax in CloudFront Function files.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
import { defineConfig } from "eslint/config";
|
|
121
|
+
|
|
122
|
+
import { cloudFrontFunctionsJs2 } from "@kensio/yulin/eslint";
|
|
123
|
+
|
|
124
|
+
export default defineConfig(...cloudFrontFunctionsJs2, {
|
|
125
|
+
files: ["**/*.cff.js"],
|
|
126
|
+
rules: {
|
|
127
|
+
"cff-js2/no-class": "off",
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
In Oxlint, the same thing goes in an `overrides` entry after the `extends`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"extends": ["./node_modules/@kensio/yulin/cffjs2.oxlintrc.json"],
|
|
137
|
+
"overrides": [
|
|
138
|
+
{
|
|
139
|
+
"files": ["**/*.cff.js"],
|
|
140
|
+
"rules": {
|
|
141
|
+
"cff-js2/no-class": "off"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Available functionality
|
|
149
|
+
|
|
150
|
+
- A flat ESLint config at `@kensio/yulin/eslint`, exported as `cloudFrontFunctionsJs2`
|
|
151
|
+
- An Oxlint config fragment at `cffjs2.oxlintrc.json` in the package root, with the object it is
|
|
152
|
+
generated from exported as `cloudFrontFunctionsJs2Oxlint` from `@kensio/yulin/oxlint`
|
|
153
|
+
- Nine `cff-js2` rules, one per restriction, shared by both linters
|
|
154
|
+
- Scoping to `**/*.cff.js`, leaving a repository's own rules untouched elsewhere
|
|
155
|
+
|
|
156
|
+
## Limitations
|
|
157
|
+
|
|
158
|
+
Where the configs knowingly stop short:
|
|
159
|
+
|
|
160
|
+
- **`async` arguments and closures are not checked.** JS2 supports `async` and `await`, but not
|
|
161
|
+
`async` arguments or closures, and `await` only inside an `async` function. Where the runtime's
|
|
162
|
+
wording stops short of saying exactly which forms those are, no rule guesses at it. A Function can
|
|
163
|
+
pass the lint and still be refused for one.
|
|
164
|
+
- **The list of unavailable globals is the useful part of one, not all of it.** It names what test
|
|
165
|
+
code and Node habits reach for. A global outside that list goes unreported, even if JS2 lacks it.
|
|
166
|
+
- **The rules are syntactic.** Nothing here knows CloudFront's size limit on Function code or its CPU
|
|
167
|
+
budget. A Function that passes the lint can still be refused at publication for being too large or
|
|
168
|
+
too slow. No rule checks which methods of a supported built-in you call either, and the runtime
|
|
169
|
+
supports only some of them.
|
|
170
|
+
- **Only the `cff-js2` rules are shared between the linters.** ESLint and Oxlint each bring their own
|
|
171
|
+
built-in rules, and their own defaults for which are on. A `.cff.js` file linted by both may pick
|
|
172
|
+
up findings from one that the other lacks.
|
|
173
|
+
- **Oxlint's JS plugin support is in alpha.** It is what loads these rules into Oxlint, and its API
|
|
174
|
+
is still moving upstream.
|
|
175
|
+
- **The Oxlint fragment is extended by path.** Oxlint has no package-name resolution in `extends`.
|
|
176
|
+
The written-out path into `node_modules` depends on your installer's layout.
|