@kensio/yulin 1.21.0 → 1.21.1
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 +1 -0
- package/dist/sdk/router/resolve-sim-sdk-command-router.js +4 -0
- package/dist/service/aws/factory/sim-aws-account-region-service-builder.js +3 -0
- package/dist/service/aws/factory/sim-aws-lambda-collaborators.d.ts +2 -0
- package/dist/service/aws/factory/sim-aws-lambda-collaborators.js +3 -0
- package/dist/service/aws/factory/sim-aws-logs-collaborators.d.ts +7 -0
- package/dist/service/aws/factory/sim-aws-logs-collaborators.js +10 -0
- package/dist/service/aws/factory/sim-aws-self-contained-service-builder.d.ts +3 -0
- package/dist/service/aws/factory/sim-aws-self-contained-service-builder.js +5 -0
- package/dist/service/aws/factory/sim-aws-service-factory.d.ts +3 -0
- package/dist/service/aws/factory/sim-aws-service-factory.js +4 -0
- package/dist/service/aws/sim-aws-account-region-scope.d.ts +3 -0
- package/dist/service/aws/sim-aws-account-region-scope.js +4 -0
- package/dist/service/aws/sim-aws-account.d.ts +3 -0
- package/dist/service/aws/sim-aws-account.js +4 -0
- package/dist/service/aws/sim-aws-region.d.ts +3 -0
- package/dist/service/aws/sim-aws-region.js +4 -0
- package/dist/service/aws/sim-aws-service-accessors.d.ts +3 -0
- package/dist/service/aws/sim-aws-service-accessors.js +4 -0
- package/dist/service/backup/cfn/sim-backup-cfn-plan-creator.d.ts +6 -0
- package/dist/service/backup/cfn/sim-backup-cfn-plan-creator.js +12 -0
- package/dist/service/backup/cfn/sim-backup-cfn-resource-deleter.d.ts +12 -0
- package/dist/service/backup/cfn/sim-backup-cfn-resource-deleter.js +31 -0
- package/dist/service/backup/cfn/sim-backup-cfn-resource-factory.d.ts +15 -0
- package/dist/service/backup/cfn/sim-backup-cfn-resource-factory.js +38 -0
- package/dist/service/backup/cfn/sim-backup-cfn-selection-creator.d.ts +6 -0
- package/dist/service/backup/cfn/sim-backup-cfn-selection-creator.js +17 -0
- package/dist/service/backup/cfn/sim-backup-cfn-vault-creator.d.ts +6 -0
- package/dist/service/backup/cfn/sim-backup-cfn-vault-creator.js +29 -0
- package/dist/service/backup/cfn/sim-cfn-backup-plan-properties.d.ts +11 -0
- package/dist/service/backup/cfn/sim-cfn-backup-plan-properties.js +37 -0
- package/dist/service/backup/cfn/sim-cfn-backup-properties.d.ts +12 -0
- package/dist/service/backup/cfn/sim-cfn-backup-properties.js +37 -0
- package/dist/service/backup/cfn/sim-cfn-backup-property-reader.d.ts +17 -0
- package/dist/service/backup/cfn/sim-cfn-backup-property-reader.js +62 -0
- package/dist/service/backup/cfn/sim-cfn-backup-resource-error.d.ts +7 -0
- package/dist/service/backup/cfn/sim-cfn-backup-resource-error.js +22 -0
- package/dist/service/backup/command/sim-backup-authorizer.d.ts +11 -0
- package/dist/service/backup/command/sim-backup-authorizer.js +24 -0
- package/dist/service/backup/command/sim-backup-command.types.d.ts +238 -0
- package/dist/service/backup/command/sim-backup-command.types.js +1 -0
- package/dist/service/backup/command/sim-backup-configuration-commands.d.ts +32 -0
- package/dist/service/backup/command/sim-backup-configuration-commands.js +138 -0
- package/dist/service/backup/command/sim-backup-job-commands.d.ts +23 -0
- package/dist/service/backup/command/sim-backup-job-commands.js +52 -0
- package/dist/service/backup/command/sim-backup-recovery-point-commands.d.ts +18 -0
- package/dist/service/backup/command/sim-backup-recovery-point-commands.js +38 -0
- package/dist/service/backup/command/sim-backup-request-options.d.ts +4 -0
- package/dist/service/backup/command/sim-backup-request-options.js +1 -0
- package/dist/service/backup/command/sim-backup-required-string.d.ts +2 -0
- package/dist/service/backup/command/sim-backup-required-string.js +8 -0
- package/dist/service/backup/error/sim-backup.error.d.ts +38 -0
- package/dist/service/backup/error/sim-backup.error.js +50 -0
- package/dist/service/backup/index.d.ts +9 -0
- package/dist/service/backup/index.js +7 -0
- package/dist/service/backup/job/sim-backup-job-input.d.ts +11 -0
- package/dist/service/backup/job/sim-backup-job-input.js +1 -0
- package/dist/service/backup/job/sim-backup-job-page.d.ts +22 -0
- package/dist/service/backup/job/sim-backup-job-page.js +54 -0
- package/dist/service/backup/job/sim-backup-job.d.ts +25 -0
- package/dist/service/backup/job/sim-backup-job.factory.d.ts +10 -0
- package/dist/service/backup/job/sim-backup-job.factory.js +24 -0
- package/dist/service/backup/job/sim-backup-job.js +54 -0
- package/dist/service/backup/job/sim-backup-jobs.d.ts +18 -0
- package/dist/service/backup/job/sim-backup-jobs.js +33 -0
- package/dist/service/backup/plan/sim-backup-plan-schedules.d.ts +21 -0
- package/dist/service/backup/plan/sim-backup-plan-schedules.js +66 -0
- package/dist/service/backup/plan/sim-backup-plan.d.ts +22 -0
- package/dist/service/backup/plan/sim-backup-plan.js +37 -0
- package/dist/service/backup/plan/sim-backup-rule.d.ts +9 -0
- package/dist/service/backup/plan/sim-backup-rule.js +71 -0
- package/dist/service/backup/recovery-point/sim-backup-recovery-point.d.ts +28 -0
- package/dist/service/backup/recovery-point/sim-backup-recovery-point.factory.d.ts +9 -0
- package/dist/service/backup/recovery-point/sim-backup-recovery-point.factory.js +23 -0
- package/dist/service/backup/recovery-point/sim-backup-recovery-point.js +62 -0
- package/dist/service/backup/sdk/sim-backup-sdk-command-router.d.ts +9 -0
- package/dist/service/backup/sdk/sim-backup-sdk-command-router.js +37 -0
- package/dist/service/backup/selection/sim-backup-selection.d.ts +22 -0
- package/dist/service/backup/selection/sim-backup-selection.js +43 -0
- package/dist/service/backup/sim-backup-arn.d.ts +7 -0
- package/dist/service/backup/sim-backup-arn.js +12 -0
- package/dist/service/backup/sim-backup-properties.d.ts +8 -0
- package/dist/service/backup/sim-backup-properties.js +1 -0
- package/dist/service/backup/sim-backup-resource-resolver.d.ts +24 -0
- package/dist/service/backup/sim-backup-resource-resolver.js +44 -0
- package/dist/service/backup/sim-backup-store.d.ts +29 -0
- package/dist/service/backup/sim-backup-store.js +80 -0
- package/dist/service/backup/sim-backup.d.ts +48 -0
- package/dist/service/backup/sim-backup.js +139 -0
- package/dist/service/backup/vault/sim-backup-vault-description.d.ts +12 -0
- package/dist/service/backup/vault/sim-backup-vault-description.js +15 -0
- package/dist/service/backup/vault/sim-backup-vault-lock-configuration.d.ts +5 -0
- package/dist/service/backup/vault/sim-backup-vault-lock-configuration.js +31 -0
- package/dist/service/backup/vault/sim-backup-vault-lock.d.ts +15 -0
- package/dist/service/backup/vault/sim-backup-vault-lock.js +23 -0
- package/dist/service/backup/vault/sim-backup-vault-recovery-points.d.ts +12 -0
- package/dist/service/backup/vault/sim-backup-vault-recovery-points.js +30 -0
- package/dist/service/backup/vault/sim-backup-vault-retention.d.ts +4 -0
- package/dist/service/backup/vault/sim-backup-vault-retention.js +20 -0
- package/dist/service/backup/vault/sim-backup-vault.d.ts +33 -0
- package/dist/service/backup/vault/sim-backup-vault.js +49 -0
- package/dist/service/cloudformation/resource/cfn/backup/sim-backup-cfn-value-adapter.d.ts +3 -0
- package/dist/service/cloudformation/resource/cfn/backup/sim-backup-cfn-value-adapter.js +66 -0
- package/dist/service/cloudformation/resource/cfn/logs/sim-logs-cfn-value-adapter.js +6 -0
- package/dist/service/cloudformation/resource/cfn/logs/sim-logs-metric-filter-cfn.d.ts +23 -0
- package/dist/service/cloudformation/resource/cfn/logs/sim-logs-metric-filter-cfn.js +22 -0
- package/dist/service/cloudformation/resource/cfn/sim-cfn-service-value-adapters.js +2 -0
- package/dist/service/cloudformation/resource/ignore/sim-cfn-skipped-properties.d.ts +49 -0
- package/dist/service/cloudformation/resource/ignore/sim-cfn-skipped-properties.js +61 -0
- package/dist/service/cloudformation/resource/ignore/sim-cfn-skipped-property.type.d.ts +51 -0
- package/dist/service/cloudformation/resource/ignore/sim-cfn-skipped-property.type.js +1 -0
- package/dist/service/cloudformation/resource/resolve/service/sim-cfn-service-factories.js +4 -0
- package/dist/service/cloudwatch/index.d.ts +1 -0
- package/dist/service/cloudwatch/index.js +1 -0
- package/dist/service/cloudwatch/sim-cloudwatch-commands.d.ts +2 -0
- package/dist/service/cloudwatch/sim-cloudwatch-commands.js +6 -0
- package/dist/service/cloudwatch/sim-cloudwatch.d.ts +9 -0
- package/dist/service/cloudwatch/sim-cloudwatch.js +10 -0
- package/dist/service/cloudwatch/write/sim-cloudwatch-service-writer.d.ts +58 -0
- package/dist/service/cloudwatch/write/sim-cloudwatch-service-writer.js +53 -0
- package/dist/service/cognito/command/auth/sim-cognito-admin-respond-to-challenge.d.ts +3 -0
- package/dist/service/cognito/command/auth/sim-cognito-admin-respond-to-challenge.js +8 -2
- package/dist/service/cognito/command/auth/sim-cognito-auth-commands.d.ts +3 -0
- package/dist/service/cognito/command/auth/sim-cognito-auth-commands.js +4 -0
- package/dist/service/cognito/command/auth/sim-cognito-auth-flow-runner.d.ts +11 -1
- package/dist/service/cognito/command/auth/sim-cognito-auth-flow-runner.js +13 -1
- package/dist/service/cognito/command/auth/sim-cognito-auth-resolver.d.ts +3 -0
- package/dist/service/cognito/command/auth/sim-cognito-auth-resolver.js +16 -4
- package/dist/service/cognito/command/auth/sim-cognito-get-tokens-from-refresh-token.d.ts +7 -0
- package/dist/service/cognito/command/auth/sim-cognito-get-tokens-from-refresh-token.js +11 -1
- package/dist/service/cognito/command/auth/sim-cognito-respond-to-challenge.d.ts +3 -0
- package/dist/service/cognito/command/auth/sim-cognito-respond-to-challenge.js +8 -2
- package/dist/service/cognito/command/hosted/hosted-auth.command.d.ts +19 -0
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.d.ts +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.js +3 -2
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-commands.d.ts +8 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-commands.js +11 -3
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.d.ts +11 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.js +13 -2
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.d.ts +11 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.js +11 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.d.ts +7 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.js +18 -7
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-signed-in.d.ts +20 -3
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-signed-in.js +19 -3
- package/dist/service/cognito/command/hosted/sim-cognito-token-endpoint.d.ts +2 -0
- package/dist/service/cognito/command/hosted/sim-cognito-token-grants.d.ts +8 -0
- package/dist/service/cognito/command/hosted/sim-cognito-token-grants.js +13 -4
- package/dist/service/cognito/command/sim-cognito-commands.d.ts +5 -0
- package/dist/service/cognito/command/sim-cognito-commands.js +22 -2
- package/dist/service/cognito/command/user/sim-cognito-confirm-sign-up-commands.d.ts +74 -0
- package/dist/service/cognito/command/user/sim-cognito-confirm-sign-up-commands.js +110 -0
- package/dist/service/cognito/command/user/sim-cognito-sign-up-commands.d.ts +5 -49
- package/dist/service/cognito/command/user/sim-cognito-sign-up-commands.js +7 -87
- package/dist/service/cognito/command/user/sim-cognito-user-commands.d.ts +4 -0
- package/dist/service/cognito/command/user/sim-cognito-user-commands.js +38 -29
- package/dist/service/cognito/error/sim-cognito-managed-login.error.d.ts +23 -0
- package/dist/service/cognito/error/sim-cognito-managed-login.error.js +36 -0
- package/dist/service/cognito/error/sim-cognito-throttle.error.d.ts +13 -0
- package/dist/service/cognito/error/sim-cognito-throttle.error.js +15 -0
- package/dist/service/cognito/index.d.ts +2 -0
- package/dist/service/cognito/index.js +2 -0
- package/dist/service/cognito/metric/sim-cognito-counted-request.d.ts +50 -0
- package/dist/service/cognito/metric/sim-cognito-counted-request.js +51 -0
- package/dist/service/cognito/metric/sim-cognito-metrics.d.ts +22 -0
- package/dist/service/cognito/metric/sim-cognito-metrics.js +26 -0
- package/dist/service/cognito/metric/sim-cognito-pool-metrics.d.ts +40 -0
- package/dist/service/cognito/metric/sim-cognito-pool-metrics.js +51 -0
- package/dist/service/cognito/metric/sim-cognito-throttled-request.d.ts +11 -0
- package/dist/service/cognito/metric/sim-cognito-throttled-request.js +15 -0
- package/dist/service/cognito/serve/page/sim-cognito-managed-login.d.ts +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-managed-login.js +6 -1
- package/dist/service/cognito/serve/page/sim-cognito-page-markup.d.ts +4 -1
- package/dist/service/cognito/serve/page/sim-cognito-page-markup.js +6 -2
- package/dist/service/cognito/serve/page/sim-cognito-provider-page.d.ts +35 -0
- package/dist/service/cognito/serve/page/sim-cognito-provider-page.js +50 -0
- package/dist/service/cognito/sim-cognito-identity-provider.d.ts +6 -0
- package/dist/service/cognito/sim-cognito-identity-provider.js +1 -0
- package/dist/service/cognito/sim-cognito-user-directory.js +3 -3
- package/dist/service/cognito/user-pool/auth/sim-cognito-authorization-code.d.ts +9 -0
- package/dist/service/cognito/user-pool/auth/sim-cognito-authorization-code.js +2 -0
- package/dist/service/cognito/user-pool/auth/sim-cognito-pool-auth.d.ts +8 -0
- package/dist/service/cognito/user-pool/auth/sim-cognito-pool-auth.js +8 -0
- package/dist/service/cognito/user-pool/auth/sim-cognito-request-throttle.d.ts +36 -0
- package/dist/service/cognito/user-pool/auth/sim-cognito-request-throttle.js +45 -0
- package/dist/service/cognito/user-pool/idp/sim-cognito-federated-sign-in.d.ts +42 -9
- package/dist/service/cognito/user-pool/idp/sim-cognito-federated-sign-in.js +56 -27
- package/dist/service/cognito/user-pool/idp/sim-cognito-federated-triggers.d.ts +52 -0
- package/dist/service/cognito/user-pool/idp/sim-cognito-federated-triggers.js +49 -0
- package/dist/service/cognito/user-pool/idp/sim-cognito-presented-external-user.d.ts +48 -0
- package/dist/service/cognito/user-pool/idp/sim-cognito-presented-external-user.js +94 -0
- package/dist/service/cognito/user-pool/idp/sim-cognito-same-federated-identity.d.ts +13 -0
- package/dist/service/cognito/user-pool/idp/sim-cognito-same-federated-identity.js +19 -0
- package/dist/service/cognito/user-pool/idp/sim-cognito-user-pool-identity-provider.d.ts +7 -0
- package/dist/service/cognito/user-pool/idp/sim-cognito-user-pool-identity-provider.js +9 -0
- package/dist/service/cognito/user-pool/trigger/sim-cognito-trigger-name.d.ts +3 -2
- package/dist/service/cognito/user-pool/trigger/sim-cognito-trigger-name.js +3 -2
- package/dist/service/cognito/user-pool/trigger/sim-cognito-trigger-occasion.d.ts +18 -1
- package/dist/service/cognito/user-pool/trigger/sim-cognito-trigger-occasion.js +35 -18
- package/dist/service/lambda/command/create-function/create-function.handler.d.ts +3 -0
- package/dist/service/lambda/command/create-function/create-function.handler.js +4 -1
- package/dist/service/lambda/command/function/sim-lambda-function-commands.d.ts +2 -0
- package/dist/service/lambda/event-source/poll/kinesis/sim-lambda-kinesis-stream-delivery.js +7 -11
- package/dist/service/lambda/event-source/poll/sim-lambda-dynamodb-stream-delivery.js +7 -8
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-iterator-age.d.ts +11 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-iterator-age.js +31 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-sequence-numbers.d.ts +10 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-sequence-numbers.js +12 -0
- package/dist/service/lambda/function/sim-lambda-function.d.ts +3 -0
- package/dist/service/lambda/function/sim-lambda-function.js +6 -2
- package/dist/service/lambda/function/sim-lambda-function.type.d.ts +7 -0
- package/dist/service/lambda/metric/sim-lambda-function-metrics.d.ts +47 -0
- package/dist/service/lambda/metric/sim-lambda-function-metrics.js +83 -0
- package/dist/service/lambda/metric/sim-lambda-iterator-age.d.ts +29 -0
- package/dist/service/lambda/metric/sim-lambda-iterator-age.js +41 -0
- package/dist/service/lambda/metric/sim-lambda-metrics.d.ts +12 -0
- package/dist/service/lambda/metric/sim-lambda-metrics.js +13 -0
- package/dist/service/lambda/sim-lambda-commands.d.ts +2 -0
- package/dist/service/lambda/sim-lambda-commands.js +2 -1
- package/dist/service/logs/cfn/metric/sim-cfn-metric-dimension-values.d.ts +9 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-dimension-values.js +25 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-creator.d.ts +30 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-creator.js +52 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-properties.d.ts +40 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-properties.js +66 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-property-rules.d.ts +19 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-property-rules.js +40 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-unsimulated-properties.d.ts +5 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-unsimulated-properties.js +23 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-value.d.ts +25 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-filter-value.js +58 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-transformation-values.d.ts +6 -0
- package/dist/service/logs/cfn/metric/sim-cfn-metric-transformation-values.js +19 -0
- package/dist/service/logs/cfn/sim-logs-cfn-resource-deleter.d.ts +2 -0
- package/dist/service/logs/cfn/sim-logs-cfn-resource-deleter.js +4 -0
- package/dist/service/logs/cfn/sim-logs-cfn-resource-factory.d.ts +5 -3
- package/dist/service/logs/cfn/sim-logs-cfn-resource-factory.js +12 -3
- package/dist/service/logs/command/event/sim-logs-put-log-events.d.ts +3 -0
- package/dist/service/logs/command/event/sim-logs-put-log-events.js +3 -0
- package/dist/service/logs/command/group/sim-logs-log-group-commands.js +3 -3
- package/dist/service/logs/command/metric/metric-filter.command.d.ts +79 -0
- package/dist/service/logs/command/metric/metric-filter.command.js +1 -0
- package/dist/service/logs/command/metric/sim-logs-metric-filter-commands.d.ts +48 -0
- package/dist/service/logs/command/metric/sim-logs-metric-filter-commands.js +95 -0
- package/dist/service/logs/command/metric/sim-logs-metric-filter-input.d.ts +11 -0
- package/dist/service/logs/command/metric/sim-logs-metric-filter-input.js +79 -0
- package/dist/service/logs/command/sim-logs-command.types.d.ts +1 -0
- package/dist/service/logs/group/sim-logs-log-group.d.ts +6 -0
- package/dist/service/logs/group/sim-logs-log-group.js +6 -0
- package/dist/service/logs/index.d.ts +6 -0
- package/dist/service/logs/index.js +4 -0
- package/dist/service/logs/metric/cloudwatch/sim-aws-logs-metric-filter-metrics.d.ts +40 -0
- package/dist/service/logs/metric/cloudwatch/sim-aws-logs-metric-filter-metrics.js +78 -0
- package/dist/service/logs/metric/emf/sim-logs-embedded-metric-datapoints.d.ts +25 -0
- package/dist/service/logs/metric/emf/sim-logs-embedded-metric-datapoints.js +81 -0
- package/dist/service/logs/metric/emf/sim-logs-embedded-metric-document.d.ts +57 -0
- package/dist/service/logs/metric/emf/sim-logs-embedded-metric-document.js +85 -0
- package/dist/service/logs/metric/emf/sim-logs-embedded-metric-json.d.ts +24 -0
- package/dist/service/logs/metric/emf/sim-logs-embedded-metric-json.js +41 -0
- package/dist/service/logs/metric/emf/sim-logs-embedded-metric-values.d.ts +20 -0
- package/dist/service/logs/metric/emf/sim-logs-embedded-metric-values.js +39 -0
- package/dist/service/logs/metric/sim-logs-metric-datapoint.d.ts +25 -0
- package/dist/service/logs/metric/sim-logs-metric-datapoint.js +1 -0
- package/dist/service/logs/metric/sim-logs-metric-fan-out.d.ts +62 -0
- package/dist/service/logs/metric/sim-logs-metric-fan-out.js +116 -0
- package/dist/service/logs/metric/sim-logs-metric-filter-selection.d.ts +17 -0
- package/dist/service/logs/metric/sim-logs-metric-filter-selection.js +17 -0
- package/dist/service/logs/metric/sim-logs-metric-filter-store.d.ts +35 -0
- package/dist/service/logs/metric/sim-logs-metric-filter-store.js +47 -0
- package/dist/service/logs/metric/sim-logs-metric-filter.d.ts +49 -0
- package/dist/service/logs/metric/sim-logs-metric-filter.js +95 -0
- package/dist/service/logs/metric/sim-logs-metric-publication-failure.d.ts +31 -0
- package/dist/service/logs/metric/sim-logs-metric-publication-failure.js +12 -0
- package/dist/service/logs/metric/sim-logs-metric-publications.d.ts +11 -0
- package/dist/service/logs/metric/sim-logs-metric-publications.js +1 -0
- package/dist/service/logs/metric/sim-logs-metric-transformation.d.ts +45 -0
- package/dist/service/logs/metric/sim-logs-metric-transformation.js +127 -0
- package/dist/service/logs/sdk/sim-logs-sdk-command-router.js +12 -0
- package/dist/service/logs/sim-logs-commands.d.ts +12 -0
- package/dist/service/logs/sim-logs-commands.js +17 -0
- package/dist/service/logs/sim-logs-metric-operations.d.ts +31 -0
- package/dist/service/logs/sim-logs-metric-operations.js +37 -0
- package/dist/service/logs/sim-logs.d.ts +4 -3
- package/dist/service/logs/sim-logs.js +4 -3
- package/dist/service/logs/write/sim-logs-service-writer.d.ts +3 -0
- package/dist/service/logs/write/sim-logs-service-writer.js +5 -1
- package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.d.ts +32 -0
- package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-configuration.js +31 -1
- package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.d.ts +13 -2
- package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-expiry.js +18 -1
- package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.d.ts +17 -1
- package/dist/service/s3/bucket/lifecycle/sim-s3-lifecycle-sweep.js +27 -3
- package/dist/service/s3/bucket/lifecycle/sim-s3-noncurrent-sweep.d.ts +45 -0
- package/dist/service/s3/bucket/lifecycle/sim-s3-noncurrent-sweep.js +90 -0
- package/dist/service/s3/bucket/lock/sim-s3-bucket-object-lock.d.ts +42 -0
- package/dist/service/s3/bucket/lock/sim-s3-bucket-object-lock.js +59 -0
- package/dist/service/s3/bucket/lock/sim-s3-default-retention.d.ts +8 -0
- package/dist/service/s3/bucket/lock/sim-s3-default-retention.js +15 -0
- package/dist/service/s3/bucket/lock/sim-s3-object-lock-configuration.d.ts +49 -0
- package/dist/service/s3/bucket/lock/sim-s3-object-lock-configuration.js +102 -0
- package/dist/service/s3/bucket/lock/sim-s3-object-lock-output.d.ts +14 -0
- package/dist/service/s3/bucket/lock/sim-s3-object-lock-output.js +1 -0
- package/dist/service/s3/bucket/lock/sim-s3-object-lock.d.ts +62 -0
- package/dist/service/s3/bucket/lock/sim-s3-object-lock.js +100 -0
- package/dist/service/s3/bucket/lock/sim-s3-object-retention.d.ts +55 -0
- package/dist/service/s3/bucket/lock/sim-s3-object-retention.js +82 -0
- package/dist/service/s3/bucket/notification/sim-s3-notification-event.d.ts +1 -1
- package/dist/service/s3/bucket/notification/sim-s3-notification-event.js +9 -1
- package/dist/service/s3/bucket/notification/sim-s3-unsimulated-notification-events.d.ts +1 -1
- package/dist/service/s3/bucket/notification/sim-s3-unsimulated-notification-events.js +1 -2
- package/dist/service/s3/bucket/sim-s3-bucket-objects.d.ts +114 -0
- package/dist/service/s3/bucket/sim-s3-bucket-objects.js +148 -0
- package/dist/service/s3/bucket/sim-s3-bucket.d.ts +30 -29
- package/dist/service/s3/bucket/sim-s3-bucket.js +42 -45
- package/dist/service/s3/bucket/sim-s3-object-deletion.d.ts +30 -0
- package/dist/service/s3/bucket/sim-s3-object-deletion.js +29 -0
- package/dist/service/s3/bucket/versioning/sim-s3-bucket-versioning.d.ts +61 -0
- package/dist/service/s3/bucket/versioning/sim-s3-bucket-versioning.js +65 -0
- package/dist/service/s3/bucket/versioning/sim-s3-bucket-versions.d.ts +97 -0
- package/dist/service/s3/bucket/versioning/sim-s3-bucket-versions.js +176 -0
- package/dist/service/s3/bucket/versioning/sim-s3-compare-keys.d.ts +10 -0
- package/dist/service/s3/bucket/versioning/sim-s3-compare-keys.js +16 -0
- package/dist/service/s3/bucket/versioning/sim-s3-object-version.d.ts +85 -0
- package/dist/service/s3/bucket/versioning/sim-s3-object-version.js +101 -0
- package/dist/service/s3/bucket/versioning/sim-s3-object-versions.d.ts +52 -0
- package/dist/service/s3/bucket/versioning/sim-s3-object-versions.js +91 -0
- package/dist/service/s3/bucket/versioning/sim-s3-version-page.d.ts +32 -0
- package/dist/service/s3/bucket/versioning/sim-s3-version-page.js +45 -0
- package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.d.ts +0 -5
- package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-configuration.js +3 -14
- package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.d.ts +18 -1
- package/dist/service/s3/cfn/bucket/lifecycle/sim-cfn-s3-bucket-lifecycle-fields.js +34 -1
- package/dist/service/s3/cfn/bucket/lock/sim-cfn-s3-bucket-object-lock-configuration.d.ts +37 -0
- package/dist/service/s3/cfn/bucket/lock/sim-cfn-s3-bucket-object-lock-configuration.js +78 -0
- package/dist/service/s3/cfn/bucket/replication/sim-cfn-s3-bucket-replication-rules.d.ts +20 -0
- package/dist/service/s3/cfn/bucket/replication/sim-cfn-s3-bucket-replication-rules.js +107 -0
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.d.ts +14 -7
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-configurator.js +29 -37
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-declared-configurations.d.ts +62 -0
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-declared-configurations.js +89 -0
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-names.d.ts +9 -5
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-names.js +16 -16
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-rules.d.ts +9 -5
- package/dist/service/s3/cfn/bucket/sim-cfn-s3-bucket-property-rules.js +17 -6
- package/dist/service/s3/cfn/bucket/versioning/sim-cfn-s3-bucket-versioning-configuration.d.ts +19 -0
- package/dist/service/s3/cfn/bucket/versioning/sim-cfn-s3-bucket-versioning-configuration.js +28 -0
- package/dist/service/s3/command/authorize/sim-s3-authorize-action.d.ts +24 -0
- package/dist/service/s3/command/authorize/sim-s3-authorize-action.js +30 -0
- package/dist/service/s3/command/complete-multipart-upload/complete-multipart-upload.command.d.ts +2 -0
- package/dist/service/s3/command/complete-multipart-upload/complete-multipart-upload.handler.js +3 -1
- package/dist/service/s3/command/copy-object/copy-object.command.d.ts +3 -1
- package/dist/service/s3/command/copy-object/copy-object.handler.js +3 -1
- package/dist/service/s3/command/delete-object/delete-object-version-removal.d.ts +50 -0
- package/dist/service/s3/command/delete-object/delete-object-version-removal.js +52 -0
- package/dist/service/s3/command/delete-object/delete-object.command.d.ts +19 -2
- package/dist/service/s3/command/delete-object/delete-object.handler.d.ts +7 -1
- package/dist/service/s3/command/delete-object/delete-object.handler.js +28 -16
- package/dist/service/s3/command/delete-object/sim-s3-notify-deleted.d.ts +24 -0
- package/dist/service/s3/command/delete-object/sim-s3-notify-deleted.js +32 -0
- package/dist/service/s3/command/delete-objects/delete-object-attempt.d.ts +6 -2
- package/dist/service/s3/command/delete-objects/delete-object-attempt.js +6 -2
- package/dist/service/s3/command/delete-objects/delete-objects-key-removal.js +10 -9
- package/dist/service/s3/command/delete-objects/delete-objects-outcome.js +9 -1
- package/dist/service/s3/command/delete-objects/delete-objects.command.d.ts +6 -0
- package/dist/service/s3/command/get-bucket-versioning/get-bucket-versioning.command.d.ts +23 -0
- package/dist/service/s3/command/get-bucket-versioning/get-bucket-versioning.command.js +1 -0
- package/dist/service/s3/command/get-bucket-versioning/get-bucket-versioning.handler.d.ts +31 -0
- package/dist/service/s3/command/get-bucket-versioning/get-bucket-versioning.handler.js +40 -0
- package/dist/service/s3/command/get-object/get-object-loader.d.ts +3 -2
- package/dist/service/s3/command/get-object/get-object-loader.js +9 -4
- package/dist/service/s3/command/get-object/get-object.command.d.ts +9 -1
- package/dist/service/s3/command/get-object/get-object.handler.js +1 -1
- package/dist/service/s3/command/get-object-lock-configuration/get-object-lock-configuration.command.d.ts +25 -0
- package/dist/service/s3/command/get-object-lock-configuration/get-object-lock-configuration.command.js +1 -0
- package/dist/service/s3/command/get-object-lock-configuration/get-object-lock-configuration.handler.d.ts +31 -0
- package/dist/service/s3/command/get-object-lock-configuration/get-object-lock-configuration.handler.js +41 -0
- package/dist/service/s3/command/head-object/head-object-loader.d.ts +1 -1
- package/dist/service/s3/command/head-object/head-object-loader.js +7 -3
- package/dist/service/s3/command/head-object/head-object.command.d.ts +9 -1
- package/dist/service/s3/command/head-object/head-object.handler.js +1 -1
- package/dist/service/s3/command/list-object-versions/list-object-versions-listing.d.ts +31 -0
- package/dist/service/s3/command/list-object-versions/list-object-versions-listing.js +55 -0
- package/dist/service/s3/command/list-object-versions/list-object-versions-summaries.d.ts +17 -0
- package/dist/service/s3/command/list-object-versions/list-object-versions-summaries.js +34 -0
- package/dist/service/s3/command/list-object-versions/list-object-versions.command.d.ts +59 -0
- package/dist/service/s3/command/list-object-versions/list-object-versions.command.js +1 -0
- package/dist/service/s3/command/list-object-versions/list-object-versions.handler.d.ts +34 -0
- package/dist/service/s3/command/list-object-versions/list-object-versions.handler.js +62 -0
- package/dist/service/s3/command/object/sim-s3-read-object-version.d.ts +34 -0
- package/dist/service/s3/command/object/sim-s3-read-object-version.js +52 -0
- package/dist/service/s3/command/object-lock/sim-s3-locked-version.d.ts +11 -0
- package/dist/service/s3/command/object-lock/sim-s3-locked-version.js +27 -0
- package/dist/service/s3/command/object-lock/sim-s3-object-lock-authorizer.d.ts +42 -0
- package/dist/service/s3/command/object-lock/sim-s3-object-lock-authorizer.js +66 -0
- package/dist/service/s3/command/object-lock/sim-s3-object-lock-commands.d.ts +30 -0
- package/dist/service/s3/command/object-lock/sim-s3-object-lock-commands.js +41 -0
- package/dist/service/s3/command/put-bucket-versioning/put-bucket-versioning.command.d.ts +21 -0
- package/dist/service/s3/command/put-bucket-versioning/put-bucket-versioning.command.js +1 -0
- package/dist/service/s3/command/put-bucket-versioning/put-bucket-versioning.handler.d.ts +31 -0
- package/dist/service/s3/command/put-bucket-versioning/put-bucket-versioning.handler.js +44 -0
- package/dist/service/s3/command/put-object/put-object.command.d.ts +3 -0
- package/dist/service/s3/command/put-object/put-object.handler.js +10 -10
- package/dist/service/s3/command/put-object-legal-hold/put-object-legal-hold.command.d.ts +24 -0
- package/dist/service/s3/command/put-object-legal-hold/put-object-legal-hold.command.js +1 -0
- package/dist/service/s3/command/put-object-legal-hold/put-object-legal-hold.handler.d.ts +32 -0
- package/dist/service/s3/command/put-object-legal-hold/put-object-legal-hold.handler.js +41 -0
- package/dist/service/s3/command/put-object-lock-configuration/put-object-lock-configuration.command.d.ts +21 -0
- package/dist/service/s3/command/put-object-lock-configuration/put-object-lock-configuration.command.js +1 -0
- package/dist/service/s3/command/put-object-lock-configuration/put-object-lock-configuration.handler.d.ts +32 -0
- package/dist/service/s3/command/put-object-lock-configuration/put-object-lock-configuration.handler.js +47 -0
- package/dist/service/s3/command/put-object-retention/put-object-retention.command.d.ts +29 -0
- package/dist/service/s3/command/put-object-retention/put-object-retention.command.js +1 -0
- package/dist/service/s3/command/put-object-retention/put-object-retention.handler.d.ts +31 -0
- package/dist/service/s3/command/put-object-retention/put-object-retention.handler.js +42 -0
- package/dist/service/s3/command/sim-s3-command.types.d.ts +7 -0
- package/dist/service/s3/command/versioning/sim-s3-versioning-authorizer.d.ts +35 -0
- package/dist/service/s3/command/versioning/sim-s3-versioning-authorizer.js +57 -0
- package/dist/service/s3/command/versioning/sim-s3-versioning-commands.d.ts +26 -0
- package/dist/service/s3/command/versioning/sim-s3-versioning-commands.js +34 -0
- package/dist/service/s3/command/versioning/sim-s3-versioning-configuration-validation.d.ts +13 -0
- package/dist/service/s3/command/versioning/sim-s3-versioning-configuration-validation.js +28 -0
- package/dist/service/s3/error/sim-s3-object-lock.error.d.ts +22 -0
- package/dist/service/s3/error/sim-s3-object-lock.error.js +26 -0
- package/dist/service/s3/error/sim-s3.error.d.ts +22 -0
- package/dist/service/s3/error/sim-s3.error.js +26 -0
- package/dist/service/s3/notification/event/sim-s3-event-records.js +3 -0
- package/dist/service/s3/notification/event/sim-s3-event.type.d.ts +5 -3
- package/dist/service/s3/notification/event/sim-s3-object-event-builder.d.ts +15 -0
- package/dist/service/s3/notification/event/sim-s3-object-event-builder.js +4 -1
- package/dist/service/s3/notification/event/sim-s3-object-event.d.ts +6 -0
- package/dist/service/s3/notification/event/sim-s3-object-event.js +2 -0
- package/dist/service/s3/notification/sim-s3-object-notifier.d.ts +1 -1
- package/dist/service/s3/notification/sim-s3-object-notifier.js +2 -2
- package/dist/service/s3/sdk/sim-s3-sdk-bucket-routes.d.ts +10 -0
- package/dist/service/s3/sdk/sim-s3-sdk-bucket-routes.js +84 -0
- package/dist/service/s3/sdk/sim-s3-sdk-command-router.js +6 -132
- package/dist/service/s3/sdk/sim-s3-sdk-object-lock-routes.d.ts +10 -0
- package/dist/service/s3/sdk/sim-s3-sdk-object-lock-routes.js +28 -0
- package/dist/service/s3/sdk/sim-s3-sdk-object-routes.d.ts +7 -0
- package/dist/service/s3/sdk/sim-s3-sdk-object-routes.js +80 -0
- package/dist/service/s3/sim-s3-commands.d.ts +4 -0
- package/dist/service/s3/sim-s3-commands.js +6 -0
- package/dist/service/s3/sim-s3-operations.d.ts +5 -5
- package/dist/service/s3/sim-s3-operations.js +5 -6
- package/dist/service/s3/sim-s3-version-operations.d.ts +32 -0
- package/dist/service/s3/sim-s3-version-operations.js +45 -0
- package/dist/service/scheduler/command/schedule/schedule.command.d.ts +9 -2
- package/dist/service/scheduler/command/schedule/sim-scheduler-described-schedule.js +2 -0
- package/dist/service/scheduler/command/schedule/sim-scheduler-unsimulated-target.js +0 -6
- package/dist/service/scheduler/command/sim-scheduler-command.types.d.ts +1 -1
- package/dist/service/scheduler/command/sim-scheduler-commands.js +1 -0
- package/dist/service/scheduler/delivery/sim-aws-scheduler-dead-letters.d.ts +17 -0
- package/dist/service/scheduler/delivery/sim-aws-scheduler-dead-letters.js +29 -0
- package/dist/service/scheduler/delivery/sim-aws-scheduler-delivery-targets.d.ts +6 -1
- package/dist/service/scheduler/delivery/sim-aws-scheduler-delivery-targets.js +9 -0
- package/dist/service/scheduler/delivery/sim-scheduler-dead-letter-queue.d.ts +18 -0
- package/dist/service/scheduler/delivery/sim-scheduler-dead-letter-queue.js +62 -0
- package/dist/service/scheduler/delivery/sim-scheduler-delivery-attempt.d.ts +29 -0
- package/dist/service/scheduler/delivery/sim-scheduler-delivery-attempt.js +81 -0
- package/dist/service/scheduler/delivery/sim-scheduler-delivery-function.js +9 -5
- package/dist/service/scheduler/delivery/sim-scheduler-delivery.d.ts +11 -0
- package/dist/service/scheduler/delivery/sim-scheduler-no-delivery-targets.d.ts +5 -1
- package/dist/service/scheduler/delivery/sim-scheduler-no-delivery-targets.js +8 -0
- package/dist/service/scheduler/delivery/sim-scheduler-target-delivery.d.ts +4 -1
- package/dist/service/scheduler/delivery/sim-scheduler-target-delivery.js +20 -15
- package/dist/service/scheduler/index.d.ts +1 -1
- package/dist/service/scheduler/target/sim-scheduler-dead-letter-config.d.ts +15 -0
- package/dist/service/scheduler/target/sim-scheduler-dead-letter-config.js +24 -0
- package/dist/service/scheduler/target/sim-scheduler-retry-policy.d.ts +20 -0
- package/dist/service/scheduler/target/sim-scheduler-retry-policy.js +37 -0
- package/dist/service/scheduler/target/sim-scheduler-target.d.ts +6 -0
- package/dist/service/scheduler/target/sim-scheduler-target.js +12 -0
- package/dist/service/sqs/cfn/queue/sim-cfn-sqs-queue-encryption-rules.d.ts +15 -0
- package/dist/service/sqs/cfn/queue/sim-cfn-sqs-queue-encryption-rules.js +33 -0
- package/dist/service/sqs/cfn/queue/sim-cfn-sqs-queue-properties.d.ts +16 -0
- package/dist/service/sqs/cfn/queue/sim-cfn-sqs-queue-properties.js +33 -1
- package/dist/service/sqs/cfn/queue/sim-cfn-sqs-queue-property-names.d.ts +12 -6
- package/dist/service/sqs/cfn/queue/sim-cfn-sqs-queue-property-names.js +18 -13
- package/dist/service/sqs/cfn/queue/sim-cfn-sqs-queue-property-rules.d.ts +1 -0
- package/dist/service/sqs/cfn/queue/sim-cfn-sqs-queue-property-rules.js +9 -1
- package/dist/terraform/map/sim-tf-map-sqs-redrive.d.ts +4 -3
- package/dist/terraform/map/sim-tf-map-sqs-redrive.js +4 -3
- package/docs/README.md +1 -0
- package/docs/services/backup/README.md +553 -0
- package/docs/services/cloudformation/README.md +16 -6
- package/docs/services/cloudwatch/README.md +159 -3
- package/docs/services/cognito/README.md +370 -7
- package/docs/services/lambda/README.md +28 -0
- package/docs/services/logs/README.md +284 -3
- package/docs/services/s3/README.md +463 -20
- package/docs/services/scheduler/README.md +48 -9
- package/docs/services/sqs/README.md +47 -10
- package/llms.txt +1 -0
- package/package.json +7 -2
|
@@ -9,8 +9,16 @@ Code that publishes a business metric is code teams already have, and until now
|
|
|
9
9
|
it was to assert that the SDK client had been called. That proves the call was made. What it
|
|
10
10
|
measured goes untested.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
`
|
|
12
|
+
Most of what lives here is custom metrics. Simulated Lambda publishes its own `AWS/Lambda`
|
|
13
|
+
`Invocations`, `Errors`, `Duration` and `IteratorAge`, simulated Cognito publishes a pool's
|
|
14
|
+
`AWS/Cognito` counts, and no other simulated service publishes into an `AWS/` namespace yet. A
|
|
15
|
+
query for one nothing measures comes back empty, in place of a number that was never taken. A test
|
|
16
|
+
can stand a datapoint up for one of those itself, which is what drives an alarm on a service metric
|
|
17
|
+
to a state change.
|
|
18
|
+
|
|
19
|
+
A custom metric's datapoints arrive either from `PutMetricData` or from a CloudWatch Logs metric
|
|
20
|
+
filter counting matching log events. See the [CloudWatch Logs docs](../logs/README.md) for the
|
|
21
|
+
second route.
|
|
14
22
|
|
|
15
23
|
CloudWatch specific types are imported from the `@kensio/yulin/cloudwatch` subpath.
|
|
16
24
|
|
|
@@ -143,6 +151,143 @@ console.log(read.MetricDataResults?.at(0)?.Values);
|
|
|
143
151
|
`ListMetrics` reads `RecentlyActive: "PT3H"` against the same clock, so advancing time past the
|
|
144
152
|
window drops a metric out of the listing without anything having to expire it.
|
|
145
153
|
|
|
154
|
+
## Metrics a simulated service publishes
|
|
155
|
+
|
|
156
|
+
Real CloudWatch holds two kinds of metric. A caller publishes a custom one through `PutMetricData`, and AWS publishes its own under a namespace beginning `AWS/` that no caller may write into. Both kinds are read the same way.
|
|
157
|
+
|
|
158
|
+
Two services publish their own. Simulated Cognito counts what a user pool was asked to do, under `AWS/Cognito` and dimensioned by `UserPool` and `UserPoolClient`, which the [Cognito docs](../cognito/README.md) cover.
|
|
159
|
+
|
|
160
|
+
Simulated Lambda publishes three of its own. Every invocation counts `Invocations` and a `Duration`, and one whose handler threw counts an `Errors` alongside them, all under `AWS/Lambda` and dimensioned by `FunctionName`. Nothing has to be turned on, and no execution Role needs a permission for it, which is how real Lambda behaves.
|
|
161
|
+
|
|
162
|
+
```typescript sim-cloudwatch-lambda-errors
|
|
163
|
+
/**
|
|
164
|
+
* An alarm firing on the errors a failing function counted.
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
import {
|
|
168
|
+
DescribeAlarmsCommand,
|
|
169
|
+
PutMetricAlarmCommand,
|
|
170
|
+
} from "@aws-sdk/client-cloudwatch";
|
|
171
|
+
import { CreateFunctionCommand, InvokeCommand } from "@aws-sdk/client-lambda";
|
|
172
|
+
|
|
173
|
+
import { SimAws } from "@kensio/yulin";
|
|
174
|
+
import { makeLambdaZipFileInput } from "@kensio/yulin/lambda";
|
|
175
|
+
|
|
176
|
+
const simAws = new SimAws();
|
|
177
|
+
|
|
178
|
+
await simAws.clock().setTo(new Date("2026-08-30T09:00:00Z"));
|
|
179
|
+
await simAws.lambda().createFunction(
|
|
180
|
+
new CreateFunctionCommand({
|
|
181
|
+
FunctionName: "orders",
|
|
182
|
+
Role: `arn:aws:iam::${simAws.defaultAccountId}:role/OrdersRole`,
|
|
183
|
+
Code: {
|
|
184
|
+
ZipFile: makeLambdaZipFileInput(() => {
|
|
185
|
+
throw new Error("order has no items");
|
|
186
|
+
}),
|
|
187
|
+
},
|
|
188
|
+
}),
|
|
189
|
+
);
|
|
190
|
+
await simAws.backgroundTasksComplete();
|
|
191
|
+
|
|
192
|
+
await simAws.cloudWatch().putMetricAlarm(
|
|
193
|
+
new PutMetricAlarmCommand({
|
|
194
|
+
AlarmName: "OrdersFailing",
|
|
195
|
+
Namespace: "AWS/Lambda",
|
|
196
|
+
MetricName: "Errors",
|
|
197
|
+
Dimensions: [{ Name: "FunctionName", Value: "orders" }],
|
|
198
|
+
Statistic: "Sum",
|
|
199
|
+
Period: 300,
|
|
200
|
+
EvaluationPeriods: 3,
|
|
201
|
+
DatapointsToAlarm: 1,
|
|
202
|
+
Threshold: 0,
|
|
203
|
+
ComparisonOperator: "GreaterThanThreshold",
|
|
204
|
+
TreatMissingData: "notBreaching",
|
|
205
|
+
}),
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
await simAws.lambda().invoke(new InvokeCommand({ FunctionName: "orders" }));
|
|
209
|
+
await simAws.backgroundTasksComplete();
|
|
210
|
+
await simAws.clock().advanceBy({ minutes: 6 });
|
|
211
|
+
|
|
212
|
+
const { MetricAlarms } = await simAws
|
|
213
|
+
.cloudWatch()
|
|
214
|
+
.describeAlarms(new DescribeAlarmsCommand({ AlarmNames: ["OrdersFailing"] }));
|
|
215
|
+
|
|
216
|
+
// ALARM. The invocation counted its own error.
|
|
217
|
+
console.log(MetricAlarms?.[0]?.StateValue);
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`Duration` is measured on the simulation's clock rather than the host's, so it is a number a test can assert on. A handler that moves the clock reports the time it moved, and one that returns without touching it reports nothing spent. `IteratorAge` is measured the same way, and the Lambda documentation covers what a stream event source mapping reports.
|
|
221
|
+
|
|
222
|
+
## Seeding a metric AWS publishes
|
|
223
|
+
|
|
224
|
+
`PutMetricData` refuses a namespace beginning `AWS/`, exactly as an account does. An alarm watching a metric no simulated service publishes therefore sits in `INSUFFICIENT_DATA`, and its arithmetic goes untested however carefully the alarm itself is declared.
|
|
225
|
+
|
|
226
|
+
The service writer is the way in. It is the same route simulated Lambda's own metrics take, reached from a test through `cloudWatch().serviceWriter()`, and it stands a datapoint up in any namespace.
|
|
227
|
+
|
|
228
|
+
```typescript sim-cloudwatch-seed-service-metric
|
|
229
|
+
/**
|
|
230
|
+
* Driving an alarm on a metric nothing in the simulation publishes.
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
import {
|
|
234
|
+
DescribeAlarmsCommand,
|
|
235
|
+
PutMetricAlarmCommand,
|
|
236
|
+
} from "@aws-sdk/client-cloudwatch";
|
|
237
|
+
|
|
238
|
+
import { SimAws } from "@kensio/yulin";
|
|
239
|
+
|
|
240
|
+
const simAws = new SimAws();
|
|
241
|
+
|
|
242
|
+
await simAws.clock().setTo(new Date("2026-08-30T09:00:00Z"));
|
|
243
|
+
|
|
244
|
+
await simAws.cloudWatch().putMetricAlarm(
|
|
245
|
+
new PutMetricAlarmCommand({
|
|
246
|
+
AlarmName: "SignInsThrottling",
|
|
247
|
+
Namespace: "AWS/Cognito",
|
|
248
|
+
MetricName: "SignInThrottles",
|
|
249
|
+
Dimensions: [{ Name: "UserPool", Value: "eu-west-1_pool" }],
|
|
250
|
+
Statistic: "Sum",
|
|
251
|
+
Period: 300,
|
|
252
|
+
EvaluationPeriods: 3,
|
|
253
|
+
DatapointsToAlarm: 1,
|
|
254
|
+
Threshold: 0,
|
|
255
|
+
ComparisonOperator: "GreaterThanThreshold",
|
|
256
|
+
TreatMissingData: "notBreaching",
|
|
257
|
+
}),
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
// The pool would have published this. Nothing here does, so the test does.
|
|
261
|
+
simAws
|
|
262
|
+
.cloudWatch()
|
|
263
|
+
.serviceWriter()
|
|
264
|
+
.publish([
|
|
265
|
+
{
|
|
266
|
+
namespace: "AWS/Cognito",
|
|
267
|
+
metricName: "SignInThrottles",
|
|
268
|
+
dimensions: [{ Name: "UserPool", Value: "eu-west-1_pool" }],
|
|
269
|
+
value: 4,
|
|
270
|
+
unit: "Count",
|
|
271
|
+
},
|
|
272
|
+
]);
|
|
273
|
+
|
|
274
|
+
await simAws.backgroundTasksComplete();
|
|
275
|
+
await simAws.clock().advanceBy({ minutes: 6 });
|
|
276
|
+
|
|
277
|
+
const { MetricAlarms } = await simAws
|
|
278
|
+
.cloudWatch()
|
|
279
|
+
.describeAlarms(
|
|
280
|
+
new DescribeAlarmsCommand({ AlarmNames: ["SignInsThrottling"] }),
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
// ALARM.
|
|
284
|
+
console.log(MetricAlarms?.[0]?.StateValue);
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
A datapoint arriving without a `timestamp` is stamped with the simulation's clock. One carrying its own lands where it says, which fills a window without the clock having to be walked through it.
|
|
288
|
+
|
|
289
|
+
`PutMetricData` is untouched by any of this. A caller naming a reserved namespace is refused exactly as before, and only the account's own machinery and a test reach the store this way.
|
|
290
|
+
|
|
146
291
|
## Alarms
|
|
147
292
|
|
|
148
293
|
An alarm watches one metric and changes state on the simulation's clock, with no real timer behind
|
|
@@ -392,6 +537,12 @@ await simAws.cloudWatch().putMetricData(
|
|
|
392
537
|
with evaluation on the simulation's clock and SNS notifications on a state change.
|
|
393
538
|
- IAM authorization on each action, including the `cloudwatch:namespace` condition key and
|
|
394
539
|
alarm-ARN resources.
|
|
540
|
+
- `AWS/Lambda` `Invocations`, `Errors`, `Duration` and `IteratorAge`, published by simulated Lambda
|
|
541
|
+
itself and read back the way a custom metric is.
|
|
542
|
+
- `AWS/Cognito` `SignInSuccesses`, `SignUpSuccesses`, `TokenRefreshSuccesses` and
|
|
543
|
+
`FederationSuccesses`, published by a simulated user pool.
|
|
544
|
+
- Seeding a metric AWS publishes, through `cloudWatch().serviceWriter()`, so an alarm on one can be
|
|
545
|
+
driven to a state change from a test.
|
|
395
546
|
- `AWS::CloudWatch::Alarm` in simulated CloudFormation, deployed through `PutMetricAlarm` and taken
|
|
396
547
|
down with the stack.
|
|
397
548
|
|
|
@@ -413,7 +564,12 @@ test still passes and no longer means what it says.
|
|
|
413
564
|
comes back at the period its query asked for.
|
|
414
565
|
- **Cross-account metrics.** `IncludeLinkedAccounts` and `OwningAccount` are refused. There is no
|
|
415
566
|
monitoring account.
|
|
416
|
-
- **
|
|
567
|
+
- **Most metrics AWS publishes.** The `AWS/Lambda` and `AWS/Cognito` metrics above are the only ones
|
|
568
|
+
a simulated service writes. `Throttles` and `ConcurrentExecutions` need concurrency limits, which
|
|
569
|
+
simulated Lambda has none of, and every other `AWS/` namespace needs a source event built before a
|
|
570
|
+
metric can come from one. A test seeds what it needs from one of those
|
|
571
|
+
through the service writer. A CloudWatch Logs metric filter naming a reserved namespace is refused
|
|
572
|
+
when it publishes, as `PutMetricData` refuses a caller naming one.
|
|
417
573
|
|
|
418
574
|
Two divergences are deliberate, and not refusals. Real CloudWatch rejects a datapoint more than two
|
|
419
575
|
weeks old or more than two hours in the future, and this accepts any timestamp, letting a test seed
|
|
@@ -2036,7 +2036,7 @@ so does one that signed up on the page below.
|
|
|
2036
2036
|
|
|
2037
2037
|
### The pages managed login serves
|
|
2038
2038
|
|
|
2039
|
-
A served domain answers
|
|
2039
|
+
A served domain answers six pages, so a browser in a local development server completes a whole
|
|
2040
2040
|
sign-up, password reset and sign-in without any of it being stubbed out.
|
|
2041
2041
|
|
|
2042
2042
|
`GET /oauth2/authorize` naming no `identity_provider` answers HTML holding the sign-in form. The
|
|
@@ -2046,6 +2046,25 @@ The pool's identity providers are links to the same endpoint with `identity_prov
|
|
|
2046
2046
|
way in is on the one page. Posting the form redirects to the app client's callback URL with the code
|
|
2047
2047
|
and the `state`, honouring a `code_challenge` the request carried.
|
|
2048
2048
|
|
|
2049
|
+
Following one of those provider links reaches a page standing in for the provider's own sign-in
|
|
2050
|
+
page. Real Cognito sends the browser to Google here, and nothing in this simulation calls Google, so
|
|
2051
|
+
the page asks who Google would have said is signing in. It says on its face that it is Yulin rather
|
|
2052
|
+
than the provider, twice, because somebody meeting it in a screenshot or a screen recording has to
|
|
2053
|
+
be able to tell that no real sign-in happened.
|
|
2054
|
+
|
|
2055
|
+
The page asks for the subject and for one field per claim the provider's `AttributeMapping` reads,
|
|
2056
|
+
and every field arrives filled in, so the common case is pressing the button. The address it
|
|
2057
|
+
pre-fills is on `example.com`, which is reserved, so nothing left unedited reaches a real mailbox.
|
|
2058
|
+
Editing the address is what drives a federated sign-up against a pool that already holds one of its
|
|
2059
|
+
own users at the same address, which real Cognito keeps as two accounts until
|
|
2060
|
+
`AdminLinkProviderForUser` merges them. That operation is unsimulated.
|
|
2061
|
+
|
|
2062
|
+
Posting the page carries on into the sign-in the authorize endpoint already runs, ending in the same
|
|
2063
|
+
`<ProviderName>_<subject>` user and the same authorization code. Nothing is kept on the provider
|
|
2064
|
+
afterwards: a further authorize request asks again, because real Cognito asks the provider afresh
|
|
2065
|
+
every time. A provider that `signInAs` has already put somebody at skips the page, which is what
|
|
2066
|
+
leaves a test that says who is signing in seeing none of this.
|
|
2067
|
+
|
|
2049
2068
|
`/signup` is a link from that page. Its form asks for a username, a password and the attributes the
|
|
2050
2069
|
pool needs, which are the ones its `Schema` made required and the ones its `AutoVerifiedAttributes`
|
|
2051
2070
|
names. Posting it does what `SignUp` does and sends the browser to `/confirm`.
|
|
@@ -2752,6 +2771,171 @@ try {
|
|
|
2752
2771
|
Cognito. Neither fires for `REFRESH_TOKEN_AUTH`, as neither does on real Cognito, where
|
|
2753
2772
|
`PreTokenGeneration` does.
|
|
2754
2773
|
|
|
2774
|
+
A sign-in at the hosted domain runs `PreAuthentication` too, under the same
|
|
2775
|
+
`PreAuthentication_Authentication` source real Cognito reports it from `/login`. It runs for a
|
|
2776
|
+
password and for a passkey, once per sign-in, before the password is checked. A handler that throws
|
|
2777
|
+
refuses the sign-in, and a served domain draws that refusal on the sign-in form the way it draws a
|
|
2778
|
+
wrong password. A browser coming back on the managed login session it already holds runs nothing,
|
|
2779
|
+
because the `PreAuthentication` docs say the trigger does not activate on the renewal of a session
|
|
2780
|
+
that already exists.
|
|
2781
|
+
|
|
2782
|
+
`PostAuthentication` stays unfired at the hosted domain. AWS names it for a federated sign-in and
|
|
2783
|
+
leaves it out of the table for a local user at managed login, and what real Cognito does there was
|
|
2784
|
+
not checked against a live account.
|
|
2785
|
+
|
|
2786
|
+
### Federated sign-in triggers
|
|
2787
|
+
|
|
2788
|
+
A user arriving from an identity provider runs the pool's triggers too, and which ones it runs
|
|
2789
|
+
depends on whether the pool has met the subject before. AWS documents the split, and this is what it
|
|
2790
|
+
comes to:
|
|
2791
|
+
|
|
2792
|
+
| Sign-in event | Trigger | Source |
|
|
2793
|
+
| -------------- | -------------------- | ----------------------------------- |
|
|
2794
|
+
| First sign-in | `PreSignUp` | `PreSignUp_ExternalProvider` |
|
|
2795
|
+
| | `PostConfirmation` | `PostConfirmation_ConfirmSignUp` |
|
|
2796
|
+
| | `PreTokenGeneration` | `TokenGeneration_HostedAuth` |
|
|
2797
|
+
| Later sign-ins | `PreAuthentication` | `PreAuthentication_Authentication` |
|
|
2798
|
+
| | `PostAuthentication` | `PostAuthentication_Authentication` |
|
|
2799
|
+
| | `PreTokenGeneration` | `TokenGeneration_HostedAuth` |
|
|
2800
|
+
|
|
2801
|
+
That split is what an application hangs its own user record off. `PostConfirmation` runs the first
|
|
2802
|
+
time a Google user arrives and never again, which is the same place a local sign-up's record is
|
|
2803
|
+
written from, so one handler covers both ways in.
|
|
2804
|
+
|
|
2805
|
+
```typescript sim-cognito-federated-triggers
|
|
2806
|
+
/**
|
|
2807
|
+
* A PostConfirmation trigger that runs on a federated user's first sign-in.
|
|
2808
|
+
*/
|
|
2809
|
+
|
|
2810
|
+
import {
|
|
2811
|
+
CreateIdentityProviderCommand,
|
|
2812
|
+
CreateUserPoolClientCommand,
|
|
2813
|
+
CreateUserPoolCommand,
|
|
2814
|
+
CreateUserPoolDomainCommand,
|
|
2815
|
+
} from "@aws-sdk/client-cognito-identity-provider";
|
|
2816
|
+
import {
|
|
2817
|
+
AddPermissionCommand,
|
|
2818
|
+
CreateFunctionCommand,
|
|
2819
|
+
} from "@aws-sdk/client-lambda";
|
|
2820
|
+
|
|
2821
|
+
import { SimAws } from "@kensio/yulin";
|
|
2822
|
+
import { makeLambdaZipFileInput } from "@kensio/yulin/lambda";
|
|
2823
|
+
|
|
2824
|
+
/**
|
|
2825
|
+
* The part of the PostConfirmation event this handler reads.
|
|
2826
|
+
*/
|
|
2827
|
+
interface PostConfirmationEvent {
|
|
2828
|
+
readonly triggerSource: string;
|
|
2829
|
+
readonly userName: string;
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
const written: string[] = [];
|
|
2833
|
+
|
|
2834
|
+
// A record is written here. A deployed handler writes it to DynamoDB.
|
|
2835
|
+
const postConfirmation = (event: PostConfirmationEvent): unknown => {
|
|
2836
|
+
written.push(`${event.triggerSource} ${event.userName}`);
|
|
2837
|
+
|
|
2838
|
+
return event;
|
|
2839
|
+
};
|
|
2840
|
+
|
|
2841
|
+
const simAws = new SimAws({ defaultRegionName: "eu-west-2" });
|
|
2842
|
+
const lambda = simAws.lambda();
|
|
2843
|
+
const cognito = simAws.cognitoIdentityProvider();
|
|
2844
|
+
const callbackUrl = "https://www.example.com/user/callback";
|
|
2845
|
+
|
|
2846
|
+
// The function comes first, because the pool names it by ARN.
|
|
2847
|
+
const functionArn =
|
|
2848
|
+
`arn:aws:lambda:eu-west-2:${simAws.defaultAccountId}` +
|
|
2849
|
+
`:function:post-confirmation`;
|
|
2850
|
+
await lambda.createFunction(
|
|
2851
|
+
new CreateFunctionCommand({
|
|
2852
|
+
FunctionName: "post-confirmation",
|
|
2853
|
+
Role: `arn:aws:iam::${simAws.defaultAccountId}:role/TriggerRole`,
|
|
2854
|
+
Code: { ZipFile: makeLambdaZipFileInput(postConfirmation) },
|
|
2855
|
+
}),
|
|
2856
|
+
);
|
|
2857
|
+
|
|
2858
|
+
const created = await cognito.createUserPool(
|
|
2859
|
+
new CreateUserPoolCommand({
|
|
2860
|
+
PoolName: "myapp-users",
|
|
2861
|
+
LambdaConfig: { PostConfirmation: functionArn },
|
|
2862
|
+
}),
|
|
2863
|
+
);
|
|
2864
|
+
const userPoolId = created.UserPool?.Id ?? "";
|
|
2865
|
+
|
|
2866
|
+
// The permission a CDK `addTrigger` emits, which lets Cognito invoke it.
|
|
2867
|
+
await lambda.addPermission(
|
|
2868
|
+
new AddPermissionCommand({
|
|
2869
|
+
FunctionName: "post-confirmation",
|
|
2870
|
+
StatementId: "AllowCognito",
|
|
2871
|
+
Action: "lambda:InvokeFunction",
|
|
2872
|
+
Principal: "cognito-idp.amazonaws.com",
|
|
2873
|
+
SourceArn: created.UserPool?.Arn,
|
|
2874
|
+
}),
|
|
2875
|
+
);
|
|
2876
|
+
|
|
2877
|
+
await cognito.createIdentityProvider(
|
|
2878
|
+
new CreateIdentityProviderCommand({
|
|
2879
|
+
UserPoolId: userPoolId,
|
|
2880
|
+
ProviderName: "Google",
|
|
2881
|
+
ProviderType: "Google",
|
|
2882
|
+
ProviderDetails: {
|
|
2883
|
+
client_id: "google-client-id",
|
|
2884
|
+
client_secret: "google-client-secret",
|
|
2885
|
+
authorize_scopes: "openid email",
|
|
2886
|
+
},
|
|
2887
|
+
AttributeMapping: { email: "email" },
|
|
2888
|
+
}),
|
|
2889
|
+
);
|
|
2890
|
+
|
|
2891
|
+
const client = await cognito.createUserPoolClient(
|
|
2892
|
+
new CreateUserPoolClientCommand({
|
|
2893
|
+
UserPoolId: userPoolId,
|
|
2894
|
+
ClientName: "web",
|
|
2895
|
+
AllowedOAuthFlowsUserPoolClient: true,
|
|
2896
|
+
AllowedOAuthFlows: ["code"],
|
|
2897
|
+
AllowedOAuthScopes: ["openid", "email"],
|
|
2898
|
+
CallbackURLs: [callbackUrl],
|
|
2899
|
+
SupportedIdentityProviders: ["Google"],
|
|
2900
|
+
}),
|
|
2901
|
+
);
|
|
2902
|
+
|
|
2903
|
+
await cognito.createUserPoolDomain(
|
|
2904
|
+
new CreateUserPoolDomainCommand({
|
|
2905
|
+
UserPoolId: userPoolId,
|
|
2906
|
+
Domain: "myapp-login",
|
|
2907
|
+
}),
|
|
2908
|
+
);
|
|
2909
|
+
|
|
2910
|
+
const pool = cognito.userPool(userPoolId);
|
|
2911
|
+
|
|
2912
|
+
pool.auth.identityProviders.require("Google").signInAs({
|
|
2913
|
+
Subject: "108412093487519382745",
|
|
2914
|
+
Claims: { email: "someone@example.com" },
|
|
2915
|
+
});
|
|
2916
|
+
|
|
2917
|
+
const authorize = {
|
|
2918
|
+
response_type: "code",
|
|
2919
|
+
client_id: client.UserPoolClient?.ClientId ?? "",
|
|
2920
|
+
redirect_uri: callbackUrl,
|
|
2921
|
+
identity_provider: "Google",
|
|
2922
|
+
};
|
|
2923
|
+
|
|
2924
|
+
// The first sign-in creates the pool's user for the subject.
|
|
2925
|
+
await cognito.hostedAuthorize(pool, authorize);
|
|
2926
|
+
console.log(written);
|
|
2927
|
+
// ["PostConfirmation_ConfirmSignUp Google_108412093487519382745"]
|
|
2928
|
+
|
|
2929
|
+
// The second reaches the same user, and the sign-up triggers stay unfired.
|
|
2930
|
+
await cognito.hostedAuthorize(pool, authorize);
|
|
2931
|
+
console.log(written.length); // 1
|
|
2932
|
+
```
|
|
2933
|
+
|
|
2934
|
+
A handler that throws from `PreSignUp` refuses the sign-in, and the pool is left without the user,
|
|
2935
|
+
because that trigger runs before the user is added. `autoVerifyEmail` and `autoVerifyPhone` are
|
|
2936
|
+
applied the way they are for a sign-up. `autoConfirmUser` has nothing to do, as a federated user is
|
|
2937
|
+
created in `EXTERNAL_PROVIDER` and never passes through `UNCONFIRMED`.
|
|
2938
|
+
|
|
2755
2939
|
### The event, and what a failure gets back
|
|
2756
2940
|
|
|
2757
2941
|
Every event carries `version`, `region`, `userPoolId`, `userName`, the `triggerSource` naming the
|
|
@@ -3010,6 +3194,151 @@ and the timestamps on tokens issued after it, but a verifier reading the host cl
|
|
|
3010
3194
|
token it already holds by host time. Signing in in the past is what produces a token such a verifier
|
|
3011
3195
|
refuses.
|
|
3012
3196
|
|
|
3197
|
+
## What a pool counts in CloudWatch
|
|
3198
|
+
|
|
3199
|
+
A pool publishes into `AWS/Cognito` what real Cognito publishes about the requests it handles, dimensioned by `UserPool` and `UserPoolClient`. Nothing has to be turned on for it, and no caller needs a permission. Real Cognito behaves the same way.
|
|
3200
|
+
|
|
3201
|
+
Four counts are kept. `SignInSuccesses` counts every authentication request, `SignUpSuccesses` every registration, `TokenRefreshSuccesses` every renewal from a refresh token, and `FederationSuccesses` every sign-in through an identity provider. Each is a 1 where the request issued tokens and a 0 where it did not, so `Sum` is how many succeeded, `SampleCount` is how many were made, and `Average` between them is the success rate. That is how the AWS documentation says to read them.
|
|
3202
|
+
|
|
3203
|
+
```typescript sim-cognito-metrics
|
|
3204
|
+
/**
|
|
3205
|
+
* An alarm on the rate at which a pool is turning sign-ins away.
|
|
3206
|
+
*/
|
|
3207
|
+
|
|
3208
|
+
import {
|
|
3209
|
+
DescribeAlarmsCommand,
|
|
3210
|
+
PutMetricAlarmCommand,
|
|
3211
|
+
} from "@aws-sdk/client-cloudwatch";
|
|
3212
|
+
import { InitiateAuthCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
3213
|
+
|
|
3214
|
+
import type { SimAws } from "@kensio/yulin";
|
|
3215
|
+
|
|
3216
|
+
declare const simAws: SimAws;
|
|
3217
|
+
declare const userPoolId: string;
|
|
3218
|
+
declare const clientId: string;
|
|
3219
|
+
|
|
3220
|
+
await simAws.cloudWatch().putMetricAlarm(
|
|
3221
|
+
new PutMetricAlarmCommand({
|
|
3222
|
+
AlarmName: "SignInsFailing",
|
|
3223
|
+
Namespace: "AWS/Cognito",
|
|
3224
|
+
MetricName: "SignInSuccesses",
|
|
3225
|
+
Dimensions: [
|
|
3226
|
+
{ Name: "UserPool", Value: userPoolId },
|
|
3227
|
+
{ Name: "UserPoolClient", Value: clientId },
|
|
3228
|
+
],
|
|
3229
|
+
Statistic: "Average",
|
|
3230
|
+
Period: 300,
|
|
3231
|
+
EvaluationPeriods: 3,
|
|
3232
|
+
DatapointsToAlarm: 1,
|
|
3233
|
+
Threshold: 0.5,
|
|
3234
|
+
ComparisonOperator: "LessThanThreshold",
|
|
3235
|
+
TreatMissingData: "notBreaching",
|
|
3236
|
+
}),
|
|
3237
|
+
);
|
|
3238
|
+
|
|
3239
|
+
// Two of these three fail, so the average falls under the threshold.
|
|
3240
|
+
for (const password of ["Wr0ng!", "AlsoWr0ng!", "Sup3rSecret!"]) {
|
|
3241
|
+
const attempt = new InitiateAuthCommand({
|
|
3242
|
+
ClientId: clientId,
|
|
3243
|
+
AuthFlow: "USER_PASSWORD_AUTH",
|
|
3244
|
+
AuthParameters: { USERNAME: "alice", PASSWORD: password },
|
|
3245
|
+
});
|
|
3246
|
+
|
|
3247
|
+
try {
|
|
3248
|
+
await simAws.cognitoIdentityProvider().initiateAuth(attempt);
|
|
3249
|
+
} catch {
|
|
3250
|
+
// A refused sign-in is counted as a zero rather than going uncounted.
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
await simAws.backgroundTasksComplete();
|
|
3255
|
+
await simAws.clock().advanceBy({ minutes: 6 });
|
|
3256
|
+
|
|
3257
|
+
const { MetricAlarms } = await simAws
|
|
3258
|
+
.cloudWatch()
|
|
3259
|
+
.describeAlarms(
|
|
3260
|
+
new DescribeAlarmsCommand({ AlarmNames: ["SignInsFailing"] }),
|
|
3261
|
+
);
|
|
3262
|
+
|
|
3263
|
+
// ALARM.
|
|
3264
|
+
console.log(MetricAlarms?.[0]?.StateValue);
|
|
3265
|
+
```
|
|
3266
|
+
|
|
3267
|
+
Two `UserPoolClient` values are fixed names rather than ids. A user an administrator registers through `AdminCreateUser` reaches the pool through no app client and counts against `Admin`. An admin authentication request naming a client the pool has none of counts against `Invalid`, and the id it gave is left out.
|
|
3268
|
+
|
|
3269
|
+
A token refresh stays out of `SignInSuccesses` and lands in `TokenRefreshSuccesses`, whether it arrived as a `REFRESH_TOKEN_AUTH` flow or as `GetTokensFromRefreshToken`. A federated sign-in counts where its tokens are issued, at the token endpoint, rather than at the authorization code the provider sent the browser back with.
|
|
3270
|
+
|
|
3271
|
+
### Turning requests away
|
|
3272
|
+
|
|
3273
|
+
Real Cognito turns a request away when the account has gone over a rate limit, answering `TooManyRequestsException` and counting a `*Throttles` beside the `*Successes` it counts a 0 in. Those limits belong to the account and are mostly undocumented. Working one out here would be inventing a number, and a test asserting against an invented number proves little about a real pool. A test says how many requests a pool should turn away instead, and the pool turns away that many.
|
|
3274
|
+
|
|
3275
|
+
```typescript sim-cognito-throttles
|
|
3276
|
+
/**
|
|
3277
|
+
* An alarm on the sign-ins a pool is turning away.
|
|
3278
|
+
*/
|
|
3279
|
+
|
|
3280
|
+
import {
|
|
3281
|
+
DescribeAlarmsCommand,
|
|
3282
|
+
PutMetricAlarmCommand,
|
|
3283
|
+
} from "@aws-sdk/client-cloudwatch";
|
|
3284
|
+
import { InitiateAuthCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
3285
|
+
|
|
3286
|
+
import type { SimAws } from "@kensio/yulin";
|
|
3287
|
+
|
|
3288
|
+
declare const simAws: SimAws;
|
|
3289
|
+
declare const userPoolId: string;
|
|
3290
|
+
declare const clientId: string;
|
|
3291
|
+
|
|
3292
|
+
await simAws.cloudWatch().putMetricAlarm(
|
|
3293
|
+
new PutMetricAlarmCommand({
|
|
3294
|
+
AlarmName: "SignInsThrottling",
|
|
3295
|
+
Namespace: "AWS/Cognito",
|
|
3296
|
+
MetricName: "SignInThrottles",
|
|
3297
|
+
Dimensions: [
|
|
3298
|
+
{ Name: "UserPool", Value: userPoolId },
|
|
3299
|
+
{ Name: "UserPoolClient", Value: clientId },
|
|
3300
|
+
],
|
|
3301
|
+
Statistic: "Sum",
|
|
3302
|
+
Period: 300,
|
|
3303
|
+
EvaluationPeriods: 3,
|
|
3304
|
+
DatapointsToAlarm: 1,
|
|
3305
|
+
Threshold: 0,
|
|
3306
|
+
ComparisonOperator: "GreaterThanThreshold",
|
|
3307
|
+
TreatMissingData: "notBreaching",
|
|
3308
|
+
}),
|
|
3309
|
+
);
|
|
3310
|
+
|
|
3311
|
+
const cognito = simAws.cognitoIdentityProvider();
|
|
3312
|
+
|
|
3313
|
+
cognito.userPool(userPoolId).auth.throttle.signIns(1);
|
|
3314
|
+
|
|
3315
|
+
try {
|
|
3316
|
+
await cognito.initiateAuth(
|
|
3317
|
+
new InitiateAuthCommand({
|
|
3318
|
+
ClientId: clientId,
|
|
3319
|
+
AuthFlow: "USER_PASSWORD_AUTH",
|
|
3320
|
+
AuthParameters: { USERNAME: "alice", PASSWORD: "Sup3rSecret!" },
|
|
3321
|
+
}),
|
|
3322
|
+
);
|
|
3323
|
+
} catch {
|
|
3324
|
+
// TooManyRequestsException, counted in SignInThrottles.
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
await simAws.backgroundTasksComplete();
|
|
3328
|
+
await simAws.clock().advanceBy({ minutes: 6 });
|
|
3329
|
+
|
|
3330
|
+
const { MetricAlarms } = await simAws
|
|
3331
|
+
.cloudWatch()
|
|
3332
|
+
.describeAlarms(
|
|
3333
|
+
new DescribeAlarmsCommand({ AlarmNames: ["SignInsThrottling"] }),
|
|
3334
|
+
);
|
|
3335
|
+
|
|
3336
|
+
// ALARM.
|
|
3337
|
+
console.log(MetricAlarms?.[0]?.StateValue);
|
|
3338
|
+
```
|
|
3339
|
+
|
|
3340
|
+
`signUps`, `tokenRefreshes` and `federations` sit beside `signIns` on the same object, and each turns away only its own kind of request. A pool answers normally until a test asks it to turn requests away, and it goes back to answering normally once it has turned away the number it was given.
|
|
3341
|
+
|
|
3013
3342
|
## Pool ARNs and IAM policies
|
|
3014
3343
|
|
|
3015
3344
|
A pool ARN is the pool id after `userpool/`, and the region appears twice:
|
|
@@ -4513,9 +4842,17 @@ Sim Cognito currently supports:
|
|
|
4513
4842
|
- A served sign-in form at `/oauth2/authorize`, a sign-up form at `/signup`, a confirmation form at
|
|
4514
4843
|
`/confirm`, and the two password reset forms at `/forgotPassword` and `/confirmForgotPassword`,
|
|
4515
4844
|
each carrying the authorize parameters through to the next
|
|
4845
|
+
- A served stand-in for an identity provider's own sign-in page, so a browser completes a federated
|
|
4846
|
+
sign-in on a local development server, with the subject and the mapped claims pre-filled and
|
|
4847
|
+
editable
|
|
4516
4848
|
- The pool user a federated sign-in creates, named `<ProviderName>_<subject>`, in the
|
|
4517
4849
|
`EXTERNAL_PROVIDER` status, carrying the `identities` attribute and claim and the attributes the
|
|
4518
4850
|
provider's `AttributeMapping` named
|
|
4851
|
+
- The triggers a federated sign-in runs, being `PreSignUp` and `PostConfirmation` on a first
|
|
4852
|
+
sign-in, `PreAuthentication` and `PostAuthentication` on every one after it, and
|
|
4853
|
+
`PreTokenGeneration` under `TokenGeneration_HostedAuth` when the code is exchanged
|
|
4854
|
+
- The `PreAuthentication` trigger a local user's managed login sign-in runs, for a password and for
|
|
4855
|
+
a passkey alike, with a handler's refusal drawn on the sign-in form
|
|
4519
4856
|
- A `REGIONAL` web ACL in front of the pool, attached by `AssociateWebACL` on simulated WAFv2 and
|
|
4520
4857
|
evaluated against every request the hosted domain and the two `.well-known` documents answer
|
|
4521
4858
|
- App client OAuth settings: `AllowedOAuthFlowsUserPoolClient`, `AllowedOAuthFlows`,
|
|
@@ -4546,6 +4883,12 @@ Sim Cognito currently supports:
|
|
|
4546
4883
|
|
|
4547
4884
|
Current documented limitations:
|
|
4548
4885
|
|
|
4886
|
+
- `SignInSuccesses`, `SignUpSuccesses`, `TokenRefreshSuccesses`, `FederationSuccesses` and the four
|
|
4887
|
+
`*Throttles` beside them are the `AWS/Cognito` metrics a pool publishes. No rate limit works
|
|
4888
|
+
itself out here. A pool turns a request away only where a test has told it to. `CallCount` and
|
|
4889
|
+
`ThrottleCount` under `AWS/Usage` are absent. A client-side request naming an app client the pool
|
|
4890
|
+
has none of counts nothing at all, because the app client id is what finds the pool and an unknown
|
|
4891
|
+
one reaches no pool to report against.
|
|
4549
4892
|
- Five authentication flows run: `ADMIN_USER_PASSWORD_AUTH` and `REFRESH_TOKEN_AUTH` through
|
|
4550
4893
|
`AdminInitiateAuth`, `USER_PASSWORD_AUTH` and `REFRESH_TOKEN_AUTH` through `InitiateAuth`, and
|
|
4551
4894
|
`USER_AUTH` through either. SRP, custom authentication and device tracking are outside the
|
|
@@ -4754,9 +5097,9 @@ Current documented limitations:
|
|
|
4754
5097
|
and `CustomMessage` are the only Lambda triggers that run. Every other `LambdaConfig` key is
|
|
4755
5098
|
refused when the pool is created or updated, naming the trigger, because a pool that accepted one
|
|
4756
5099
|
would never call the function the template named. The custom challenge triggers would need a
|
|
4757
|
-
challenge loop this simulation lacks, and the migration and federation triggers have no
|
|
4758
|
-
directory to reach. A simulated identity provider answers with the user `signInAs` put
|
|
4759
|
-
beyond the reach of a trigger.
|
|
5100
|
+
challenge loop this simulation lacks, and the migration and inbound federation triggers have no
|
|
5101
|
+
external directory to reach. A simulated identity provider answers with the user `signInAs` put
|
|
5102
|
+
there, beyond the reach of a trigger.
|
|
4760
5103
|
- `AdminCreateUser` leaves `PostConfirmation` unfired, here and on real Cognito. It is the tempting
|
|
4761
5104
|
place to hang the trigger and the wrong one. A project relying on it would pass here and write no
|
|
4762
5105
|
record in production.
|
|
@@ -4766,8 +5109,25 @@ Current documented limitations:
|
|
|
4766
5109
|
- A `PreSignUp` handler asking to verify an attribute the sign-up did not carry refuses the sign-up
|
|
4767
5110
|
with `InvalidParameterException`. Real Cognito refuses it too, and what it names the error has not
|
|
4768
5111
|
been checked against a live account.
|
|
4769
|
-
-
|
|
4770
|
-
|
|
5112
|
+
- A federated first sign-in reports `PreSignUp_ExternalProvider` and then
|
|
5113
|
+
`PostConfirmation_ConfirmSignUp`, and every sign-in after it reports
|
|
5114
|
+
`PreAuthentication_Authentication` and `PostAuthentication_Authentication`. That is the split AWS
|
|
5115
|
+
documents for a federated user, and it is what makes a handler that hangs a profile record off a
|
|
5116
|
+
first sign-in run once for a Google user.
|
|
5117
|
+
- `autoConfirmUser` has nothing to do on a federated sign-in. The user is created in
|
|
5118
|
+
`EXTERNAL_PROVIDER` and never passes through `UNCONFIRMED`, so there is no confirmation for a
|
|
5119
|
+
handler to skip. `autoVerifyEmail` and `autoVerifyPhone` are applied there as they are for a
|
|
5120
|
+
sign-up.
|
|
5121
|
+
- A local user signing in at managed login runs `PreAuthentication` and leaves `PostAuthentication`
|
|
5122
|
+
unfired. The documented table names the first for `/login` and the second only for a federated
|
|
5123
|
+
sign-in, and what real Cognito does with the second there was not checked against a live account.
|
|
5124
|
+
- A browser signed in from the managed login session it was already holding runs no sign-in trigger,
|
|
5125
|
+
which is what the `PreAuthentication` docs say of a renewed session.
|
|
5126
|
+
- A code exchanged at the token endpoint reports `TokenGeneration_HostedAuth` where the sign-in
|
|
5127
|
+
happened at an identity provider, and `TokenGeneration_Authentication` where the pool signed in
|
|
5128
|
+
one of its own users. Real Cognito reports the same two. A browser signed in from the managed
|
|
5129
|
+
login session it was already holding reports the local source whichever way that session started,
|
|
5130
|
+
because the session records nothing about the method that began it.
|
|
4771
5131
|
- A `PostConfirmation` or `PostAuthentication` handler that throws fails the request, and what it
|
|
4772
5132
|
ran after stands. A confirmed user stays confirmed and the tokens a pool issued stay issued, as
|
|
4773
5133
|
they do on real Cognito.
|
|
@@ -4875,7 +5235,10 @@ Current documented limitations:
|
|
|
4875
5235
|
`userinfo_endpoint`, where real Cognito names one.
|
|
4876
5236
|
- Nothing calls an external identity provider. A provider's `ProviderDetails` are recorded and
|
|
4877
5237
|
validated for presence, and never used. The user a simulated provider signs in is the one
|
|
4878
|
-
`signInAs` put there
|
|
5238
|
+
`signInAs` put there, or the one the served stand-in page for that provider posted back. Both are
|
|
5239
|
+
divergences for the same reason `confirmationCode` is one.
|
|
5240
|
+
- The stand-in page is served, and an authorize request that reaches `hostedAuthorize` directly is
|
|
5241
|
+
refused instead, naming `signInAs`. Only the serving layer can answer a caller with a page.
|
|
4879
5242
|
- A custom domain answers on its own hostname with no Route53 record of its own, where real AWS
|
|
4880
5243
|
needs an alias record to the CloudFront distribution Cognito creates. The distribution name a
|
|
4881
5244
|
domain reports is a name unserved here.
|
|
@@ -2748,6 +2748,34 @@ otherwise. A time read at module scope is therefore read too early, exactly as i
|
|
|
2748
2748
|
variables. See [simulated time](https://yulinsim.dev/time/) for the whole picture, including where real
|
|
2749
2749
|
AWS puts the time on the event.
|
|
2750
2750
|
|
|
2751
|
+
## What an invocation counts in CloudWatch
|
|
2752
|
+
|
|
2753
|
+
Every invocation publishes `Invocations` and a `Duration` into `AWS/Lambda`, dimensioned by
|
|
2754
|
+
`FunctionName`. One whose handler threw publishes an `Errors` beside them. Real Lambda counts a
|
|
2755
|
+
failed invocation under both, so an alarm reading one against the other gets a failure rate.
|
|
2756
|
+
|
|
2757
|
+
Nothing has to be turned on for it, and the execution Role needs no permission, which is how real
|
|
2758
|
+
Lambda behaves. An alarm on `AWS/Lambda` `Errors` can therefore be driven to a state change by
|
|
2759
|
+
invoking a function that fails, rather than by publishing a datapoint by hand. `PutMetricData` still
|
|
2760
|
+
refuses the `AWS/Lambda` namespace, exactly as an account does. See the
|
|
2761
|
+
[CloudWatch docs](../cloudwatch/README.md) for an alarm reading these.
|
|
2762
|
+
|
|
2763
|
+
`Duration` is measured on the simulation's clock. A handler that moves the clock reports the time it
|
|
2764
|
+
moved, and one that returns without touching it reports nothing spent.
|
|
2765
|
+
|
|
2766
|
+
A stream event source mapping publishes `IteratorAge` as well, in milliseconds, once a batch of
|
|
2767
|
+
DynamoDB Streams or Kinesis records has been handled. It is the distance between the newest record
|
|
2768
|
+
in the batch and the moment the batch finished, measured on the simulation's clock. A test that lets
|
|
2769
|
+
records age before anything reads them gets back the interval it let pass. A batch whose handler
|
|
2770
|
+
threw is counted too, because the retry leaves the function further behind rather than caught up. A
|
|
2771
|
+
queue mapping publishes none of it, and neither does a direct invocation.
|
|
2772
|
+
|
|
2773
|
+
`Throttles` and `ConcurrentExecutions` are absent. Both count what a concurrency limit turned away,
|
|
2774
|
+
and this simulation applies none.
|
|
2775
|
+
|
|
2776
|
+
A function built outside a `SimAws` instance has no simulated CloudWatch to publish into. It runs and
|
|
2777
|
+
counts nothing.
|
|
2778
|
+
|
|
2751
2779
|
## CloudFormation functions
|
|
2752
2780
|
|
|
2753
2781
|
Sim CloudFormation can create Lambda functions from `AWS::Lambda::Function`, typically alongside a
|