@fjall/components-infrastructure 39.2.3 → 40.0.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/LICENSE +2 -0
- package/README.md +46 -0
- package/dist/lib/app.d.ts +98 -39
- package/dist/lib/app.js +253 -40
- package/dist/lib/config/aws/accountAuditRole.d.ts +16 -4
- package/dist/lib/config/aws/accountAuditRole.js +50 -12
- package/dist/lib/config/aws/accountMonitoringRole.d.ts +7 -1
- package/dist/lib/config/aws/accountMonitoringRole.js +23 -12
- package/dist/lib/config/aws/alarmTopic.d.ts +4 -9
- package/dist/lib/config/aws/alarmTopic.js +20 -17
- package/dist/lib/config/aws/cloudTrail.d.ts +9 -3
- package/dist/lib/config/aws/cloudTrail.js +27 -9
- package/dist/lib/config/aws/configRecorder.js +5 -1
- package/dist/lib/config/aws/configRulePreset.d.ts +2 -1
- package/dist/lib/config/aws/configRulePreset.js +89 -23
- package/dist/lib/config/aws/deployBoundarySingleton.d.ts +6 -1
- package/dist/lib/config/aws/deployBoundarySingleton.js +8 -2
- package/dist/lib/config/aws/disasterRecovery.d.ts +13 -5
- package/dist/lib/config/aws/disasterRecovery.js +365 -108
- package/dist/lib/config/aws/ebsDefaultEncryption.js +3 -2
- package/dist/lib/config/aws/ecrDefaultImage.js +7 -8
- package/dist/lib/config/aws/fjallBackupRole.d.ts +25 -0
- package/dist/lib/config/aws/fjallBackupRole.js +50 -0
- package/dist/lib/config/aws/identityCenter.d.ts +22 -16
- package/dist/lib/config/aws/identityCenter.js +148 -143
- package/dist/lib/config/aws/identityCentreConfig/builtInOverlap.d.ts +29 -0
- package/dist/lib/config/aws/identityCentreConfig/builtInOverlap.js +120 -0
- package/dist/lib/config/aws/identityCentreConfig/defaults.d.ts +135 -0
- package/dist/lib/config/aws/identityCentreConfig/defaults.js +229 -0
- package/dist/lib/config/aws/identityCentreConfig/derivations.d.ts +79 -0
- package/dist/lib/config/aws/identityCentreConfig/derivations.js +140 -0
- package/dist/lib/config/aws/identityCentreConfig/refusalNames.d.ts +25 -0
- package/dist/lib/config/aws/identityCentreConfig/refusalNames.js +59 -0
- package/dist/lib/config/aws/identityCentreConfig/setContract.d.ts +14 -0
- package/dist/lib/config/aws/identityCentreConfig/setContract.js +39 -0
- package/dist/lib/config/aws/identityCentreConfig/types.d.ts +22 -0
- package/dist/lib/config/aws/identityCentreConfig/types.js +10 -0
- package/dist/lib/config/aws/identityCentreConfig/validate.d.ts +32 -0
- package/dist/lib/config/aws/identityCentreConfig/validate.js +266 -0
- package/dist/lib/config/aws/identityCentreConfig.d.ts +11 -141
- package/dist/lib/config/aws/identityCentreConfig.js +10 -343
- package/dist/lib/config/aws/inspectorEnablement.d.ts +6 -3
- package/dist/lib/config/aws/inspectorEnablement.js +280 -28
- package/dist/lib/config/aws/ipam.js +8 -4
- package/dist/lib/config/aws/oidcConnector.d.ts +5 -0
- package/dist/lib/config/aws/oidcConnector.js +29 -10
- package/dist/lib/config/aws/organisationTrail.js +9 -5
- package/dist/lib/config/aws/s3BlockPublicAccess.d.ts +3 -0
- package/dist/lib/config/aws/s3BlockPublicAccess.js +8 -4
- package/dist/lib/config/aws/scpPreset.d.ts +18 -11
- package/dist/lib/config/aws/scpPreset.js +209 -77
- package/dist/lib/config/aws/securityHubHub.js +14 -6
- package/dist/lib/config/aws/securityServicesAdmin.js +8 -5
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/lambda-assets/buildkite-controller/asset/THIRD-PARTY-NOTICES.txt +1606 -0
- package/dist/lib/lambda-assets/buildkite-controller/asset/index.js +112 -0
- package/dist/lib/lambda-assets/buildkite-controller/asset/package.json +4 -0
- package/dist/lib/lambda-assets/buildkite-dispatch/asset/THIRD-PARTY-NOTICES.txt +1600 -0
- package/dist/lib/lambda-assets/buildkite-dispatch/asset/index.js +108 -0
- package/dist/lib/lambda-assets/buildkite-dispatch/asset/package.json +4 -0
- package/dist/lib/lambda-assets/buildkite-finish-watcher/asset/THIRD-PARTY-NOTICES.txt +1600 -0
- package/dist/lib/lambda-assets/buildkite-finish-watcher/asset/index.js +132 -0
- package/dist/lib/lambda-assets/buildkite-finish-watcher/asset/package.json +4 -0
- package/dist/lib/lambda-assets/buildkite-token-expiry/asset/THIRD-PARTY-NOTICES.txt +1330 -0
- package/dist/lib/lambda-assets/buildkite-token-expiry/asset/index.js +110 -0
- package/dist/lib/lambda-assets/buildkite-token-expiry/asset/package.json +4 -0
- package/dist/lib/lambda-assets/cert-generator/asset/THIRD-PARTY-NOTICES.txt +1637 -0
- package/dist/lib/lambda-assets/cert-generator/asset/index.js +71 -18122
- package/dist/lib/lambda-assets/identity-store-user/asset/THIRD-PARTY-NOTICES.txt +1302 -0
- package/dist/lib/lambda-assets/identity-store-user/asset/index.js +47 -198
- package/dist/lib/lambda-assets/static-site-forms/asset/THIRD-PARTY-NOTICES.txt +1302 -0
- package/dist/lib/lambda-assets/static-site-forms/asset/index.js +48 -175
- package/dist/lib/lambda-assets/validation-record-repairer/asset/THIRD-PARTY-NOTICES.txt +1336 -0
- package/dist/lib/lambda-assets/validation-record-repairer/asset/index.js +110 -0
- package/dist/lib/lambda-assets/validation-record-repairer/asset/package.json +4 -0
- package/dist/lib/layers/secrets-resolver/bin/error-identity.mjs +6 -8
- package/dist/lib/layers/secrets-resolver/bin/mask.mjs +1193 -150
- package/dist/lib/layers/secrets-resolver/bin/resolve-secrets +1 -1
- package/dist/lib/layers/secrets-resolver/bin/resolve-secrets.mjs +74 -57
- package/dist/lib/opennext.d.ts +9 -0
- package/dist/lib/opennext.js +9 -0
- package/dist/lib/opennextImageLoader.d.ts +62 -0
- package/dist/lib/opennextImageLoader.js +251 -0
- package/dist/lib/opennextSsmRead.d.ts +41 -0
- package/dist/lib/opennextSsmRead.js +113 -0
- package/dist/lib/patterns/aws/account.d.ts +14 -5
- package/dist/lib/patterns/aws/account.js +71 -40
- package/dist/lib/patterns/aws/apexDomainPattern.d.ts +3 -0
- package/dist/lib/patterns/aws/apexDomainPattern.js +10 -7
- package/dist/lib/patterns/aws/auditRole.d.ts +0 -1
- package/dist/lib/patterns/aws/auditRole.js +2 -3
- package/dist/lib/patterns/aws/bastionFactory.d.ts +1 -1
- package/dist/lib/patterns/aws/bastionFactory.js +13 -8
- package/dist/lib/patterns/aws/buildkite/accountAndRegion.d.ts +8 -0
- package/dist/lib/patterns/aws/buildkite/accountAndRegion.js +16 -0
- package/dist/lib/patterns/aws/buildkite/buildkite.d.ts +24 -95
- package/dist/lib/patterns/aws/buildkite/buildkite.js +284 -348
- package/dist/lib/patterns/aws/buildkite/cacheStore.d.ts +93 -0
- package/dist/lib/patterns/aws/buildkite/cacheStore.js +238 -0
- package/dist/lib/patterns/aws/buildkite/controller/admission.d.ts +125 -0
- package/dist/lib/patterns/aws/buildkite/controller/admission.js +165 -0
- package/dist/lib/patterns/aws/buildkite/controller/agentTargeting.d.ts +22 -0
- package/dist/lib/patterns/aws/buildkite/controller/agentTargeting.js +30 -0
- package/dist/lib/patterns/aws/buildkite/controller/buildkiteApiError.d.ts +60 -0
- package/dist/lib/patterns/aws/buildkite/controller/buildkiteApiError.js +108 -0
- package/dist/lib/patterns/aws/buildkite/controller/buildkiteHttp.d.ts +80 -0
- package/dist/lib/patterns/aws/buildkite/controller/buildkiteHttp.js +279 -0
- package/dist/lib/patterns/aws/buildkite/controller/buildkiteIds.d.ts +9 -0
- package/dist/lib/patterns/aws/buildkite/controller/buildkiteIds.js +9 -0
- package/dist/lib/patterns/aws/buildkite/controller/buildkiteRateLimits.d.ts +110 -0
- package/dist/lib/patterns/aws/buildkite/controller/buildkiteRateLimits.js +214 -0
- package/dist/lib/patterns/aws/buildkite/controller/callSignal.d.ts +44 -0
- package/dist/lib/patterns/aws/buildkite/controller/callSignal.js +39 -0
- package/dist/lib/patterns/aws/buildkite/controller/capacity.d.ts +115 -0
- package/dist/lib/patterns/aws/buildkite/controller/capacity.js +90 -0
- package/dist/lib/patterns/aws/buildkite/controller/consoleCapture.d.ts +22 -0
- package/dist/lib/patterns/aws/buildkite/controller/consoleCapture.js +34 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerConfig.d.ts +140 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerConfig.js +349 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerContext.d.ts +43 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerContext.js +26 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerFleetAws.d.ts +58 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerFleetAws.js +214 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerHandler.d.ts +10 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerHandler.js +34 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerHandoff.d.ts +39 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerHandoff.js +100 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerItems.d.ts +76 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerItems.js +187 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerJobs.d.ts +88 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerJobs.js +205 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerLoop.d.ts +31 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerLoop.js +97 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerReadings.d.ts +59 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerReadings.js +171 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerReconcile.d.ts +37 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerReconcile.js +125 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerRefusals.d.ts +57 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerRefusals.js +143 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerRegistration.d.ts +56 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerRegistration.js +89 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTable.d.ts +35 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTable.js +168 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTableWrites.d.ts +78 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTableWrites.js +144 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTelemetry.d.ts +104 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTelemetry.js +97 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTick.d.ts +46 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTick.js +162 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTiming.d.ts +126 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTiming.js +145 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTokens.d.ts +63 -0
- package/dist/lib/patterns/aws/buildkite/controller/controllerTokens.js +189 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatch.d.ts +51 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatch.js +390 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchContract.d.ts +209 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchContract.js +308 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchGroup.d.ts +88 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchGroup.js +212 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchHolds.d.ts +42 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchHolds.js +75 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchTable.d.ts +210 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchTable.js +435 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchTiming.d.ts +15 -0
- package/dist/lib/patterns/aws/buildkite/controller/dispatchTiming.js +29 -0
- package/dist/lib/patterns/aws/buildkite/controller/emf.d.ts +38 -0
- package/dist/lib/patterns/aws/buildkite/controller/emf.js +42 -0
- package/dist/lib/patterns/aws/buildkite/controller/finishLedger.d.ts +37 -0
- package/dist/lib/patterns/aws/buildkite/controller/finishLedger.js +51 -0
- package/dist/lib/patterns/aws/buildkite/controller/finishStatus.d.ts +19 -0
- package/dist/lib/patterns/aws/buildkite/controller/finishStatus.js +18 -0
- package/dist/lib/patterns/aws/buildkite/controller/firstParent.d.ts +85 -0
- package/dist/lib/patterns/aws/buildkite/controller/firstParent.js +252 -0
- package/dist/lib/patterns/aws/buildkite/controller/fleet.d.ts +96 -0
- package/dist/lib/patterns/aws/buildkite/controller/fleet.js +160 -0
- package/dist/lib/patterns/aws/buildkite/controller/functionConfig.d.ts +34 -0
- package/dist/lib/patterns/aws/buildkite/controller/functionConfig.js +60 -0
- package/dist/lib/patterns/aws/buildkite/controller/githubApi.d.ts +44 -0
- package/dist/lib/patterns/aws/buildkite/controller/githubApi.js +110 -0
- package/dist/lib/patterns/aws/buildkite/controller/handoff.d.ts +85 -0
- package/dist/lib/patterns/aws/buildkite/controller/handoff.js +86 -0
- package/dist/lib/patterns/aws/buildkite/controller/idleHold.d.ts +47 -0
- package/dist/lib/patterns/aws/buildkite/controller/idleHold.js +41 -0
- package/dist/lib/patterns/aws/buildkite/controller/jobStates.d.ts +44 -0
- package/dist/lib/patterns/aws/buildkite/controller/jobStates.js +34 -0
- package/dist/lib/patterns/aws/buildkite/controller/lifecycleBucket.d.ts +24 -0
- package/dist/lib/patterns/aws/buildkite/controller/lifecycleBucket.js +42 -0
- package/dist/lib/patterns/aws/buildkite/controller/limitedCall.d.ts +11 -0
- package/dist/lib/patterns/aws/buildkite/controller/limitedCall.js +24 -0
- package/dist/lib/patterns/aws/buildkite/controller/priority.d.ts +26 -0
- package/dist/lib/patterns/aws/buildkite/controller/priority.js +43 -0
- package/dist/lib/patterns/aws/buildkite/controller/reconcile.d.ts +120 -0
- package/dist/lib/patterns/aws/buildkite/controller/reconcile.js +208 -0
- package/dist/lib/patterns/aws/buildkite/controller/restApi.d.ts +71 -0
- package/dist/lib/patterns/aws/buildkite/controller/restApi.js +164 -0
- package/dist/lib/patterns/aws/buildkite/controller/rogueAgents.d.ts +24 -0
- package/dist/lib/patterns/aws/buildkite/controller/rogueAgents.js +26 -0
- package/dist/lib/patterns/aws/buildkite/controller/stacksApi.d.ts +21 -0
- package/dist/lib/patterns/aws/buildkite/controller/stacksApi.js +452 -0
- package/dist/lib/patterns/aws/buildkite/controller/stacksApiTypes.d.ts +125 -0
- package/dist/lib/patterns/aws/buildkite/controller/stacksApiTypes.js +25 -0
- package/dist/lib/patterns/aws/buildkite/controller/tableItems.d.ts +27 -0
- package/dist/lib/patterns/aws/buildkite/controller/tableItems.js +58 -0
- package/dist/lib/patterns/aws/buildkite/controller/tick.d.ts +141 -0
- package/dist/lib/patterns/aws/buildkite/controller/tick.js +219 -0
- package/dist/lib/patterns/aws/buildkite/controller/types.d.ts +189 -0
- package/dist/lib/patterns/aws/buildkite/controller/types.js +36 -0
- package/dist/lib/patterns/aws/buildkite/controllerConstruct.d.ts +66 -0
- package/dist/lib/patterns/aws/buildkite/controllerConstruct.js +113 -0
- package/dist/lib/patterns/aws/buildkite/controllerGrants.d.ts +148 -0
- package/dist/lib/patterns/aws/buildkite/controllerGrants.js +297 -0
- package/dist/lib/patterns/aws/buildkite/decryptPaths.d.ts +41 -0
- package/dist/lib/patterns/aws/buildkite/decryptPaths.js +88 -0
- package/dist/lib/patterns/aws/buildkite/domainStack.d.ts +15 -0
- package/dist/lib/patterns/aws/buildkite/domainStack.js +31 -0
- package/dist/lib/patterns/aws/buildkite/factory.d.ts +35 -17
- package/dist/lib/patterns/aws/buildkite/factory.js +146 -25
- package/dist/lib/patterns/aws/buildkite/finishWatcher/judgeFinishes.d.ts +29 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/judgeFinishes.js +59 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/ledgerReads.d.ts +16 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/ledgerReads.js +81 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/portalClient.d.ts +79 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/portalClient.js +309 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/portalJobs.d.ts +105 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/portalJobs.js +212 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/watcherConfig.d.ts +72 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/watcherConfig.js +155 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/watcherHandler.d.ts +1 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/watcherHandler.js +20 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/watcherRun.d.ts +45 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/watcherRun.js +139 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/watcherTelemetry.d.ts +71 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcher/watcherTelemetry.js +60 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcherConstruct.d.ts +72 -0
- package/dist/lib/patterns/aws/buildkite/finishWatcherConstruct.js +163 -0
- package/dist/lib/patterns/aws/buildkite/iam.d.ts +40 -33
- package/dist/lib/patterns/aws/buildkite/iam.js +84 -177
- package/dist/lib/patterns/aws/buildkite/image/agentPin.d.ts +50 -0
- package/dist/lib/patterns/aws/buildkite/image/agentPin.js +51 -0
- package/dist/lib/patterns/aws/buildkite/image/awstoeDocument.d.ts +68 -0
- package/dist/lib/patterns/aws/buildkite/image/awstoeDocument.js +110 -0
- package/dist/lib/patterns/aws/buildkite/image/baseImage.d.ts +151 -0
- package/dist/lib/patterns/aws/buildkite/image/baseImage.js +188 -0
- package/dist/lib/patterns/aws/buildkite/image/cacheStoreShape.d.ts +12 -0
- package/dist/lib/patterns/aws/buildkite/image/cacheStoreShape.js +12 -0
- package/dist/lib/patterns/aws/buildkite/image/cachesManifest.d.ts +110 -0
- package/dist/lib/patterns/aws/buildkite/image/cachesManifest.js +99 -0
- package/dist/lib/patterns/aws/buildkite/image/ciLayer.d.ts +43 -0
- package/dist/lib/patterns/aws/buildkite/image/ciLayer.js +50 -0
- package/dist/lib/patterns/aws/buildkite/image/components/THIRD-PARTY-NOTICES.txt +250 -0
- package/dist/lib/patterns/aws/buildkite/image/components/agent.d.ts +18 -0
- package/dist/lib/patterns/aws/buildkite/image/components/agent.js +69 -0
- package/dist/lib/patterns/aws/buildkite/image/components/agentConfig.d.ts +50 -0
- package/dist/lib/patterns/aws/buildkite/image/components/agentConfig.js +169 -0
- package/dist/lib/patterns/aws/buildkite/image/components/basePackages.d.ts +48 -0
- package/dist/lib/patterns/aws/buildkite/image/components/basePackages.js +146 -0
- package/dist/lib/patterns/aws/buildkite/image/components/blockDevices.d.ts +34 -0
- package/dist/lib/patterns/aws/buildkite/image/components/blockDevices.js +391 -0
- package/dist/lib/patterns/aws/buildkite/image/components/browsers.d.ts +41 -0
- package/dist/lib/patterns/aws/buildkite/image/components/browsers.js +190 -0
- package/dist/lib/patterns/aws/buildkite/image/components/checkoutSsh.d.ts +70 -0
- package/dist/lib/patterns/aws/buildkite/image/components/checkoutSsh.js +313 -0
- package/dist/lib/patterns/aws/buildkite/image/components/ciLayerShell.d.ts +83 -0
- package/dist/lib/patterns/aws/buildkite/image/components/ciLayerShell.js +182 -0
- package/dist/lib/patterns/aws/buildkite/image/components/ciNode.d.ts +35 -0
- package/dist/lib/patterns/aws/buildkite/image/components/ciNode.js +165 -0
- package/dist/lib/patterns/aws/buildkite/image/components/ciPackages.d.ts +29 -0
- package/dist/lib/patterns/aws/buildkite/image/components/ciPackages.js +96 -0
- package/dist/lib/patterns/aws/buildkite/image/components/docker.d.ts +26 -0
- package/dist/lib/patterns/aws/buildkite/image/components/docker.js +141 -0
- package/dist/lib/patterns/aws/buildkite/image/components/dockerAppArmor.d.ts +88 -0
- package/dist/lib/patterns/aws/buildkite/image/components/dockerAppArmor.js +317 -0
- package/dist/lib/patterns/aws/buildkite/image/components/gitMirrors.d.ts +21 -0
- package/dist/lib/patterns/aws/buildkite/image/components/gitMirrors.js +244 -0
- package/dist/lib/patterns/aws/buildkite/image/components/isolationProbe.d.ts +44 -0
- package/dist/lib/patterns/aws/buildkite/image/components/isolationProbe.js +189 -0
- package/dist/lib/patterns/aws/buildkite/image/components/jobUser.d.ts +17 -0
- package/dist/lib/patterns/aws/buildkite/image/components/jobUser.js +89 -0
- package/dist/lib/patterns/aws/buildkite/image/components/keyScan.d.ts +150 -0
- package/dist/lib/patterns/aws/buildkite/image/components/keyScan.js +359 -0
- package/dist/lib/patterns/aws/buildkite/image/components/laneRunner.d.ts +38 -0
- package/dist/lib/patterns/aws/buildkite/image/components/laneRunner.js +134 -0
- package/dist/lib/patterns/aws/buildkite/image/components/npmStores.d.ts +61 -0
- package/dist/lib/patterns/aws/buildkite/image/components/npmStores.js +285 -0
- package/dist/lib/patterns/aws/buildkite/image/components/readiness.d.ts +9 -0
- package/dist/lib/patterns/aws/buildkite/image/components/readiness.js +172 -0
- package/dist/lib/patterns/aws/buildkite/image/components/scratch.d.ts +35 -0
- package/dist/lib/patterns/aws/buildkite/image/components/scratch.js +154 -0
- package/dist/lib/patterns/aws/buildkite/image/components/serviceImages.d.ts +18 -0
- package/dist/lib/patterns/aws/buildkite/image/components/serviceImages.js +109 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/curl.d.ts +37 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/curl.js +54 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/dpkg.d.ts +18 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/dpkg.js +79 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/engine.d.ts +15 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/engine.js +39 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/files.d.ts +37 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/files.js +49 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/jq.d.ts +22 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/jq.js +38 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/manifests.d.ts +10 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/manifests.js +38 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/ssm.d.ts +21 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/ssm.js +25 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/strict.d.ts +11 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/strict.js +21 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/systemd.d.ts +11 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell/systemd.js +23 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell.d.ts +9 -0
- package/dist/lib/patterns/aws/buildkite/image/components/shell.js +9 -0
- package/dist/lib/patterns/aws/buildkite/image/components/ssmAgentRemoval.d.ts +33 -0
- package/dist/lib/patterns/aws/buildkite/image/components/ssmAgentRemoval.js +159 -0
- package/dist/lib/patterns/aws/buildkite/image/components/supervisor.d.ts +108 -0
- package/dist/lib/patterns/aws/buildkite/image/components/supervisor.js +456 -0
- package/dist/lib/patterns/aws/buildkite/image/components/supervisorAgent.d.ts +61 -0
- package/dist/lib/patterns/aws/buildkite/image/components/supervisorAgent.js +247 -0
- package/dist/lib/patterns/aws/buildkite/image/components/supervisorClient.d.ts +39 -0
- package/dist/lib/patterns/aws/buildkite/image/components/supervisorClient.js +177 -0
- package/dist/lib/patterns/aws/buildkite/image/components/usernsFence.d.ts +57 -0
- package/dist/lib/patterns/aws/buildkite/image/components/usernsFence.js +367 -0
- package/dist/lib/patterns/aws/buildkite/image/components/workloadSlice.d.ts +20 -0
- package/dist/lib/patterns/aws/buildkite/image/components/workloadSlice.js +137 -0
- package/dist/lib/patterns/aws/buildkite/image/fleetImage.d.ts +98 -0
- package/dist/lib/patterns/aws/buildkite/image/fleetImage.js +213 -0
- package/dist/lib/patterns/aws/buildkite/image/githubHostKeys.d.ts +18 -0
- package/dist/lib/patterns/aws/buildkite/image/githubHostKeys.js +22 -0
- package/dist/lib/patterns/aws/buildkite/image/imagePin.d.ts +124 -0
- package/dist/lib/patterns/aws/buildkite/image/imagePin.js +232 -0
- package/dist/lib/patterns/aws/buildkite/image/imagePinLambda.source.cjs +713 -0
- package/dist/lib/patterns/aws/buildkite/image/mirroredRepositories.d.ts +67 -0
- package/dist/lib/patterns/aws/buildkite/image/mirroredRepositories.js +81 -0
- package/dist/lib/patterns/aws/buildkite/image/poolConfig.d.ts +134 -0
- package/dist/lib/patterns/aws/buildkite/image/poolConfig.js +290 -0
- package/dist/lib/patterns/aws/buildkite/image/runnerCommit.d.ts +44 -0
- package/dist/lib/patterns/aws/buildkite/image/runnerCommit.js +71 -0
- package/dist/lib/patterns/aws/buildkite/image/supervisor.d.ts +9 -0
- package/dist/lib/patterns/aws/buildkite/image/supervisor.js +17 -0
- package/dist/lib/patterns/aws/buildkite/image/supervisorContract.d.ts +134 -0
- package/dist/lib/patterns/aws/buildkite/image/supervisorContract.js +260 -0
- package/dist/lib/patterns/aws/buildkite/image/twoStageImage.d.ts +105 -0
- package/dist/lib/patterns/aws/buildkite/image/twoStageImage.js +172 -0
- package/dist/lib/patterns/aws/buildkite/image/vmLayout.d.ts +142 -0
- package/dist/lib/patterns/aws/buildkite/image/vmLayout.js +142 -0
- package/dist/lib/patterns/aws/buildkite/poolSettings.d.ts +33 -0
- package/dist/lib/patterns/aws/buildkite/poolSettings.js +88 -0
- package/dist/lib/patterns/aws/buildkite/props.d.ts +205 -0
- package/dist/lib/patterns/aws/buildkite/props.js +57 -0
- package/dist/lib/patterns/aws/buildkite/roleFence.d.ts +24 -0
- package/dist/lib/patterns/aws/buildkite/roleFence.js +67 -0
- package/dist/lib/patterns/aws/buildkite/scheduledFunction.d.ts +49 -0
- package/dist/lib/patterns/aws/buildkite/scheduledFunction.js +56 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryConfig.d.ts +75 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryConfig.js +218 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryDates.d.ts +24 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryDates.js +81 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryHandler.d.ts +1 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryHandler.js +19 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryReads.d.ts +42 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryReads.js +156 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryRun.d.ts +23 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryRun.js +128 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryTelemetry.d.ts +121 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiry/expiryTelemetry.js +118 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiryCheckConstruct.d.ts +51 -0
- package/dist/lib/patterns/aws/buildkite/tokenExpiryCheckConstruct.js +126 -0
- package/dist/lib/patterns/aws/buildkite/trustDomainKey.d.ts +100 -0
- package/dist/lib/patterns/aws/buildkite/trustDomainKey.js +258 -0
- package/dist/lib/patterns/aws/buildkite/userData.d.ts +51 -73
- package/dist/lib/patterns/aws/buildkite/userData.js +72 -233
- package/dist/lib/patterns/aws/buildkite/validation.d.ts +24 -0
- package/dist/lib/patterns/aws/buildkite/validation.js +430 -0
- package/dist/lib/patterns/aws/buildkite/vcpuPartition.d.ts +49 -0
- package/dist/lib/patterns/aws/buildkite/vcpuPartition.js +134 -0
- package/dist/lib/patterns/aws/buildkite.d.ts +5 -10
- package/dist/lib/patterns/aws/buildkite.js +4 -10
- package/dist/lib/patterns/aws/cdn.d.ts +98 -56
- package/dist/lib/patterns/aws/cdn.js +456 -133
- package/dist/lib/patterns/aws/cdnAppOrigin.d.ts +5 -7
- package/dist/lib/patterns/aws/cdnAppOrigin.js +41 -19
- package/dist/lib/patterns/aws/cdnHttpOriginReach.d.ts +15 -0
- package/dist/lib/patterns/aws/cdnHttpOriginReach.js +85 -0
- package/dist/lib/patterns/aws/clickhouseDatabase.d.ts +60 -22
- package/dist/lib/patterns/aws/clickhouseDatabase.js +180 -175
- package/dist/lib/patterns/aws/clickhouseTls/types.d.ts +7 -1
- package/dist/lib/patterns/aws/compute.d.ts +3 -25
- package/dist/lib/patterns/aws/compute.js +33 -22
- package/dist/lib/patterns/aws/computeEc2.d.ts +15 -1
- package/dist/lib/patterns/aws/computeEc2.js +11 -1
- package/dist/lib/patterns/aws/computeEcs.d.ts +112 -30
- package/dist/lib/patterns/aws/computeEcs.js +518 -227
- package/dist/lib/patterns/aws/computeEcsTypes.d.ts +254 -113
- package/dist/lib/patterns/aws/computeLambda.d.ts +10 -1
- package/dist/lib/patterns/aws/computeLambda.js +6 -2
- package/dist/lib/patterns/aws/computePropApplicability.d.ts +2 -0
- package/dist/lib/patterns/aws/computePropApplicability.js +7 -1
- package/dist/lib/patterns/aws/database.d.ts +85 -34
- package/dist/lib/patterns/aws/database.js +119 -118
- package/dist/lib/patterns/aws/databasePropApplicability.d.ts +64 -0
- package/dist/lib/patterns/aws/databasePropApplicability.js +12 -5
- package/dist/lib/patterns/aws/delegatedDomainPattern.d.ts +3 -0
- package/dist/lib/patterns/aws/delegatedDomainPattern.js +29 -13
- package/dist/lib/patterns/aws/devSubstrate.d.ts +15 -6
- package/dist/lib/patterns/aws/devSubstrate.js +151 -89
- package/dist/lib/patterns/aws/dnsRecordComposer.d.ts +32 -1
- package/dist/lib/patterns/aws/dnsRecordComposer.js +218 -102
- package/dist/lib/patterns/aws/domain.d.ts +2 -2
- package/dist/lib/patterns/aws/domain.js +190 -52
- package/dist/lib/patterns/aws/domainAliasReach.d.ts +14 -0
- package/dist/lib/patterns/aws/domainAliasReach.js +84 -0
- package/dist/lib/patterns/aws/domainCertificateComposer.d.ts +7 -10
- package/dist/lib/patterns/aws/domainCertificateComposer.js +69 -54
- package/dist/lib/patterns/aws/domainValidation.d.ts +1 -0
- package/dist/lib/patterns/aws/domainValidation.js +98 -29
- package/dist/lib/patterns/aws/externalRecordsPattern.d.ts +4 -3
- package/dist/lib/patterns/aws/externalRecordsPattern.js +18 -25
- package/dist/lib/patterns/aws/fivetranProxy.d.ts +8 -0
- package/dist/lib/patterns/aws/fivetranProxy.js +2 -3
- package/dist/lib/patterns/aws/interfaces/cdn.d.ts +10 -4
- package/dist/lib/patterns/aws/interfaces/cdn.js +6 -6
- package/dist/lib/patterns/aws/interfaces/compute.d.ts +14 -0
- package/dist/lib/patterns/aws/interfaces/connector.d.ts +1 -1
- package/dist/lib/patterns/aws/interfaces/connector.js +1 -1
- package/dist/lib/patterns/aws/interfaces/database.d.ts +31 -8
- package/dist/lib/patterns/aws/interfaces/database.js +2 -8
- package/dist/lib/patterns/aws/interfaces/domain.d.ts +39 -8
- package/dist/lib/patterns/aws/interfaces/index.d.ts +1 -1
- package/dist/lib/patterns/aws/interfaces/index.js +1 -1
- package/dist/lib/patterns/aws/interfaces/migrationContributor.d.ts +26 -2
- package/dist/lib/patterns/aws/interfaces/pattern.d.ts +318 -45
- package/dist/lib/patterns/aws/messaging.d.ts +22 -7
- package/dist/lib/patterns/aws/messaging.js +28 -8
- package/dist/lib/patterns/aws/network.d.ts +25 -9
- package/dist/lib/patterns/aws/network.js +21 -16
- package/dist/lib/patterns/aws/openNextServerRoutes.d.ts +51 -0
- package/dist/lib/patterns/aws/openNextServerRoutes.js +172 -0
- package/dist/lib/patterns/aws/organisation.d.ts +37 -11
- package/dist/lib/patterns/aws/organisation.js +124 -58
- package/dist/lib/patterns/aws/organisationFactory.js +1 -1
- package/dist/lib/patterns/aws/pattern.d.ts +1 -1
- package/dist/lib/patterns/aws/patternDomain.d.ts +7 -1
- package/dist/lib/patterns/aws/patternDomain.js +68 -26
- package/dist/lib/patterns/aws/payload.d.ts +36 -2
- package/dist/lib/patterns/aws/payload.js +274 -102
- package/dist/lib/patterns/aws/payloadPublicRoutes.d.ts +105 -0
- package/dist/lib/patterns/aws/payloadPublicRoutes.js +338 -0
- package/dist/lib/patterns/aws/platform.js +4 -1
- package/dist/lib/patterns/aws/staticSite.d.ts +23 -14
- package/dist/lib/patterns/aws/staticSite.js +148 -99
- package/dist/lib/patterns/aws/storage.d.ts +27 -10
- package/dist/lib/patterns/aws/storage.js +28 -15
- package/dist/lib/patterns/aws/targets/targetResolution.d.ts +5 -1
- package/dist/lib/patterns/aws/targets/targetResolution.js +6 -2
- package/dist/lib/patterns/aws/validationRecordRepairer.d.ts +74 -0
- package/dist/lib/patterns/aws/validationRecordRepairer.js +537 -0
- package/dist/lib/patterns/aws/vpcPeer.d.ts +1 -1
- package/dist/lib/patterns/aws/vpcPeerAccepter.d.ts +1 -1
- package/dist/lib/patterns/aws/vpcPeerAccepter.js +35 -25
- package/dist/lib/resources/aws/audit/auditRole.d.ts +1 -2
- package/dist/lib/resources/aws/audit/auditRole.js +19 -11
- package/dist/lib/resources/aws/backup/backupPlan.d.ts +2 -2
- package/dist/lib/resources/aws/backup/backupPlan.js +12 -6
- package/dist/lib/resources/aws/backup/backupTierReading.d.ts +50 -0
- package/dist/lib/resources/aws/backup/backupTierReading.js +62 -0
- package/dist/lib/resources/aws/backup/backupVault.d.ts +34 -3
- package/dist/lib/resources/aws/backup/backupVault.js +74 -15
- package/dist/lib/resources/aws/base/awsStack.d.ts +10 -4
- package/dist/lib/resources/aws/base/awsStack.js +39 -12
- package/dist/lib/resources/aws/base/costControls.d.ts +52 -0
- package/dist/lib/resources/aws/base/costControls.js +111 -0
- package/dist/lib/resources/aws/cdn/cachePolicy.d.ts +15 -0
- package/dist/lib/resources/aws/cdn/cachePolicy.js +35 -0
- package/dist/lib/resources/aws/cdn/cloudFront.d.ts +99 -48
- package/dist/lib/resources/aws/cdn/cloudFront.js +191 -107
- package/dist/lib/resources/aws/cdn/cloudFrontHostRedirect.d.ts +38 -0
- package/dist/lib/resources/aws/cdn/cloudFrontHostRedirect.js +67 -0
- package/dist/lib/resources/aws/cdn/cloudFrontLogDelivery.d.ts +1 -1
- package/dist/lib/resources/aws/cdn/cloudFrontLogDelivery.js +14 -18
- package/dist/lib/resources/aws/cdn/index.d.ts +1 -0
- package/dist/lib/resources/aws/cdn/responseHeadersPolicy.d.ts +6 -6
- package/dist/lib/resources/aws/cdn/responseHeadersPolicy.js +11 -9
- package/dist/lib/resources/aws/compute/applicationLoadBalancer.d.ts +29 -6
- package/dist/lib/resources/aws/compute/applicationLoadBalancer.js +85 -7
- package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.d.ts +87 -52
- package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.js +259 -49
- package/dist/lib/resources/aws/compute/asgLifecycleCore.source.cjs +1694 -0
- package/dist/lib/resources/aws/compute/asgLifecycleHandlers.d.ts +148 -0
- package/dist/lib/resources/aws/compute/asgLifecycleHandlers.js +275 -0
- package/dist/lib/resources/aws/compute/asgLifecycleHookPosture.d.ts +52 -0
- package/dist/lib/resources/aws/compute/asgLifecycleHookPosture.js +185 -0
- package/dist/lib/resources/aws/compute/asgLifecycleHookValidation.d.ts +21 -0
- package/dist/lib/resources/aws/compute/asgLifecycleHookValidation.js +113 -0
- package/dist/lib/resources/aws/compute/contentDigest.d.ts +87 -0
- package/dist/lib/resources/aws/compute/contentDigest.js +294 -0
- package/dist/lib/resources/aws/compute/contentDigestLambda.source.cjs +108 -0
- package/dist/lib/resources/aws/compute/ec2.d.ts +125 -13
- package/dist/lib/resources/aws/compute/ec2.js +212 -25
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.d.ts +41 -15
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.js +51 -162
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationLambda.source.cjs +209 -431
- package/dist/lib/resources/aws/compute/ec2SshAccess.js +10 -6
- package/dist/lib/resources/aws/compute/ecs.d.ts +82 -14
- package/dist/lib/resources/aws/compute/ecs.js +251 -80
- package/dist/lib/resources/aws/compute/ecsCapacityConfig.d.ts +6 -2
- package/dist/lib/resources/aws/compute/ecsCapacityConfig.js +45 -27
- package/dist/lib/resources/aws/compute/ecsClusterFactory.d.ts +30 -0
- package/dist/lib/resources/aws/compute/ecsClusterFactory.js +41 -0
- package/dist/lib/resources/aws/compute/ecsConstants.d.ts +5 -8
- package/dist/lib/resources/aws/compute/ecsConstants.js +9 -43
- package/dist/lib/resources/aws/compute/ecsContext.d.ts +3 -1
- package/dist/lib/resources/aws/compute/ecsImages.d.ts +25 -1
- package/dist/lib/resources/aws/compute/ecsImages.js +49 -10
- package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.d.ts +6 -1
- package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.js +30 -14
- package/dist/lib/resources/aws/compute/ecsLogDriver.d.ts +22 -0
- package/dist/lib/resources/aws/compute/ecsLogDriver.js +44 -0
- package/dist/lib/resources/aws/compute/ecsNetworkMode.d.ts +47 -0
- package/dist/lib/resources/aws/compute/ecsNetworkMode.js +118 -0
- package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +42 -2
- package/dist/lib/resources/aws/compute/ecsNetworking.js +207 -135
- package/dist/lib/resources/aws/compute/ecsRemoteConnections.d.ts +6 -1
- package/dist/lib/resources/aws/compute/ecsRemoteConnections.js +26 -15
- package/dist/lib/resources/aws/compute/ecsRoles.d.ts +1 -1
- package/dist/lib/resources/aws/compute/ecsRoles.js +4 -1
- package/dist/lib/resources/aws/compute/ecsRolloutBarrier.d.ts +53 -21
- package/dist/lib/resources/aws/compute/ecsRolloutBarrier.js +106 -82
- package/dist/lib/resources/aws/compute/ecsRolloutBarrierLambda.source.cjs +438 -74
- package/dist/lib/resources/aws/compute/ecsServiceFactory.d.ts +41 -5
- package/dist/lib/resources/aws/compute/ecsServiceFactory.js +127 -40
- package/dist/lib/resources/aws/compute/ecsTargetGroup.d.ts +21 -10
- package/dist/lib/resources/aws/compute/ecsTargetGroup.js +79 -48
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.d.ts +3 -3
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +58 -47
- package/dist/lib/resources/aws/compute/ecsTypes.d.ts +175 -67
- package/dist/lib/resources/aws/compute/ecsValidation.d.ts +116 -13
- package/dist/lib/resources/aws/compute/ecsValidation.js +286 -44
- package/dist/lib/resources/aws/compute/frontedRecords.d.ts +108 -0
- package/dist/lib/resources/aws/compute/frontedRecords.js +277 -0
- package/dist/lib/resources/aws/compute/imagePipeline.d.ts +250 -0
- package/dist/lib/resources/aws/compute/imagePipeline.js +515 -0
- package/dist/lib/resources/aws/compute/imdsPosture.d.ts +75 -0
- package/dist/lib/resources/aws/compute/imdsPosture.js +174 -0
- package/dist/lib/resources/aws/compute/index.d.ts +1 -1
- package/dist/lib/resources/aws/compute/index.js +1 -1
- package/dist/lib/resources/aws/compute/ingressProfile.d.ts +19 -4
- package/dist/lib/resources/aws/compute/ingressProfile.js +4 -3
- package/dist/lib/resources/aws/compute/instanceArchitectureWords.d.ts +7 -0
- package/dist/lib/resources/aws/compute/instanceArchitectureWords.js +9 -0
- package/dist/lib/resources/aws/compute/lambda.d.ts +103 -57
- package/dist/lib/resources/aws/compute/lambda.js +191 -110
- package/dist/lib/resources/aws/compute/lifecycleHookLambda.source.cjs +278 -111
- package/dist/lib/resources/aws/compute/listenerRouting.d.ts +3 -0
- package/dist/lib/resources/aws/compute/listenerRouting.js +5 -1
- package/dist/lib/resources/aws/compute/loadBalancerIngress.d.ts +88 -0
- package/dist/lib/resources/aws/compute/loadBalancerIngress.js +257 -0
- package/dist/lib/resources/aws/compute/loadBalancerMigration.d.ts +132 -0
- package/dist/lib/resources/aws/compute/loadBalancerMigration.js +190 -0
- package/dist/lib/resources/aws/compute/persistentDataVolume.d.ts +51 -26
- package/dist/lib/resources/aws/compute/persistentDataVolume.js +53 -162
- package/dist/lib/resources/aws/compute/persistentDataVolumeLambda.source.cjs +452 -396
- package/dist/lib/resources/aws/compute/ssmAgentPolicy.d.ts +16 -0
- package/dist/lib/resources/aws/compute/ssmAgentPolicy.js +40 -0
- package/dist/lib/resources/aws/database/clickhouseBucketName.d.ts +18 -0
- package/dist/lib/resources/aws/database/clickhouseBucketName.js +47 -0
- package/dist/lib/resources/aws/database/clickhouseConstants.d.ts +33 -49
- package/dist/lib/resources/aws/database/clickhouseConstants.js +41 -67
- package/dist/lib/resources/aws/database/clickhouseDataZone.d.ts +13 -0
- package/dist/lib/resources/aws/database/clickhouseDataZone.js +25 -0
- package/dist/lib/resources/aws/database/clickhouseMaintenanceScript.d.ts +6 -0
- package/dist/lib/resources/aws/database/clickhouseMaintenanceScript.js +13 -3
- package/dist/lib/resources/aws/database/clickhouseOptimiseScript.d.ts +42 -25
- package/dist/lib/resources/aws/database/clickhouseOptimiseScript.js +101 -17
- package/dist/lib/resources/aws/database/clickhouseSchemas.d.ts +7 -18
- package/dist/lib/resources/aws/database/clickhouseSchemas.js +17 -31
- package/dist/lib/resources/aws/database/clickhouseTuning.js +5 -4
- package/dist/lib/resources/aws/database/clickhouseUserData.d.ts +49 -17
- package/dist/lib/resources/aws/database/clickhouseUserData.js +89 -51
- package/dist/lib/resources/aws/database/clickhouseXmlRenderer.d.ts +3 -2
- package/dist/lib/resources/aws/database/clickhouseXmlRenderer.js +5 -4
- package/dist/lib/resources/aws/database/dynamodb.d.ts +47 -8
- package/dist/lib/resources/aws/database/dynamodb.js +169 -33
- package/dist/lib/resources/aws/database/engineVersions.d.ts +55 -0
- package/dist/lib/resources/aws/database/engineVersions.js +138 -0
- package/dist/lib/resources/aws/database/index.d.ts +1 -0
- package/dist/lib/resources/aws/database/index.js +1 -0
- package/dist/lib/resources/aws/database/rdsAurora.d.ts +27 -8
- package/dist/lib/resources/aws/database/rdsAurora.js +138 -39
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +21 -5
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +47 -8
- package/dist/lib/resources/aws/database/rdsDefaults.d.ts +9 -2
- package/dist/lib/resources/aws/database/rdsDefaults.js +9 -2
- package/dist/lib/resources/aws/database/rdsHelpers.d.ts +20 -2
- package/dist/lib/resources/aws/database/rdsHelpers.js +40 -7
- package/dist/lib/resources/aws/database/rdsInstance.d.ts +29 -5
- package/dist/lib/resources/aws/database/rdsInstance.js +119 -50
- package/dist/lib/resources/aws/database/rdsProxyOutput.d.ts +2 -5
- package/dist/lib/resources/aws/database/rdsProxyOutput.js +9 -13
- package/dist/lib/resources/aws/database/trustAnchors.d.ts +18 -0
- package/dist/lib/resources/aws/database/trustAnchors.js +36 -0
- package/dist/lib/resources/aws/iam/ciIdentity.d.ts +4 -31
- package/dist/lib/resources/aws/iam/ciIdentity.js +67 -114
- package/dist/lib/resources/aws/iam/ciIdentityFactory.d.ts +1 -1
- package/dist/lib/resources/aws/iam/delegationRole.d.ts +3 -20
- package/dist/lib/resources/aws/iam/delegationRole.js +51 -53
- package/dist/lib/resources/aws/iam/identityCenter/group.js +1 -1
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.js +8 -1
- package/dist/lib/resources/aws/iam/identityCenter/user.d.ts +47 -5
- package/dist/lib/resources/aws/iam/identityCenter/user.js +95 -24
- package/dist/lib/resources/aws/iam/index.d.ts +0 -3
- package/dist/lib/resources/aws/iam/index.js +0 -3
- package/dist/lib/resources/aws/iam/oidcProviderAdoption.js +15 -15
- package/dist/lib/resources/aws/iam/role.js +4 -3
- package/dist/lib/resources/aws/logging/cloudTrail.d.ts +13 -5
- package/dist/lib/resources/aws/logging/cloudTrail.js +39 -30
- package/dist/lib/resources/aws/logging/index.d.ts +5 -0
- package/dist/lib/resources/aws/logging/index.js +5 -0
- package/dist/lib/resources/aws/logging/logDeliveryBucket.d.ts +124 -0
- package/dist/lib/resources/aws/logging/logDeliveryBucket.js +283 -0
- package/dist/lib/resources/aws/logging/logGroup.d.ts +176 -10
- package/dist/lib/resources/aws/logging/logGroup.js +394 -11
- package/dist/lib/resources/aws/logging/logGroupHygiene.d.ts +58 -18
- package/dist/lib/resources/aws/logging/logGroupHygiene.js +293 -39
- package/dist/lib/resources/aws/logging/logGroupValues.d.ts +15 -0
- package/dist/lib/resources/aws/logging/logGroupValues.js +18 -0
- package/dist/lib/resources/aws/logging/logLedgerRecord.d.ts +64 -0
- package/dist/lib/resources/aws/logging/logLedgerRecord.js +47 -0
- package/dist/lib/resources/aws/logging/logPolicyResolution.d.ts +64 -0
- package/dist/lib/resources/aws/logging/logPolicyResolution.js +193 -0
- package/dist/lib/resources/aws/logging/logRollout.d.ts +1 -0
- package/dist/lib/resources/aws/logging/logRollout.js +1 -0
- package/dist/lib/resources/aws/logging/logScope.d.ts +121 -0
- package/dist/lib/resources/aws/logging/logScope.js +400 -0
- package/dist/lib/resources/aws/logging/metricFilter.d.ts +12 -0
- package/dist/lib/resources/aws/logging/metricFilter.js +21 -0
- package/dist/lib/resources/aws/logging/singletonLogGroup.d.ts +4 -1
- package/dist/lib/resources/aws/logging/singletonLogGroup.js +9 -3
- package/dist/lib/resources/aws/messaging/eventBridgeQueueGrants.d.ts +5 -0
- package/dist/lib/resources/aws/messaging/eventBridgeQueueGrants.js +6 -1
- package/dist/lib/resources/aws/messaging/eventBridgeRule.d.ts +32 -12
- package/dist/lib/resources/aws/messaging/eventBridgeRule.js +49 -24
- package/dist/lib/resources/aws/messaging/eventTargets.d.ts +8 -5
- package/dist/lib/resources/aws/messaging/eventTargets.js +65 -9
- package/dist/lib/resources/aws/messaging/eventbridge.d.ts +1 -1
- package/dist/lib/resources/aws/messaging/eventbridge.js +17 -16
- package/dist/lib/resources/aws/messaging/index.d.ts +1 -1
- package/dist/lib/resources/aws/messaging/queuePolicyQuota.js +4 -6
- package/dist/lib/resources/aws/messaging/schedule.d.ts +24 -6
- package/dist/lib/resources/aws/messaging/schedule.js +12 -4
- package/dist/lib/resources/aws/messaging/sns.d.ts +13 -4
- package/dist/lib/resources/aws/messaging/sns.js +30 -14
- package/dist/lib/resources/aws/messaging/sqs.d.ts +61 -0
- package/dist/lib/resources/aws/messaging/sqs.js +150 -42
- package/dist/lib/resources/aws/messaging/subscription.d.ts +10 -11
- package/dist/lib/resources/aws/messaging/subscription.js +6 -0
- package/dist/lib/resources/aws/messaging/utils.d.ts +2 -0
- package/dist/lib/resources/aws/messaging/utils.js +5 -1
- package/dist/lib/resources/aws/monitoring/alarmDefaults.d.ts +5 -2
- package/dist/lib/resources/aws/monitoring/alarmDefaults.js +8 -3
- package/dist/lib/resources/aws/monitoring/buildkiteControllerAlarms.d.ts +19 -0
- package/dist/lib/resources/aws/monitoring/buildkiteControllerAlarms.js +123 -0
- package/dist/lib/resources/aws/monitoring/buildkiteControllerMetrics.d.ts +34 -0
- package/dist/lib/resources/aws/monitoring/buildkiteControllerMetrics.js +32 -0
- package/dist/lib/resources/aws/monitoring/buildkiteFinishWatcherAlarms.d.ts +20 -0
- package/dist/lib/resources/aws/monitoring/buildkiteFinishWatcherAlarms.js +115 -0
- package/dist/lib/resources/aws/monitoring/buildkiteFinishWatcherMetrics.d.ts +38 -0
- package/dist/lib/resources/aws/monitoring/buildkiteFinishWatcherMetrics.js +39 -0
- package/dist/lib/resources/aws/monitoring/buildkiteTokenExpiryAlarms.d.ts +50 -0
- package/dist/lib/resources/aws/monitoring/buildkiteTokenExpiryAlarms.js +197 -0
- package/dist/lib/resources/aws/monitoring/buildkiteTokenExpiryMetrics.d.ts +66 -0
- package/dist/lib/resources/aws/monitoring/buildkiteTokenExpiryMetrics.js +57 -0
- package/dist/lib/resources/aws/monitoring/buildkiteVcpuAlarms.d.ts +62 -0
- package/dist/lib/resources/aws/monitoring/buildkiteVcpuAlarms.js +145 -0
- package/dist/lib/resources/aws/monitoring/clickhouseAlarms.d.ts +5 -10
- package/dist/lib/resources/aws/monitoring/clickhouseAlarms.js +68 -98
- package/dist/lib/resources/aws/monitoring/ecsTaskStopWatchdog.d.ts +10 -5
- package/dist/lib/resources/aws/monitoring/ecsTaskStopWatchdog.js +24 -16
- package/dist/lib/resources/aws/monitoring/gatedAbsencePager.d.ts +133 -0
- package/dist/lib/resources/aws/monitoring/gatedAbsencePager.js +141 -0
- package/dist/lib/resources/aws/monitoring/imageBuildFailureAlarm.d.ts +59 -0
- package/dist/lib/resources/aws/monitoring/imageBuildFailureAlarm.js +89 -0
- package/dist/lib/resources/aws/monitoring/index.d.ts +0 -1
- package/dist/lib/resources/aws/monitoring/index.js +0 -1
- package/dist/lib/resources/aws/monitoring/logPatternAlarms.d.ts +12 -4
- package/dist/lib/resources/aws/monitoring/logPatternAlarms.js +8 -5
- package/dist/lib/resources/aws/monitoring/metricNamespaces.d.ts +9 -2
- package/dist/lib/resources/aws/monitoring/metricNamespaces.js +12 -2
- package/dist/lib/resources/aws/monitoring/scheduleAlarms.d.ts +28 -10
- package/dist/lib/resources/aws/monitoring/scheduleAlarms.js +79 -18
- package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.d.ts +20 -0
- package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +25 -2
- package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.js +3 -2
- package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.d.ts +8 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.js +1 -1
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.d.ts +16 -2
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +56 -4
- package/dist/lib/resources/aws/networking/domainCertificate.d.ts +10 -2
- package/dist/lib/resources/aws/networking/domainCertificate.js +13 -10
- package/dist/lib/resources/aws/networking/flowLogRetention.d.ts +15 -0
- package/dist/lib/resources/aws/networking/flowLogRetention.js +26 -0
- package/dist/lib/resources/aws/networking/hostedZone.d.ts +12 -1
- package/dist/lib/resources/aws/networking/hostedZone.js +41 -20
- package/dist/lib/resources/aws/networking/ipamPool.js +28 -20
- package/dist/lib/resources/aws/networking/resolverQueryLoggingConfig.d.ts +57 -0
- package/dist/lib/resources/aws/networking/resolverQueryLoggingConfig.js +127 -0
- package/dist/lib/resources/aws/networking/serviceDiscovery.d.ts +23 -13
- package/dist/lib/resources/aws/networking/serviceDiscovery.js +66 -18
- package/dist/lib/resources/aws/networking/vpc.d.ts +40 -5
- package/dist/lib/resources/aws/networking/vpc.js +171 -55
- package/dist/lib/resources/aws/networking/vpcPeeringAccepterRole.d.ts +1 -1
- package/dist/lib/resources/aws/networking/vpcPeeringAccepterRole.js +4 -2
- package/dist/lib/resources/aws/networking/vpcPeeringConnection.js +3 -3
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +13 -8
- package/dist/lib/resources/aws/organisation/organisationAccount.js +55 -8
- package/dist/lib/resources/aws/organisation/organisationPolicy.js +3 -1
- package/dist/lib/resources/aws/secrets/index.d.ts +0 -1
- package/dist/lib/resources/aws/secrets/index.js +0 -1
- package/dist/lib/resources/aws/secrets/kms.d.ts +40 -3
- package/dist/lib/resources/aws/secrets/kms.js +40 -27
- package/dist/lib/resources/aws/secrets/parameter.d.ts +1 -22
- package/dist/lib/resources/aws/secrets/parameter.js +2 -93
- package/dist/lib/resources/aws/secrets/secret.d.ts +81 -13
- package/dist/lib/resources/aws/secrets/secret.js +160 -47
- package/dist/lib/resources/aws/secrets/stackEncryptionKey.d.ts +39 -25
- package/dist/lib/resources/aws/secrets/stackEncryptionKey.js +46 -28
- package/dist/lib/resources/aws/secrets/tlsCaSecret.js +1 -1
- package/dist/lib/resources/aws/secrets/tlsServerSecret.d.ts +6 -5
- package/dist/lib/resources/aws/secrets/tlsServerSecret.js +6 -5
- package/dist/lib/resources/aws/storage/bucketDeployment.d.ts +19 -3
- package/dist/lib/resources/aws/storage/bucketDeployment.js +105 -7
- package/dist/lib/resources/aws/storage/bucketDeploymentGrants.d.ts +22 -0
- package/dist/lib/resources/aws/storage/bucketDeploymentGrants.js +38 -0
- package/dist/lib/resources/aws/storage/bucketNotificationsGovernance.d.ts +54 -0
- package/dist/lib/resources/aws/storage/bucketNotificationsGovernance.js +321 -0
- package/dist/lib/resources/aws/storage/bucketNotificationsHandler.source.cjs +937 -0
- package/dist/lib/resources/aws/storage/bucketNotificationsHandlerIdentity.d.ts +50 -0
- package/dist/lib/resources/aws/storage/bucketNotificationsHandlerIdentity.js +92 -0
- package/dist/lib/resources/aws/storage/bucketNotificationsRolePolicySize.d.ts +33 -0
- package/dist/lib/resources/aws/storage/bucketNotificationsRolePolicySize.js +100 -0
- package/dist/lib/resources/aws/storage/bucketPolicyAmendment.d.ts +39 -0
- package/dist/lib/resources/aws/storage/bucketPolicyAmendment.js +282 -0
- package/dist/lib/resources/aws/storage/bucketPolicyDeployments.d.ts +67 -0
- package/dist/lib/resources/aws/storage/bucketPolicyDeployments.js +290 -0
- package/dist/lib/resources/aws/storage/bucketPolicyIntrinsicBounds.d.ts +31 -0
- package/dist/lib/resources/aws/storage/bucketPolicyIntrinsicBounds.js +73 -0
- package/dist/lib/resources/aws/storage/ecr.d.ts +18 -2
- package/dist/lib/resources/aws/storage/ecr.js +36 -16
- package/dist/lib/resources/aws/storage/s3.d.ts +155 -23
- package/dist/lib/resources/aws/storage/s3.js +271 -53
- package/dist/lib/resources/aws/storage/synthesisedRoleId.d.ts +13 -0
- package/dist/lib/resources/aws/storage/synthesisedRoleId.js +23 -0
- package/dist/lib/resources/aws/utilities/awsCustomResource.d.ts +70 -10
- package/dist/lib/resources/aws/utilities/awsCustomResource.js +120 -21
- package/dist/lib/resources/aws/utilities/awsCustomResourceAdmission.d.ts +26 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceAdmission.js +422 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceContract.d.ts +138 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceContract.js +55 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourcePolicy.d.ts +74 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourcePolicy.js +287 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceProviderLogging.d.ts +33 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceProviderLogging.js +51 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceRawWarning.d.ts +28 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceRawWarning.js +57 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceRefusal.d.ts +51 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceRefusal.js +43 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceRenderGate.d.ts +53 -0
- package/dist/lib/resources/aws/utilities/awsCustomResourceRenderGate.js +437 -0
- package/dist/lib/resources/aws/utilities/awsSdkCallAllowList.d.ts +262 -0
- package/dist/lib/resources/aws/utilities/awsSdkCallAllowList.js +413 -0
- package/dist/lib/resources/aws/utilities/awsSdkCallSecrets.d.ts +54 -0
- package/dist/lib/resources/aws/utilities/awsSdkCallSecrets.js +192 -0
- package/dist/lib/resources/aws/utilities/awsSdkCallValueShapes.d.ts +58 -0
- package/dist/lib/resources/aws/utilities/awsSdkCallValueShapes.js +286 -0
- package/dist/lib/resources/aws/utilities/codeBuild.d.ts +15 -4
- package/dist/lib/resources/aws/utilities/codeBuild.js +46 -2
- package/dist/lib/resources/aws/utilities/customResource.d.ts +4 -0
- package/dist/lib/resources/aws/utilities/customResource.js +14 -6
- package/dist/lib/resources/aws/utilities/customResourceProvider.d.ts +33 -2
- package/dist/lib/resources/aws/utilities/customResourceProvider.js +113 -2
- package/dist/lib/resources/aws/utilities/index.d.ts +0 -1
- package/dist/lib/resources/aws/utilities/index.js +0 -1
- package/dist/lib/resources/aws/utilities/tlsCertGenerator.d.ts +17 -3
- package/dist/lib/resources/aws/utilities/tlsCertGenerator.js +70 -4
- package/dist/lib/terminology/cdkParity.d.ts +79 -0
- package/dist/lib/terminology/cdkParity.js +30 -0
- package/dist/lib/terminology/parity/compute.d.ts +2 -0
- package/dist/lib/terminology/parity/compute.js +667 -0
- package/dist/lib/terminology/parity/dataAndMessaging.d.ts +2 -0
- package/dist/lib/terminology/parity/dataAndMessaging.js +438 -0
- package/dist/lib/terminology/parity/governance.d.ts +2 -0
- package/dist/lib/terminology/parity/governance.js +309 -0
- package/dist/lib/terminology/parity/index.d.ts +3 -0
- package/dist/lib/terminology/parity/index.js +11 -0
- package/dist/lib/terminology/parity/storageAndNetworking.d.ts +2 -0
- package/dist/lib/terminology/parity/storageAndNetworking.js +522 -0
- package/dist/lib/terminology/refuseRemoved.d.ts +7 -0
- package/dist/lib/terminology/refuseRemoved.js +13 -0
- package/dist/lib/terminology/refuseRenamed.d.ts +49 -0
- package/dist/lib/terminology/refuseRenamed.js +310 -0
- package/dist/lib/utils/acmTagValue.d.ts +1 -2
- package/dist/lib/utils/acmTagValue.js +1 -13
- package/dist/lib/utils/adoptedResiduals.d.ts +14 -0
- package/dist/lib/utils/adoptedResiduals.js +30 -0
- package/dist/lib/utils/albAliasTargetRegistry.d.ts +13 -5
- package/dist/lib/utils/albAliasTargetRegistry.js +20 -15
- package/dist/lib/utils/backupTierMapping.d.ts +59 -21
- package/dist/lib/utils/backupTierMapping.js +48 -15
- package/dist/lib/utils/capacityIdentityContext.d.ts +5 -16
- package/dist/lib/utils/capacityIdentityContext.js +11 -38
- package/dist/lib/utils/capacitySlotLabel.d.ts +7 -0
- package/dist/lib/utils/capacitySlotLabel.js +13 -0
- package/dist/lib/utils/capitaliseString.d.ts +1 -1
- package/dist/lib/utils/capitaliseString.js +1 -1
- package/dist/lib/utils/cdkConstructIds.d.ts +13 -0
- package/dist/lib/utils/cdkConstructIds.js +17 -0
- package/dist/lib/utils/cdkContext.d.ts +139 -14
- package/dist/lib/utils/cdkContext.js +200 -33
- package/dist/lib/utils/cdnAliasTargetRegistry.d.ts +1 -1
- package/dist/lib/utils/cdnAliasTargetRegistry.js +8 -8
- package/dist/lib/utils/cfnOutputRead.d.ts +28 -0
- package/dist/lib/utils/cfnOutputRead.js +43 -0
- package/dist/lib/utils/ciOidcProviderHandler.d.ts +0 -6
- package/dist/lib/utils/ciOidcProviderHandler.js +2 -13
- package/dist/lib/utils/connections.d.ts +3 -8
- package/dist/lib/utils/connections.js +65 -21
- package/dist/lib/utils/connector.d.ts +62 -27
- package/dist/lib/utils/connector.js +65 -21
- package/dist/lib/utils/constructsOfClass.d.ts +3 -0
- package/dist/lib/utils/constructsOfClass.js +4 -0
- package/dist/lib/utils/costAllocationTags.d.ts +8 -2
- package/dist/lib/utils/costAllocationTags.js +1 -1
- package/dist/lib/utils/databaseTypes.d.ts +2 -1
- package/dist/lib/utils/deployAccount.d.ts +54 -0
- package/dist/lib/utils/deployAccount.js +103 -0
- package/dist/lib/utils/deployedLoadBalancersContext.d.ts +13 -0
- package/dist/lib/utils/deployedLoadBalancersContext.js +18 -0
- package/dist/lib/utils/dnsRecordRegistry.d.ts +27 -5
- package/dist/lib/utils/dnsRecordRegistry.js +149 -35
- package/dist/lib/utils/domainRefusalLabels.d.ts +58 -0
- package/dist/lib/utils/domainRefusalLabels.js +112 -0
- package/dist/lib/utils/domainTypes.d.ts +15 -7
- package/dist/lib/utils/domainTypes.js +51 -19
- package/dist/lib/utils/duplicateNames.d.ts +54 -0
- package/dist/lib/utils/duplicateNames.js +286 -0
- package/dist/lib/utils/engineCompat.d.ts +16 -9
- package/dist/lib/utils/engineCompat.js +25 -16
- package/dist/lib/utils/env.js +3 -3
- package/dist/lib/utils/exportNaming.d.ts +10 -51
- package/dist/lib/utils/exportNaming.js +10 -54
- package/dist/lib/utils/fjallAppRoot.d.ts +9 -0
- package/dist/lib/utils/fjallAppRoot.js +13 -0
- package/dist/lib/utils/getAccountId.d.ts +4 -1
- package/dist/lib/utils/getAccountId.js +8 -4
- package/dist/lib/utils/getConfig.d.ts +0 -1
- package/dist/lib/utils/getConfig.js +24 -27
- package/dist/lib/utils/hostConstructKey.d.ts +25 -0
- package/dist/lib/utils/hostConstructKey.js +44 -0
- package/dist/lib/utils/implicitDescription.d.ts +40 -0
- package/dist/lib/utils/implicitDescription.js +86 -0
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/inlineSource.d.ts +89 -0
- package/dist/lib/utils/inlineSource.js +230 -0
- package/dist/lib/utils/latin1Description.d.ts +16 -0
- package/dist/lib/utils/latin1Description.js +34 -0
- package/dist/lib/utils/lightweightProviderTagsAspect.d.ts +25 -0
- package/dist/lib/utils/lightweightProviderTagsAspect.js +47 -0
- package/dist/lib/utils/logResidual.d.ts +35 -0
- package/dist/lib/utils/logResidual.js +210 -0
- package/dist/lib/utils/managedDomainContext.d.ts +15 -17
- package/dist/lib/utils/managedDomainContext.js +89 -63
- package/dist/lib/utils/manifestWriter.d.ts +46 -18
- package/dist/lib/utils/manifestWriter.js +129 -78
- package/dist/lib/utils/maskedEcho.d.ts +13 -0
- package/dist/lib/utils/maskedEcho.js +31 -0
- package/dist/lib/utils/operatorScope.d.ts +33 -0
- package/dist/lib/utils/operatorScope.js +45 -0
- package/dist/lib/utils/orgConfigParser.d.ts +20 -4
- package/dist/lib/utils/orgConfigParser.js +127 -63
- package/dist/lib/utils/propOwnership.d.ts +20 -0
- package/dist/lib/utils/propOwnership.js +18 -0
- package/dist/lib/utils/records.d.ts +10 -0
- package/dist/lib/utils/records.js +29 -0
- package/dist/lib/utils/removalMarkerAspect.d.ts +51 -0
- package/dist/lib/utils/removalMarkerAspect.js +95 -0
- package/dist/lib/utils/removalMarkerReach.d.ts +69 -0
- package/dist/lib/utils/removalMarkerReach.js +147 -0
- package/dist/lib/utils/removalPolicy.d.ts +161 -1
- package/dist/lib/utils/removalPolicy.js +366 -3
- package/dist/lib/utils/renderedTemplate.d.ts +17 -0
- package/dist/lib/utils/renderedTemplate.js +45 -0
- package/dist/lib/utils/residualLedger.d.ts +47 -0
- package/dist/lib/utils/residualLedger.js +431 -0
- package/dist/lib/utils/resolveAlertsTopic.d.ts +4 -7
- package/dist/lib/utils/resolveAlertsTopic.js +18 -18
- package/dist/lib/utils/resourceNaming.d.ts +35 -6
- package/dist/lib/utils/resourceNaming.js +166 -36
- package/dist/lib/utils/resourceTypeTags.d.ts +10 -8
- package/dist/lib/utils/resourceTypeTags.js +11 -13
- package/dist/lib/utils/sameStackReference.d.ts +108 -0
- package/dist/lib/utils/sameStackReference.js +226 -0
- package/dist/lib/utils/stackLabel.d.ts +26 -0
- package/dist/lib/utils/stackLabel.js +91 -0
- package/dist/lib/utils/stackOutput.d.ts +114 -0
- package/dist/lib/utils/stackOutput.js +345 -0
- package/dist/lib/utils/stackOutputValidation.d.ts +19 -0
- package/dist/lib/utils/stackOutputValidation.js +263 -0
- package/dist/lib/utils/stackRegions.d.ts +7 -0
- package/dist/lib/utils/stackRegions.js +71 -0
- package/dist/lib/utils/stackSingleton.d.ts +8 -0
- package/dist/lib/utils/stackSingleton.js +15 -0
- package/dist/lib/utils/standardTagsAspect.d.ts +23 -6
- package/dist/lib/utils/standardTagsAspect.js +33 -11
- package/dist/lib/utils/tagUpdateBehaviour.d.ts +22 -0
- package/dist/lib/utils/tagUpdateBehaviour.js +1261 -0
- package/dist/lib/utils/templateTags.d.ts +19 -0
- package/dist/lib/utils/templateTags.js +59 -0
- package/dist/lib/utils/topLevelStack.d.ts +8 -0
- package/dist/lib/utils/topLevelStack.js +13 -0
- package/dist/lib/utils/validationLogger.d.ts +6 -2
- package/dist/lib/utils/validationLogger.js +20 -10
- package/dist/lib/utils/vpcUtils.d.ts +22 -0
- package/dist/lib/utils/vpcUtils.js +32 -0
- package/package.json +64 -25
- package/dist/lib/lambda-assets/cert-generator/THIRD-PARTY-NOTICES.txt +0 -341
- package/dist/lib/patterns/aws/buildkite/pins.d.ts +0 -69
- package/dist/lib/patterns/aws/buildkite/pins.js +0 -79
- package/dist/lib/patterns/aws/buildkite/schema.d.ts +0 -8
- package/dist/lib/patterns/aws/buildkite/schema.js +0 -8
- package/dist/lib/resources/aws/compute/samApplication.d.ts +0 -15
- package/dist/lib/resources/aws/compute/samApplication.js +0 -27
- package/dist/lib/resources/aws/iam/ciIdentityTrust.d.ts +0 -48
- package/dist/lib/resources/aws/iam/ciIdentityTrust.js +0 -87
- package/dist/lib/resources/aws/iam/instanceProfile.d.ts +0 -5
- package/dist/lib/resources/aws/iam/instanceProfile.js +0 -8
- package/dist/lib/resources/aws/iam/policy.d.ts +0 -5
- package/dist/lib/resources/aws/iam/policy.js +0 -8
- package/dist/lib/resources/aws/monitoring/buildkiteAlarms.d.ts +0 -29
- package/dist/lib/resources/aws/monitoring/buildkiteAlarms.js +0 -90
- package/dist/lib/resources/aws/secrets/alias.d.ts +0 -5
- package/dist/lib/resources/aws/secrets/alias.js +0 -8
- package/dist/lib/resources/aws/utilities/resourceShare.d.ts +0 -5
- package/dist/lib/resources/aws/utilities/resourceShare.js +0 -8
- package/dist/lib/utils/deployTimeWriterMarkerAspect.d.ts +0 -23
- package/dist/lib/utils/deployTimeWriterMarkerAspect.js +0 -35
- package/dist/lib/utils/getAsync.d.ts +0 -10
- package/dist/lib/utils/getAsync.js +0 -32
- package/dist/lib/utils/getStackOutput.d.ts +0 -1
- package/dist/lib/utils/getStackOutput.js +0 -16
- package/dist/lib/utils/stripAndCamelCase.d.ts +0 -1
- package/dist/lib/utils/stripAndCamelCase.js +0 -12
|
@@ -0,0 +1,1694 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared core of every Fjall Auto Scaling lifecycle handler. Composed with
|
|
3
|
+
* one action module into a single index.js at synth time, by the hook seam
|
|
4
|
+
* through composeLifecycleHandlerSource.
|
|
5
|
+
*
|
|
6
|
+
* The function has two callers. An SQS record is the event path, the lifecycle
|
|
7
|
+
* notification, which this core checks, validates and hands to the action
|
|
8
|
+
* module. A tick is the reconcile sweep. It finds actions whose notification
|
|
9
|
+
* was lost, and runs the same action module for them, completing by instance
|
|
10
|
+
* id.
|
|
11
|
+
*
|
|
12
|
+
* Runs coordinate through the action record, tags on the instance. Only this
|
|
13
|
+
* core writes one, and only complete() writes done or ended, each from Auto
|
|
14
|
+
* Scaling's own answer to a completion. EC2 tags are neither compare and swap
|
|
15
|
+
* nor read after write consistent, so a record narrows a race and never closes
|
|
16
|
+
* one. Every overlap still converges on a refused second completion.
|
|
17
|
+
*
|
|
18
|
+
* The record grammar is spelt here and in @fjall/util's lifecycleRecordTags,
|
|
19
|
+
* which this CommonJS source cannot import. Shared vectors pin the two.
|
|
20
|
+
*
|
|
21
|
+
* CommonJS rather than ESM because Code.fromInline lands the source as
|
|
22
|
+
* `index.js`, which Lambda treats as CommonJS by default.
|
|
23
|
+
*/
|
|
24
|
+
const {
|
|
25
|
+
CreateTagsCommand,
|
|
26
|
+
DescribeInstancesCommand,
|
|
27
|
+
EC2Client
|
|
28
|
+
} = require("@aws-sdk/client-ec2");
|
|
29
|
+
const {
|
|
30
|
+
AutoScalingClient,
|
|
31
|
+
CompleteLifecycleActionCommand,
|
|
32
|
+
DescribeAutoScalingGroupsCommand,
|
|
33
|
+
DescribeLifecycleHooksCommand,
|
|
34
|
+
DescribeScalingActivitiesCommand,
|
|
35
|
+
DescribeWarmPoolCommand
|
|
36
|
+
} = require("@aws-sdk/client-auto-scaling");
|
|
37
|
+
const {
|
|
38
|
+
CloudFormationClient,
|
|
39
|
+
DescribeStackResourceCommand,
|
|
40
|
+
DescribeStacksCommand
|
|
41
|
+
} = require("@aws-sdk/client-cloudformation");
|
|
42
|
+
|
|
43
|
+
// Bounds every AWS call, SDK retries included, so a hung request cannot carry
|
|
44
|
+
// a run past its deadlines.
|
|
45
|
+
const SDK_CALL_TIMEOUT_MS = 20_000;
|
|
46
|
+
// Dates the proof deadline when the environment is incomplete, so it is never
|
|
47
|
+
// Infinity. Equal to both rows' heartbeat, which a test pins.
|
|
48
|
+
const DEFAULT_HEARTBEAT_SECONDS = 900;
|
|
49
|
+
const VALIDATION_WINDOW_MS = 20_000;
|
|
50
|
+
const VALIDATION_READ_INTERVAL_MS = 5_000;
|
|
51
|
+
// Absorbs clock skew between execution environments, and a dead owner's last
|
|
52
|
+
// request still being applied.
|
|
53
|
+
const CLAIM_GRACE_MS = 30_000;
|
|
54
|
+
const RECORD_TOLERANCE_SECONDS = 60;
|
|
55
|
+
const MESSAGE_TOLERANCE_MS = 60_000;
|
|
56
|
+
const RESCUES_PER_TICK = 10;
|
|
57
|
+
const ACTIVITY_PAGE_SIZE = 100;
|
|
58
|
+
const ACTIVITY_PAGE_LIMIT = 3;
|
|
59
|
+
const COMPLETION_RETRY_BUDGET_MS = 60_000;
|
|
60
|
+
const COMPLETION_RETRY_INTERVAL_MS = 5_000;
|
|
61
|
+
// Kept back from the end of the invocation for a second read and a release
|
|
62
|
+
// write, each bounded by SDK_CALL_TIMEOUT_MS.
|
|
63
|
+
const COMPLETION_RESERVE_MS = 40_000;
|
|
64
|
+
|
|
65
|
+
const STACK_ID_TAG = "aws:cloudformation:stack-id";
|
|
66
|
+
const LOGICAL_ID_TAG = "aws:cloudformation:logical-id";
|
|
67
|
+
const LAUNCHING_TRANSITION = "autoscaling:EC2_INSTANCE_LAUNCHING";
|
|
68
|
+
|
|
69
|
+
const TRANSITION = { LAUNCHING: "launching", TERMINATING: "terminating" };
|
|
70
|
+
const ORIGIN = { EVENT: "event", RESCUE: "rescue" };
|
|
71
|
+
const COMPLETION = { ACCEPTED: "accepted", REFUSED: "refused" };
|
|
72
|
+
const FAILURE_CLASS = { TRANSIENT: "transient", PERSISTENT: "persistent" };
|
|
73
|
+
|
|
74
|
+
const STATE = {
|
|
75
|
+
CLAIMED: "claimed",
|
|
76
|
+
DONE: "done",
|
|
77
|
+
ENDED: "ended",
|
|
78
|
+
EXPIRED: "expired",
|
|
79
|
+
RELEASED: "released",
|
|
80
|
+
UNRESCUED: "unrescued"
|
|
81
|
+
};
|
|
82
|
+
const RECORD_STATES = {
|
|
83
|
+
event: [STATE.CLAIMED, STATE.DONE, STATE.RELEASED],
|
|
84
|
+
rescue: [
|
|
85
|
+
STATE.CLAIMED,
|
|
86
|
+
STATE.DONE,
|
|
87
|
+
STATE.ENDED,
|
|
88
|
+
STATE.RELEASED,
|
|
89
|
+
STATE.EXPIRED,
|
|
90
|
+
STATE.UNRESCUED
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
const RECORD_VERSION = "1";
|
|
94
|
+
const RECORD_VALUE =
|
|
95
|
+
/^1:(0|[1-9][0-9]*):([A-Za-z0-9-]+):([a-z]+):(0|[1-9][0-9]*)$/;
|
|
96
|
+
|
|
97
|
+
const WAITING = "Pending:Wait";
|
|
98
|
+
const TERMINATING_WAIT = "Terminating:Wait";
|
|
99
|
+
const WARMED_PENDING_WAIT = "Warmed:Pending:Wait";
|
|
100
|
+
const WARMED_TERMINATING_WAIT = "Warmed:Terminating:Wait";
|
|
101
|
+
// What the event path accepts as this transition's wait.
|
|
102
|
+
const WAIT_STATES = {
|
|
103
|
+
launching: [WAITING, WARMED_PENDING_WAIT],
|
|
104
|
+
terminating: [TERMINATING_WAIT, WARMED_PENDING_WAIT, WARMED_TERMINATING_WAIT]
|
|
105
|
+
};
|
|
106
|
+
// What the sweep lists from the group itself.
|
|
107
|
+
const GROUP_WAIT_STATES = {
|
|
108
|
+
launching: [WAITING],
|
|
109
|
+
terminating: [TERMINATING_WAIT]
|
|
110
|
+
};
|
|
111
|
+
const ENDED_ACTIVITY_STATUSES = ["Successful", "Failed", "Cancelled"];
|
|
112
|
+
|
|
113
|
+
const LIFECYCLE_EVENT = {
|
|
114
|
+
ALREADY_ENDED: "lifecycle_action_already_ended",
|
|
115
|
+
COMPLETED: "lifecycle_action_completed",
|
|
116
|
+
ENV_INCOMPLETE: "lifecycle_env_incomplete",
|
|
117
|
+
EXPIRED: "lifecycle_action_expired",
|
|
118
|
+
FINISHED: "lifecycle_action_finished",
|
|
119
|
+
LAUNCH_ABANDONED: "lifecycle_launch_abandoned",
|
|
120
|
+
MOVED_ON: "lifecycle_action_moved_on",
|
|
121
|
+
NOT_OURS: "lifecycle_action_not_ours",
|
|
122
|
+
NOT_WAITING: "lifecycle_action_not_waiting",
|
|
123
|
+
RECONCILE_FAILED: "lifecycle_reconcile_failed",
|
|
124
|
+
RECONCILE_TICK: "lifecycle_reconcile_tick",
|
|
125
|
+
RECORD_UNWRITTEN: "lifecycle_record_unwritten",
|
|
126
|
+
RESCUED: "lifecycle_rescued",
|
|
127
|
+
RESCUE_STARTED: "lifecycle_rescue_started",
|
|
128
|
+
RESCUE_SUPERSEDED: "lifecycle_rescue_superseded",
|
|
129
|
+
RESCUE_YIELDED: "lifecycle_rescue_yielded",
|
|
130
|
+
STOOD_DOWN: "lifecycle_action_stood_down",
|
|
131
|
+
UNATTRIBUTED: "lifecycle_action_unattributed",
|
|
132
|
+
UNDATED: "lifecycle_action_undated",
|
|
133
|
+
UNRESCUED: "lifecycle_action_unrescued",
|
|
134
|
+
VALIDATION_UNREAD: "lifecycle_validation_unread"
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const STAND_DOWN_REASON = {
|
|
138
|
+
ACTION_MOVED_ON: "action_moved_on",
|
|
139
|
+
NO_VERDICT: "no_verdict"
|
|
140
|
+
};
|
|
141
|
+
const STAND_DOWN_EVENT = {
|
|
142
|
+
[STAND_DOWN_REASON.ACTION_MOVED_ON]: LIFECYCLE_EVENT.MOVED_ON
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const NOT_OURS_CLASS = {
|
|
146
|
+
ENVELOPE: "envelope",
|
|
147
|
+
HOOK_NAME: "hook_name",
|
|
148
|
+
NO_SUCH_GROUP: "no_such_group",
|
|
149
|
+
TAG_MISMATCH: "tag_mismatch",
|
|
150
|
+
TIME_AHEAD: "time_ahead",
|
|
151
|
+
VALIDATION_ERROR: "validation_error"
|
|
152
|
+
};
|
|
153
|
+
const NOT_WAITING_CLASS = {
|
|
154
|
+
NO_SUCH_GROUP: "no_such_group",
|
|
155
|
+
NO_WAIT_STATE: "no_wait_state",
|
|
156
|
+
OLD_MESSAGE: "old_message"
|
|
157
|
+
};
|
|
158
|
+
const UNREAD_REASON = {
|
|
159
|
+
ACCESS_DENIED: "access_denied",
|
|
160
|
+
OTHER: "other",
|
|
161
|
+
READ_FAILED: "read_failed",
|
|
162
|
+
TAG_ABSENT: "tag_absent",
|
|
163
|
+
UNREADABLE_ANSWER: "unreadable_answer"
|
|
164
|
+
};
|
|
165
|
+
const READ = {
|
|
166
|
+
FINISHED: "finished",
|
|
167
|
+
NO_GROUP: "no_group",
|
|
168
|
+
NOT_OURS: "not_ours",
|
|
169
|
+
NOT_WAITING: "not_waiting",
|
|
170
|
+
UNREAD: "unread",
|
|
171
|
+
WAITING: "waiting"
|
|
172
|
+
};
|
|
173
|
+
const DECISION = {
|
|
174
|
+
DEFER: "defer",
|
|
175
|
+
EXPIRED: "expired",
|
|
176
|
+
FINISHED: "finished",
|
|
177
|
+
HELD: "held",
|
|
178
|
+
REPORTED: "reported",
|
|
179
|
+
RESCUE: "rescue",
|
|
180
|
+
UNRESCUED: "unrescued"
|
|
181
|
+
};
|
|
182
|
+
const DISCOVERY = {
|
|
183
|
+
ABSENT_IN_PROGRESS: "absent_in_progress",
|
|
184
|
+
BEING_CREATED: "being_created",
|
|
185
|
+
BEING_DELETED: "being_deleted",
|
|
186
|
+
FOUND: "found",
|
|
187
|
+
REFUSED: "refused",
|
|
188
|
+
STACK_RESOURCE: "stack_resource",
|
|
189
|
+
UNDISCOVERED: "undiscovered"
|
|
190
|
+
};
|
|
191
|
+
const YIELD = { EVENT: "event", RESCUE: "rescue", TERMINAL: "terminal" };
|
|
192
|
+
const CHECKPOINT_CLAIMED = "claimed";
|
|
193
|
+
|
|
194
|
+
// The one allow list of what a retry can cure. Anything else is persistent.
|
|
195
|
+
const TRANSIENT_ERROR_NAMES = new Set([
|
|
196
|
+
"AbortError",
|
|
197
|
+
"NetworkingError",
|
|
198
|
+
"RequestLimitExceeded",
|
|
199
|
+
"RequestThrottled",
|
|
200
|
+
"RequestThrottledException",
|
|
201
|
+
"ResourceContention",
|
|
202
|
+
"ResourceContentionFault",
|
|
203
|
+
"Throttling",
|
|
204
|
+
"ThrottlingException",
|
|
205
|
+
"TimeoutError",
|
|
206
|
+
"TooManyRequestsException"
|
|
207
|
+
]);
|
|
208
|
+
const TRANSIENT_ERROR_CODES = new Set([
|
|
209
|
+
"EAI_AGAIN",
|
|
210
|
+
"ECONNREFUSED",
|
|
211
|
+
"ECONNRESET",
|
|
212
|
+
"ENOTFOUND",
|
|
213
|
+
"EPIPE",
|
|
214
|
+
"ETIMEDOUT"
|
|
215
|
+
]);
|
|
216
|
+
const ACCESS_DENIED_ERROR_NAMES = new Set([
|
|
217
|
+
"AccessDenied",
|
|
218
|
+
"AccessDeniedException",
|
|
219
|
+
"UnauthorizedOperation"
|
|
220
|
+
]);
|
|
221
|
+
|
|
222
|
+
function errMessage(err) {
|
|
223
|
+
return err && err.message ? err.message : String(err);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function errName(err) {
|
|
227
|
+
return err && err.name ? err.name : "Error";
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function send(client, command) {
|
|
231
|
+
return client.send(command, {
|
|
232
|
+
abortSignal: AbortSignal.timeout(SDK_CALL_TIMEOUT_MS)
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function consoleLog(message, fields) {
|
|
237
|
+
console.log(JSON.stringify({ message, ...(fields || {}) }));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function sleepFor(ms) {
|
|
241
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
let _ec2;
|
|
245
|
+
let _asg;
|
|
246
|
+
let _cfn;
|
|
247
|
+
function defaultClients() {
|
|
248
|
+
if (!_ec2) _ec2 = new EC2Client({});
|
|
249
|
+
if (!_asg) _asg = new AutoScalingClient({});
|
|
250
|
+
if (!_cfn) _cfn = new CloudFormationClient({});
|
|
251
|
+
return { asgClient: _asg, cfnClient: _cfn, ec2Client: _ec2 };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function readEnv(env, name) {
|
|
255
|
+
const value = env[name];
|
|
256
|
+
if (typeof value !== "string" || value === "") return undefined;
|
|
257
|
+
return value;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function readPositiveInteger(env, name) {
|
|
261
|
+
const value = readEnv(env, name);
|
|
262
|
+
if (value === undefined || !/^[1-9][0-9]*$/.test(value)) return undefined;
|
|
263
|
+
return Number.parseInt(value, 10);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function readConfig(env) {
|
|
267
|
+
const heartbeatSeconds = readPositiveInteger(
|
|
268
|
+
env,
|
|
269
|
+
"LIFECYCLE_HEARTBEAT_SECONDS"
|
|
270
|
+
);
|
|
271
|
+
const rawTransition = readEnv(env, "LIFECYCLE_TRANSITION");
|
|
272
|
+
const transition = Object.values(TRANSITION).includes(rawTransition)
|
|
273
|
+
? rawTransition
|
|
274
|
+
: undefined;
|
|
275
|
+
const required = {
|
|
276
|
+
LIFECYCLE_GROUP_LOGICAL_ID: readEnv(env, "LIFECYCLE_GROUP_LOGICAL_ID"),
|
|
277
|
+
LIFECYCLE_HEARTBEAT_SECONDS: heartbeatSeconds,
|
|
278
|
+
LIFECYCLE_HOOK_NAME: readEnv(env, "LIFECYCLE_HOOK_NAME"),
|
|
279
|
+
LIFECYCLE_RECORD_EVENT_TAG_KEY: readEnv(
|
|
280
|
+
env,
|
|
281
|
+
"LIFECYCLE_RECORD_EVENT_TAG_KEY"
|
|
282
|
+
),
|
|
283
|
+
LIFECYCLE_RECORD_RESCUE_TAG_KEY: readEnv(
|
|
284
|
+
env,
|
|
285
|
+
"LIFECYCLE_RECORD_RESCUE_TAG_KEY"
|
|
286
|
+
),
|
|
287
|
+
LIFECYCLE_RESCUE_DEFER_SECONDS: readPositiveInteger(
|
|
288
|
+
env,
|
|
289
|
+
"LIFECYCLE_RESCUE_DEFER_SECONDS"
|
|
290
|
+
),
|
|
291
|
+
LIFECYCLE_TRANSITION: transition,
|
|
292
|
+
STACK_ID: readEnv(env, "STACK_ID")
|
|
293
|
+
};
|
|
294
|
+
const missing = Object.keys(required).filter(
|
|
295
|
+
(name) => required[name] === undefined
|
|
296
|
+
);
|
|
297
|
+
return {
|
|
298
|
+
complete: missing.length === 0,
|
|
299
|
+
deferMs: required.LIFECYCLE_RESCUE_DEFER_SECONDS * 1000,
|
|
300
|
+
eventKey: required.LIFECYCLE_RECORD_EVENT_TAG_KEY,
|
|
301
|
+
groupLogicalId: required.LIFECYCLE_GROUP_LOGICAL_ID,
|
|
302
|
+
heartbeatSeconds: heartbeatSeconds ?? DEFAULT_HEARTBEAT_SECONDS,
|
|
303
|
+
hookName: required.LIFECYCLE_HOOK_NAME,
|
|
304
|
+
missing,
|
|
305
|
+
rescueKey: required.LIFECYCLE_RECORD_RESCUE_TAG_KEY,
|
|
306
|
+
stackId: required.STACK_ID,
|
|
307
|
+
transition
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// The one failure table. Transient is what a retry can cure.
|
|
312
|
+
function failureClass(err) {
|
|
313
|
+
const status = err && err.$metadata && err.$metadata.httpStatusCode;
|
|
314
|
+
const transient =
|
|
315
|
+
Boolean(err) &&
|
|
316
|
+
(TRANSIENT_ERROR_NAMES.has(err.name) ||
|
|
317
|
+
TRANSIENT_ERROR_CODES.has(err.code) ||
|
|
318
|
+
(typeof status === "number" && status >= 500));
|
|
319
|
+
return transient ? FAILURE_CLASS.TRANSIENT : FAILURE_CLASS.PERSISTENT;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// What a log line says of a failure. This source cannot import the mask, so a
|
|
323
|
+
// line names the error and its class and never quotes the message.
|
|
324
|
+
function errorFields(err) {
|
|
325
|
+
return { class: failureClass(err), errorName: errName(err) };
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Auto Scaling refuses a completion of an action that has already ended,
|
|
329
|
+
// because another run completed it or the heartbeat expired, with a
|
|
330
|
+
// ValidationError naming no active lifecycle action.
|
|
331
|
+
function isNoActiveLifecycleAction(err) {
|
|
332
|
+
return (
|
|
333
|
+
Boolean(err) &&
|
|
334
|
+
err.name === "ValidationError" &&
|
|
335
|
+
/No active Lifecycle Action/i.test(errMessage(err))
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function parseRecordValue(writer, value) {
|
|
340
|
+
if (typeof value !== "string") return undefined;
|
|
341
|
+
const fields = RECORD_VALUE.exec(value);
|
|
342
|
+
if (fields === null) return undefined;
|
|
343
|
+
const [, actionStart, owner, state, until] = fields;
|
|
344
|
+
if (!RECORD_STATES[writer].includes(state)) return undefined;
|
|
345
|
+
const actionStartS = Number(actionStart);
|
|
346
|
+
const untilS = Number(until);
|
|
347
|
+
if (!Number.isSafeInteger(actionStartS) || !Number.isSafeInteger(untilS)) {
|
|
348
|
+
return undefined;
|
|
349
|
+
}
|
|
350
|
+
return { actionStartS, owner, state, untilS };
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function formatRecordValue(writer, record) {
|
|
354
|
+
const value = `${RECORD_VERSION}:${record.actionStartS}:${record.owner}:${record.state}:${record.untilS}`;
|
|
355
|
+
if (parseRecordValue(writer, value) === undefined) {
|
|
356
|
+
throw new Error("A lifecycle record would read back as no record");
|
|
357
|
+
}
|
|
358
|
+
return value;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function belongsToAction(record, startedAtMs, heartbeatSeconds) {
|
|
362
|
+
if (record === undefined) return false;
|
|
363
|
+
const startS = Math.floor(startedAtMs / 1000);
|
|
364
|
+
return (
|
|
365
|
+
record.actionStartS >= startS - RECORD_TOLERANCE_SECONDS &&
|
|
366
|
+
record.actionStartS <= startS + heartbeatSeconds
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function isTerminal(record) {
|
|
371
|
+
return (
|
|
372
|
+
record !== undefined &&
|
|
373
|
+
(record.state === STATE.DONE || record.state === STATE.ENDED)
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function isLiveClaim(record, nowMs) {
|
|
378
|
+
return (
|
|
379
|
+
record !== undefined &&
|
|
380
|
+
record.state === STATE.CLAIMED &&
|
|
381
|
+
nowMs < record.untilS * 1000 + CLAIM_GRACE_MS
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// A later untilS belongs to the fresher invocation. The owner breaks a tie, so
|
|
386
|
+
// of two claims with equal untilS exactly one proceeds, whatever each read.
|
|
387
|
+
function outranks(other, own) {
|
|
388
|
+
if (other.untilS !== own.untilS) return other.untilS > own.untilS;
|
|
389
|
+
return other.owner > own.owner;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function yieldsTo(records, ownClaim, nowMs) {
|
|
393
|
+
const { event, rescue } = records;
|
|
394
|
+
if (
|
|
395
|
+
event !== undefined &&
|
|
396
|
+
(event.state === STATE.DONE || isLiveClaim(event, nowMs))
|
|
397
|
+
) {
|
|
398
|
+
return YIELD.EVENT;
|
|
399
|
+
}
|
|
400
|
+
if (isTerminal(rescue)) return YIELD.TERMINAL;
|
|
401
|
+
if (isLiveClaim(rescue, nowMs) && outranks(rescue, ownClaim)) {
|
|
402
|
+
return YIELD.RESCUE;
|
|
403
|
+
}
|
|
404
|
+
return undefined;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function decideAction({
|
|
408
|
+
deferMs,
|
|
409
|
+
floorMs,
|
|
410
|
+
heartbeatMs,
|
|
411
|
+
nowMs,
|
|
412
|
+
records,
|
|
413
|
+
startedAtMs
|
|
414
|
+
}) {
|
|
415
|
+
const { event, rescue } = records;
|
|
416
|
+
const ageMs = nowMs - startedAtMs;
|
|
417
|
+
if (ageMs < deferMs) return DECISION.DEFER;
|
|
418
|
+
if (isTerminal(event) || isTerminal(rescue)) return DECISION.FINISHED;
|
|
419
|
+
if (
|
|
420
|
+
rescue !== undefined &&
|
|
421
|
+
(rescue.state === STATE.EXPIRED || rescue.state === STATE.UNRESCUED)
|
|
422
|
+
) {
|
|
423
|
+
return DECISION.REPORTED;
|
|
424
|
+
}
|
|
425
|
+
if (isLiveClaim(event, nowMs) || isLiveClaim(rescue, nowMs)) {
|
|
426
|
+
return DECISION.HELD;
|
|
427
|
+
}
|
|
428
|
+
const remainingMs = heartbeatMs - ageMs;
|
|
429
|
+
if (remainingMs >= floorMs) return DECISION.RESCUE;
|
|
430
|
+
return remainingMs > 0 ? DECISION.UNRESCUED : DECISION.EXPIRED;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function createRuntime(lifecycleAction, context, overrides) {
|
|
434
|
+
const { clients, env, log, now, sleep } = overrides || {};
|
|
435
|
+
const clock = now || (() => Date.now());
|
|
436
|
+
const processEnv = env || process.env;
|
|
437
|
+
return {
|
|
438
|
+
action: lifecycleAction,
|
|
439
|
+
clients: clients || defaultClients(),
|
|
440
|
+
config: readConfig(processEnv),
|
|
441
|
+
env: processEnv,
|
|
442
|
+
invocationEndMs: clock() + context.getRemainingTimeInMillis(),
|
|
443
|
+
log: log || consoleLog,
|
|
444
|
+
now: clock,
|
|
445
|
+
owner: context.awsRequestId,
|
|
446
|
+
sleep: sleep || sleepFor
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function heartbeatMsOf(rt) {
|
|
451
|
+
return rt.config.heartbeatSeconds * 1000;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function recordsOfInstance(rt, instance) {
|
|
455
|
+
const tags = Array.isArray(instance && instance.Tags) ? instance.Tags : [];
|
|
456
|
+
const valueOf = (key) => {
|
|
457
|
+
const tag = tags.find((candidate) => candidate.Key === key);
|
|
458
|
+
return tag === undefined ? undefined : tag.Value;
|
|
459
|
+
};
|
|
460
|
+
return {
|
|
461
|
+
event: parseRecordValue("event", valueOf(rt.config.eventKey)),
|
|
462
|
+
rescue: parseRecordValue("rescue", valueOf(rt.config.rescueKey))
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function ofAction(rt, records, startedAtMs) {
|
|
467
|
+
const { heartbeatSeconds } = rt.config;
|
|
468
|
+
const keep = (record) =>
|
|
469
|
+
belongsToAction(record, startedAtMs, heartbeatSeconds) ? record : undefined;
|
|
470
|
+
return { event: keep(records.event), rescue: keep(records.rescue) };
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
async function describeInstances(rt, instanceIds) {
|
|
474
|
+
const answer = await send(
|
|
475
|
+
rt.clients.ec2Client,
|
|
476
|
+
new DescribeInstancesCommand({ InstanceIds: instanceIds })
|
|
477
|
+
);
|
|
478
|
+
if (!Array.isArray(answer.Reservations)) {
|
|
479
|
+
throw new Error("DescribeInstances answered with no reservation list");
|
|
480
|
+
}
|
|
481
|
+
return answer.Reservations.flatMap(
|
|
482
|
+
(reservation) => reservation.Instances || []
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
async function readRecords(rt, instanceId, startedAtMs) {
|
|
487
|
+
const [instance] = await describeInstances(rt, [instanceId]);
|
|
488
|
+
return ofAction(rt, recordsOfInstance(rt, instance), startedAtMs);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
function createRun(rt, action) {
|
|
492
|
+
const rescue = action.origin === ORIGIN.RESCUE;
|
|
493
|
+
return {
|
|
494
|
+
action,
|
|
495
|
+
claimed: false,
|
|
496
|
+
finished: false,
|
|
497
|
+
heartbeatEndMs: action.startedAtMs + heartbeatMsOf(rt),
|
|
498
|
+
key: rescue ? rt.config.rescueKey : rt.config.eventKey,
|
|
499
|
+
keepsRecords: rt.config.complete,
|
|
500
|
+
validation: {},
|
|
501
|
+
writer: rescue ? "rescue" : "event"
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
function claimUntilS(rt) {
|
|
506
|
+
return Math.ceil(rt.invocationEndMs / 1000);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function recordValueOf(rt, run, state) {
|
|
510
|
+
return formatRecordValue(run.writer, {
|
|
511
|
+
actionStartS: Math.floor(run.action.startedAtMs / 1000),
|
|
512
|
+
owner: run.action.owner,
|
|
513
|
+
state,
|
|
514
|
+
untilS:
|
|
515
|
+
state === STATE.CLAIMED ? claimUntilS(rt) : Math.floor(rt.now() / 1000)
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
async function putRecord(rt, run, state) {
|
|
520
|
+
await send(
|
|
521
|
+
rt.clients.ec2Client,
|
|
522
|
+
new CreateTagsCommand({
|
|
523
|
+
Resources: [run.action.instanceId],
|
|
524
|
+
Tags: [{ Key: run.key, Value: recordValueOf(rt, run, state) }]
|
|
525
|
+
})
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// A best effort write. The line lets a suite tell the fence denying a hook's
|
|
530
|
+
// own key, which is a defect, from a transient failure.
|
|
531
|
+
async function writeRecord(rt, run, state) {
|
|
532
|
+
try {
|
|
533
|
+
await putRecord(rt, run, state);
|
|
534
|
+
return true;
|
|
535
|
+
} catch (err) {
|
|
536
|
+
rt.log("A lifecycle record could not be written", {
|
|
537
|
+
...errorFields(err),
|
|
538
|
+
event: LIFECYCLE_EVENT.RECORD_UNWRITTEN,
|
|
539
|
+
instanceId: run.action.instanceId,
|
|
540
|
+
key: run.key,
|
|
541
|
+
state
|
|
542
|
+
});
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
async function ownRecord(rt, run) {
|
|
548
|
+
try {
|
|
549
|
+
const records = await readRecords(
|
|
550
|
+
rt,
|
|
551
|
+
run.action.instanceId,
|
|
552
|
+
run.action.startedAtMs
|
|
553
|
+
);
|
|
554
|
+
return records[run.writer];
|
|
555
|
+
} catch (err) {
|
|
556
|
+
rt.log("The re-read of a lifecycle record failed", {
|
|
557
|
+
...errorFields(err),
|
|
558
|
+
instanceId: run.action.instanceId
|
|
559
|
+
});
|
|
560
|
+
return undefined;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
async function releaseUnlessTerminal(rt, run) {
|
|
565
|
+
if (!run.claimed) return;
|
|
566
|
+
if (isTerminal(await ownRecord(rt, run))) return;
|
|
567
|
+
await writeRecord(rt, run, STATE.RELEASED);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
async function recordCompletion(rt, run, completion) {
|
|
571
|
+
if (!run.keepsRecords) return;
|
|
572
|
+
if (completion === COMPLETION.ACCEPTED) {
|
|
573
|
+
await writeRecord(rt, run, STATE.DONE);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (run.action.origin === ORIGIN.RESCUE) {
|
|
577
|
+
await writeRecord(rt, run, STATE.ENDED);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
await releaseUnlessTerminal(rt, run);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function completionInput(action, result) {
|
|
584
|
+
return {
|
|
585
|
+
AutoScalingGroupName: action.groupName,
|
|
586
|
+
LifecycleActionResult: result,
|
|
587
|
+
LifecycleHookName: action.hookName,
|
|
588
|
+
...(action.origin === ORIGIN.RESCUE
|
|
589
|
+
? { InstanceId: action.instanceId }
|
|
590
|
+
: { LifecycleActionToken: action.token })
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// The event path tries once, and a refused or failed completion is its own
|
|
595
|
+
// crash path's to handle. A rescue retries what the failure table can cure.
|
|
596
|
+
// `retry` retries any failure, for a launching CONTINUE once the volume is
|
|
597
|
+
// attached here, which must never fall through to an ABANDON.
|
|
598
|
+
async function attemptCompletion(rt, run, result, options) {
|
|
599
|
+
const retriesAny = Boolean(options && options.retry);
|
|
600
|
+
const retries = retriesAny || run.action.origin === ORIGIN.RESCUE;
|
|
601
|
+
const deadlineMs = Math.min(
|
|
602
|
+
rt.now() + COMPLETION_RETRY_BUDGET_MS,
|
|
603
|
+
rt.invocationEndMs - COMPLETION_RESERVE_MS
|
|
604
|
+
);
|
|
605
|
+
for (;;) {
|
|
606
|
+
try {
|
|
607
|
+
await send(
|
|
608
|
+
rt.clients.asgClient,
|
|
609
|
+
new CompleteLifecycleActionCommand(completionInput(run.action, result))
|
|
610
|
+
);
|
|
611
|
+
return COMPLETION.ACCEPTED;
|
|
612
|
+
} catch (err) {
|
|
613
|
+
if (isNoActiveLifecycleAction(err)) return COMPLETION.REFUSED;
|
|
614
|
+
const curable =
|
|
615
|
+
retriesAny || failureClass(err) === FAILURE_CLASS.TRANSIENT;
|
|
616
|
+
if (!retries || !curable || rt.now() >= deadlineMs) throw err;
|
|
617
|
+
await rt.sleep(
|
|
618
|
+
Math.min(COMPLETION_RETRY_INTERVAL_MS, deadlineMs - rt.now())
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
function outcomeOfCompletion(rt, run, completion) {
|
|
625
|
+
const rescue = run.action.origin === ORIGIN.RESCUE;
|
|
626
|
+
if (completion === COMPLETION.ACCEPTED) {
|
|
627
|
+
return rescue ? LIFECYCLE_EVENT.RESCUED : LIFECYCLE_EVENT.COMPLETED;
|
|
628
|
+
}
|
|
629
|
+
if (rt.now() >= run.heartbeatEndMs) return LIFECYCLE_EVENT.EXPIRED;
|
|
630
|
+
return rescue
|
|
631
|
+
? LIFECYCLE_EVENT.RESCUE_SUPERSEDED
|
|
632
|
+
: LIFECYCLE_EVENT.ALREADY_ENDED;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// `event` stays the verdict's, because the drain readers match on it. `outcome`
|
|
636
|
+
// names what became of the action. A refused ABANDON abandoned nothing, so its
|
|
637
|
+
// line must not hold the counted term.
|
|
638
|
+
function verdictFields(rt, run, result, verdict, completion) {
|
|
639
|
+
const { abandonReason, event, ...fields } = verdict;
|
|
640
|
+
const outcome = outcomeOfCompletion(rt, run, completion);
|
|
641
|
+
const abandoned =
|
|
642
|
+
abandonReason !== undefined && completion === COMPLETION.ACCEPTED;
|
|
643
|
+
return {
|
|
644
|
+
...fields,
|
|
645
|
+
...run.validation,
|
|
646
|
+
...(abandonReason !== undefined && { reason: abandonReason }),
|
|
647
|
+
completion,
|
|
648
|
+
event: abandoned ? LIFECYCLE_EVENT.LAUNCH_ABANDONED : event || outcome,
|
|
649
|
+
instanceId: run.action.instanceId,
|
|
650
|
+
origin: run.action.origin,
|
|
651
|
+
outcome,
|
|
652
|
+
result
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function logVerdict(rt, run, result, verdict, completion) {
|
|
657
|
+
try {
|
|
658
|
+
rt.log(
|
|
659
|
+
verdict.message || "The lifecycle action's run ended",
|
|
660
|
+
verdictFields(rt, run, result, verdict, completion)
|
|
661
|
+
);
|
|
662
|
+
} catch (err) {
|
|
663
|
+
console.error(
|
|
664
|
+
JSON.stringify({
|
|
665
|
+
message: "The verdict line could not be written",
|
|
666
|
+
...errorFields(err)
|
|
667
|
+
})
|
|
668
|
+
);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// The completion is the last step that can throw. The record write and the
|
|
673
|
+
// verdict line after it cannot, so the crash path never runs after an accepted
|
|
674
|
+
// completion.
|
|
675
|
+
async function completeAction(rt, run, result, verdict, options) {
|
|
676
|
+
const completion = await attemptCompletion(rt, run, result, options);
|
|
677
|
+
run.finished = true;
|
|
678
|
+
await recordCompletion(rt, run, completion);
|
|
679
|
+
logVerdict(rt, run, result, verdict || {}, completion);
|
|
680
|
+
return completion;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
async function standDownRun(rt, run, reason, fields) {
|
|
684
|
+
run.finished = true;
|
|
685
|
+
await releaseUnlessTerminal(rt, run);
|
|
686
|
+
rt.log("The lifecycle run stood down", {
|
|
687
|
+
...fields,
|
|
688
|
+
...run.validation,
|
|
689
|
+
event: STAND_DOWN_EVENT[reason] || LIFECYCLE_EVENT.STOOD_DOWN,
|
|
690
|
+
instanceId: run.action.instanceId,
|
|
691
|
+
origin: run.action.origin,
|
|
692
|
+
reason
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
async function checkpoint(rt, run, name) {
|
|
697
|
+
const { action } = run;
|
|
698
|
+
if (action.origin !== ORIGIN.RESCUE) return true;
|
|
699
|
+
let records;
|
|
700
|
+
try {
|
|
701
|
+
records = await readRecords(rt, action.instanceId, action.startedAtMs);
|
|
702
|
+
} catch (err) {
|
|
703
|
+
rt.log("A checkpoint's read failed, which never yields", {
|
|
704
|
+
checkpoint: name,
|
|
705
|
+
errorName: errName(err),
|
|
706
|
+
instanceId: action.instanceId
|
|
707
|
+
});
|
|
708
|
+
return true;
|
|
709
|
+
}
|
|
710
|
+
const ownClaim = { owner: action.owner, untilS: claimUntilS(rt) };
|
|
711
|
+
const yieldedTo = yieldsTo(records, ownClaim, rt.now());
|
|
712
|
+
if (yieldedTo === undefined) return true;
|
|
713
|
+
run.finished = true;
|
|
714
|
+
const { rescue } = records;
|
|
715
|
+
// A yield to another rescue or to a terminal record finds no live claim of
|
|
716
|
+
// this run's own on the key, so only a yield to the event path releases.
|
|
717
|
+
if (
|
|
718
|
+
rescue !== undefined &&
|
|
719
|
+
rescue.state === STATE.CLAIMED &&
|
|
720
|
+
rescue.owner === action.owner
|
|
721
|
+
) {
|
|
722
|
+
await writeRecord(rt, run, STATE.RELEASED);
|
|
723
|
+
}
|
|
724
|
+
rt.log("A rescue yielded at a checkpoint", {
|
|
725
|
+
checkpoint: name,
|
|
726
|
+
event: LIFECYCLE_EVENT.RESCUE_YIELDED,
|
|
727
|
+
instanceId: action.instanceId,
|
|
728
|
+
yieldedTo
|
|
729
|
+
});
|
|
730
|
+
return false;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
function actionDeps(rt, run) {
|
|
734
|
+
return {
|
|
735
|
+
...rt.clients,
|
|
736
|
+
checkpoint: (name) => checkpoint(rt, run, name),
|
|
737
|
+
complete: (result, verdict, options) =>
|
|
738
|
+
completeAction(rt, run, result, verdict, options),
|
|
739
|
+
env: rt.env,
|
|
740
|
+
errorFields,
|
|
741
|
+
heartbeatEndMs: run.heartbeatEndMs,
|
|
742
|
+
invocationEndMs: rt.invocationEndMs,
|
|
743
|
+
log: rt.log,
|
|
744
|
+
now: rt.now,
|
|
745
|
+
readEnv,
|
|
746
|
+
send,
|
|
747
|
+
sleep: rt.sleep,
|
|
748
|
+
standDown: (reason, fields) => standDownRun(rt, run, reason, fields)
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
async function recoverFromCrash(rt, run, deps, err) {
|
|
753
|
+
rt.log("The lifecycle handler crashed, so the action is asked for a result", {
|
|
754
|
+
...errorFields(err),
|
|
755
|
+
instanceId: run.action.instanceId
|
|
756
|
+
});
|
|
757
|
+
let recovery;
|
|
758
|
+
try {
|
|
759
|
+
recovery = await rt.action.recoverAfterCrash(run.action, deps);
|
|
760
|
+
} catch (recoverErr) {
|
|
761
|
+
rt.log("recoverAfterCrash failed", errorFields(recoverErr));
|
|
762
|
+
}
|
|
763
|
+
if (recovery !== undefined) {
|
|
764
|
+
let completion;
|
|
765
|
+
try {
|
|
766
|
+
completion = await completeAction(
|
|
767
|
+
rt,
|
|
768
|
+
run,
|
|
769
|
+
recovery.result,
|
|
770
|
+
recovery.verdict
|
|
771
|
+
);
|
|
772
|
+
} catch (completeErr) {
|
|
773
|
+
rt.log("CompleteLifecycleAction also failed", errorFields(completeErr));
|
|
774
|
+
}
|
|
775
|
+
if (completion === COMPLETION.ACCEPTED) return;
|
|
776
|
+
if (completion === COMPLETION.REFUSED) throw err;
|
|
777
|
+
}
|
|
778
|
+
await releaseUnlessTerminal(rt, run);
|
|
779
|
+
throw err;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
async function runAction(rt, run) {
|
|
783
|
+
const deps = actionDeps(rt, run);
|
|
784
|
+
try {
|
|
785
|
+
await rt.action.processAction(run.action, deps);
|
|
786
|
+
if (!run.finished)
|
|
787
|
+
await standDownRun(rt, run, STAND_DOWN_REASON.NO_VERDICT);
|
|
788
|
+
} catch (err) {
|
|
789
|
+
await recoverFromCrash(rt, run, deps, err);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
// When the lifecycle action began, as near as the message can say. That is the
|
|
794
|
+
// event's own time, else the moment EventBridge sent it to the queue.
|
|
795
|
+
function lifecycleActionStartedAtMs(record, envelope) {
|
|
796
|
+
const eventTime =
|
|
797
|
+
typeof envelope.time === "string" ? Date.parse(envelope.time) : NaN;
|
|
798
|
+
if (Number.isFinite(eventTime)) return eventTime;
|
|
799
|
+
const sentAt = Number(record.attributes && record.attributes.SentTimestamp);
|
|
800
|
+
return Number.isFinite(sentAt) && sentAt > 0 ? sentAt : undefined;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function parseLifecycleMessage(record) {
|
|
804
|
+
let envelope;
|
|
805
|
+
try {
|
|
806
|
+
envelope = JSON.parse(record.body);
|
|
807
|
+
} catch {
|
|
808
|
+
return { valid: false };
|
|
809
|
+
}
|
|
810
|
+
const detail = envelope && envelope.detail;
|
|
811
|
+
const detailType = envelope && envelope["detail-type"];
|
|
812
|
+
const valid =
|
|
813
|
+
detail !== undefined &&
|
|
814
|
+
detail !== null &&
|
|
815
|
+
typeof detail === "object" &&
|
|
816
|
+
envelope.source === "aws.autoscaling" &&
|
|
817
|
+
typeof detailType === "string" &&
|
|
818
|
+
detailType.endsWith("Lifecycle Action") &&
|
|
819
|
+
typeof detail.EC2InstanceId === "string" &&
|
|
820
|
+
typeof detail.AutoScalingGroupName === "string" &&
|
|
821
|
+
typeof detail.LifecycleActionToken === "string" &&
|
|
822
|
+
typeof detail.LifecycleHookName === "string";
|
|
823
|
+
if (!valid) return { valid: false };
|
|
824
|
+
return {
|
|
825
|
+
actionToken: detail.LifecycleActionToken,
|
|
826
|
+
asgName: detail.AutoScalingGroupName,
|
|
827
|
+
hookName: detail.LifecycleHookName,
|
|
828
|
+
instanceId: detail.EC2InstanceId,
|
|
829
|
+
startedAtMs: lifecycleActionStartedAtMs(record, envelope),
|
|
830
|
+
valid: true
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// A delivered message that fails these checks is forged or misrouted, so
|
|
835
|
+
// nothing it carries is repeated, not even its instance id unless it has an
|
|
836
|
+
// instance id's shape.
|
|
837
|
+
function namedInstance(message) {
|
|
838
|
+
return message.valid && /^i-[0-9a-f]{8,17}$/.test(message.instanceId)
|
|
839
|
+
? { instanceId: message.instanceId }
|
|
840
|
+
: {};
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
function checkMessage(rt, message) {
|
|
844
|
+
if (!message.valid || message.startedAtMs === undefined) {
|
|
845
|
+
return { class: NOT_OURS_CLASS.ENVELOPE, kind: READ.NOT_OURS };
|
|
846
|
+
}
|
|
847
|
+
if (message.hookName !== rt.config.hookName) {
|
|
848
|
+
return { class: NOT_OURS_CLASS.HOOK_NAME, kind: READ.NOT_OURS };
|
|
849
|
+
}
|
|
850
|
+
const ageMs = rt.now() - message.startedAtMs;
|
|
851
|
+
if (ageMs < -MESSAGE_TOLERANCE_MS) {
|
|
852
|
+
return { class: NOT_OURS_CLASS.TIME_AHEAD, kind: READ.NOT_OURS };
|
|
853
|
+
}
|
|
854
|
+
if (ageMs > heartbeatMsOf(rt) + MESSAGE_TOLERANCE_MS) {
|
|
855
|
+
return { class: NOT_WAITING_CLASS.OLD_MESSAGE, kind: READ.NOT_WAITING };
|
|
856
|
+
}
|
|
857
|
+
return undefined;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function unreadFrom(err) {
|
|
861
|
+
if (err && err.name === "ValidationError") {
|
|
862
|
+
return { class: NOT_OURS_CLASS.VALIDATION_ERROR, kind: READ.NOT_OURS };
|
|
863
|
+
}
|
|
864
|
+
if (err && ACCESS_DENIED_ERROR_NAMES.has(err.name)) {
|
|
865
|
+
return {
|
|
866
|
+
class: FAILURE_CLASS.PERSISTENT,
|
|
867
|
+
kind: READ.UNREAD,
|
|
868
|
+
reason: UNREAD_REASON.ACCESS_DENIED
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
const failure = failureClass(err);
|
|
872
|
+
return {
|
|
873
|
+
class: failure,
|
|
874
|
+
kind: READ.UNREAD,
|
|
875
|
+
reason:
|
|
876
|
+
failure === FAILURE_CLASS.TRANSIENT
|
|
877
|
+
? UNREAD_REASON.READ_FAILED
|
|
878
|
+
: UNREAD_REASON.OTHER
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
function unreadableAnswer() {
|
|
883
|
+
return {
|
|
884
|
+
class: FAILURE_CLASS.PERSISTENT,
|
|
885
|
+
kind: READ.UNREAD,
|
|
886
|
+
reason: UNREAD_REASON.UNREADABLE_ANSWER
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// A copy of @fjall/util's namedStackAnswer, which this CommonJS source cannot
|
|
891
|
+
// import. It reads every answer the SDK gives as util does, and reads any
|
|
892
|
+
// other value that is not a list as no list. A parity test runs the two over
|
|
893
|
+
// the same answers.
|
|
894
|
+
const NAMED_STACK_UNREADABLE = {
|
|
895
|
+
noList: "DescribeStacks answered with no stack list",
|
|
896
|
+
empty: "DescribeStacks answered an empty stack list",
|
|
897
|
+
several: "DescribeStacks answered more than one stack for one stack"
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
function namedStackAnswer(stacks) {
|
|
901
|
+
if (!Array.isArray(stacks)) {
|
|
902
|
+
return { kind: "unreadable", reason: NAMED_STACK_UNREADABLE.noList };
|
|
903
|
+
}
|
|
904
|
+
const [stack, ...others] = stacks;
|
|
905
|
+
if (stack === undefined) {
|
|
906
|
+
return { kind: "unreadable", reason: NAMED_STACK_UNREADABLE.empty };
|
|
907
|
+
}
|
|
908
|
+
if (others.length > 0) {
|
|
909
|
+
return { kind: "unreadable", reason: NAMED_STACK_UNREADABLE.several };
|
|
910
|
+
}
|
|
911
|
+
return { kind: "stack", stack };
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function tagOf(group, key) {
|
|
915
|
+
const tags = Array.isArray(group.Tags) ? group.Tags : [];
|
|
916
|
+
const tag = tags.find((candidate) => candidate.Key === key);
|
|
917
|
+
return tag === undefined ? undefined : tag.Value;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
function readGroupTags(rt, group) {
|
|
921
|
+
const stackId = tagOf(group, STACK_ID_TAG);
|
|
922
|
+
const logicalId = tagOf(group, LOGICAL_ID_TAG);
|
|
923
|
+
const { groupLogicalId, stackId: wantedStackId } = rt.config;
|
|
924
|
+
if (
|
|
925
|
+
(stackId !== undefined && stackId !== wantedStackId) ||
|
|
926
|
+
(logicalId !== undefined && logicalId !== groupLogicalId)
|
|
927
|
+
) {
|
|
928
|
+
return { class: NOT_OURS_CLASS.TAG_MISMATCH, kind: READ.NOT_OURS };
|
|
929
|
+
}
|
|
930
|
+
if (stackId === undefined || logicalId === undefined) {
|
|
931
|
+
return {
|
|
932
|
+
class: FAILURE_CLASS.PERSISTENT,
|
|
933
|
+
kind: READ.UNREAD,
|
|
934
|
+
reason: UNREAD_REASON.TAG_ABSENT
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
return undefined;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
async function readWarmPool(rt, groupName) {
|
|
941
|
+
const instances = [];
|
|
942
|
+
let nextToken;
|
|
943
|
+
do {
|
|
944
|
+
const page = await send(
|
|
945
|
+
rt.clients.asgClient,
|
|
946
|
+
new DescribeWarmPoolCommand({
|
|
947
|
+
AutoScalingGroupName: groupName,
|
|
948
|
+
...(nextToken !== undefined && { NextToken: nextToken })
|
|
949
|
+
})
|
|
950
|
+
);
|
|
951
|
+
if (!Array.isArray(page.Instances)) {
|
|
952
|
+
throw new Error("DescribeWarmPool answered with no instance list");
|
|
953
|
+
}
|
|
954
|
+
instances.push(...page.Instances);
|
|
955
|
+
nextToken = page.NextToken;
|
|
956
|
+
} while (nextToken);
|
|
957
|
+
return instances;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
async function readInstanceState(rt, group, instanceId) {
|
|
961
|
+
const inGroup = group.Instances.find(
|
|
962
|
+
(instance) => instance.InstanceId === instanceId
|
|
963
|
+
);
|
|
964
|
+
if (inGroup !== undefined) return inGroup.LifecycleState;
|
|
965
|
+
if (!group.WarmPoolConfiguration) return undefined;
|
|
966
|
+
const pool = await readWarmPool(rt, group.AutoScalingGroupName);
|
|
967
|
+
const pooled = pool.find((instance) => instance.InstanceId === instanceId);
|
|
968
|
+
return pooled === undefined ? undefined : pooled.LifecycleState;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
async function readValidation(rt, message) {
|
|
972
|
+
try {
|
|
973
|
+
const answer = await send(
|
|
974
|
+
rt.clients.asgClient,
|
|
975
|
+
new DescribeAutoScalingGroupsCommand({
|
|
976
|
+
AutoScalingGroupNames: [message.asgName]
|
|
977
|
+
})
|
|
978
|
+
);
|
|
979
|
+
if (!Array.isArray(answer.AutoScalingGroups)) return unreadableAnswer();
|
|
980
|
+
const [group] = answer.AutoScalingGroups;
|
|
981
|
+
if (group === undefined) return { kind: READ.NO_GROUP };
|
|
982
|
+
const tagVerdict = readGroupTags(rt, group);
|
|
983
|
+
if (tagVerdict !== undefined) return tagVerdict;
|
|
984
|
+
if (!Array.isArray(group.Instances)) return unreadableAnswer();
|
|
985
|
+
const state = await readInstanceState(rt, group, message.instanceId);
|
|
986
|
+
return WAIT_STATES[rt.config.transition].includes(state)
|
|
987
|
+
? { kind: READ.WAITING, lifecycleState: state }
|
|
988
|
+
: { kind: READ.NOT_WAITING, lifecycleState: state };
|
|
989
|
+
} catch (err) {
|
|
990
|
+
return unreadFrom(err);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
async function readMessageRecords(rt, message) {
|
|
995
|
+
try {
|
|
996
|
+
return await readRecords(rt, message.instanceId, message.startedAtMs);
|
|
997
|
+
} catch (err) {
|
|
998
|
+
rt.log("The record read failed, which counts as no record", {
|
|
999
|
+
...errorFields(err),
|
|
1000
|
+
...namedInstance(message)
|
|
1001
|
+
});
|
|
1002
|
+
return {};
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// A group a deletion, a replacement's cleanup or a rollback removed can still
|
|
1007
|
+
// have duplicates arrive, so only a stack at rest makes a missing group not
|
|
1008
|
+
// ours. A failed read of the stack, or an answer that holds no single stack,
|
|
1009
|
+
// proves nothing is in progress either.
|
|
1010
|
+
async function verdictOnMissingGroup(rt) {
|
|
1011
|
+
let inProgress = false;
|
|
1012
|
+
try {
|
|
1013
|
+
const answer = await send(
|
|
1014
|
+
rt.clients.cfnClient,
|
|
1015
|
+
new DescribeStacksCommand({ StackName: rt.config.stackId })
|
|
1016
|
+
);
|
|
1017
|
+
const read = namedStackAnswer(answer.Stacks);
|
|
1018
|
+
if (read.kind === "unreadable") {
|
|
1019
|
+
rt.log("DescribeStacks answered no single stack for a missing group", {
|
|
1020
|
+
reason: read.reason
|
|
1021
|
+
});
|
|
1022
|
+
} else {
|
|
1023
|
+
inProgress =
|
|
1024
|
+
typeof read.stack.StackStatus === "string" &&
|
|
1025
|
+
read.stack.StackStatus.endsWith("_IN_PROGRESS");
|
|
1026
|
+
}
|
|
1027
|
+
} catch (err) {
|
|
1028
|
+
rt.log("DescribeStacks failed while judging a missing group", {
|
|
1029
|
+
errorName: errName(err)
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
return inProgress
|
|
1033
|
+
? { class: NOT_WAITING_CLASS.NO_SUCH_GROUP, kind: READ.NOT_WAITING }
|
|
1034
|
+
: { class: NOT_OURS_CLASS.NO_SUCH_GROUP, kind: READ.NOT_OURS };
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
async function validateAction(rt, message) {
|
|
1038
|
+
const startedMs = rt.now();
|
|
1039
|
+
const deadlineMs = startedMs + VALIDATION_WINDOW_MS;
|
|
1040
|
+
let [read, records] = await Promise.all([
|
|
1041
|
+
readValidation(rt, message),
|
|
1042
|
+
readMessageRecords(rt, message)
|
|
1043
|
+
]);
|
|
1044
|
+
if (read.kind === READ.NOT_OURS) return read;
|
|
1045
|
+
if (isTerminal(records.event) || isTerminal(records.rescue)) {
|
|
1046
|
+
return { kind: READ.FINISHED };
|
|
1047
|
+
}
|
|
1048
|
+
let groupSeen = false;
|
|
1049
|
+
while (read.kind === READ.NO_GROUP || read.kind === READ.NOT_WAITING) {
|
|
1050
|
+
groupSeen = groupSeen || read.kind === READ.NOT_WAITING;
|
|
1051
|
+
if (rt.now() >= deadlineMs) {
|
|
1052
|
+
return groupSeen
|
|
1053
|
+
? {
|
|
1054
|
+
class: NOT_WAITING_CLASS.NO_WAIT_STATE,
|
|
1055
|
+
kind: READ.NOT_WAITING,
|
|
1056
|
+
lifecycleState: read.lifecycleState
|
|
1057
|
+
}
|
|
1058
|
+
: verdictOnMissingGroup(rt);
|
|
1059
|
+
}
|
|
1060
|
+
await rt.sleep(
|
|
1061
|
+
Math.min(VALIDATION_READ_INTERVAL_MS, deadlineMs - rt.now())
|
|
1062
|
+
);
|
|
1063
|
+
read = await readValidation(rt, message);
|
|
1064
|
+
}
|
|
1065
|
+
return { ...read, validationMs: rt.now() - startedMs };
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
function logStandDown(rt, message, verdict) {
|
|
1069
|
+
const line = {
|
|
1070
|
+
...namedInstance(message),
|
|
1071
|
+
class: verdict.class,
|
|
1072
|
+
...(verdict.lifecycleState !== undefined && {
|
|
1073
|
+
lifecycleState: verdict.lifecycleState
|
|
1074
|
+
})
|
|
1075
|
+
};
|
|
1076
|
+
if (verdict.kind === READ.NOT_OURS) {
|
|
1077
|
+
rt.log("The message is not this hook's, so the run stands down", {
|
|
1078
|
+
...line,
|
|
1079
|
+
event: LIFECYCLE_EVENT.NOT_OURS
|
|
1080
|
+
});
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
if (verdict.kind === READ.NOT_WAITING) {
|
|
1084
|
+
rt.log("The instance is not waiting on this hook, so the run stands down", {
|
|
1085
|
+
...line,
|
|
1086
|
+
event: LIFECYCLE_EVENT.NOT_WAITING
|
|
1087
|
+
});
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
rt.log("A record shows this action is over, so the run stands down", {
|
|
1091
|
+
...namedInstance(message),
|
|
1092
|
+
event: LIFECYCLE_EVENT.FINISHED
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
function eventAction(rt, message, hookName) {
|
|
1097
|
+
return {
|
|
1098
|
+
groupName: message.asgName,
|
|
1099
|
+
hookName,
|
|
1100
|
+
instanceId: message.instanceId,
|
|
1101
|
+
origin: ORIGIN.EVENT,
|
|
1102
|
+
owner: rt.owner,
|
|
1103
|
+
startedAtMs: message.startedAtMs,
|
|
1104
|
+
token: message.actionToken,
|
|
1105
|
+
untilMs: rt.invocationEndMs
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
// The new keys can be missing because CloudFormation updates code and
|
|
1110
|
+
// configuration in separate calls. Refusing here would lose a delivered
|
|
1111
|
+
// notification, so the run is today's, with no validation and no records.
|
|
1112
|
+
async function runWithoutRecords(rt, message) {
|
|
1113
|
+
rt.log("The lifecycle environment is incomplete", {
|
|
1114
|
+
event: LIFECYCLE_EVENT.ENV_INCOMPLETE,
|
|
1115
|
+
missing: rt.config.missing
|
|
1116
|
+
});
|
|
1117
|
+
if (!message.valid) {
|
|
1118
|
+
logStandDown(rt, message, {
|
|
1119
|
+
class: NOT_OURS_CLASS.ENVELOPE,
|
|
1120
|
+
kind: READ.NOT_OURS
|
|
1121
|
+
});
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
const dated = {
|
|
1125
|
+
...message,
|
|
1126
|
+
startedAtMs: message.startedAtMs ?? rt.now()
|
|
1127
|
+
};
|
|
1128
|
+
await runAction(rt, createRun(rt, eventAction(rt, dated, message.hookName)));
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
async function runEventRecord(rt, record) {
|
|
1132
|
+
const message = parseLifecycleMessage(record);
|
|
1133
|
+
if (!rt.config.complete) {
|
|
1134
|
+
await runWithoutRecords(rt, message);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
const refusal = checkMessage(rt, message);
|
|
1138
|
+
if (refusal !== undefined) {
|
|
1139
|
+
logStandDown(rt, message, refusal);
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
const verdict = await validateAction(rt, message);
|
|
1143
|
+
if (verdict.kind !== READ.WAITING && verdict.kind !== READ.UNREAD) {
|
|
1144
|
+
logStandDown(rt, message, verdict);
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
if (verdict.kind === READ.UNREAD) {
|
|
1148
|
+
rt.log("Validation could not read the action, so the run proceeds", {
|
|
1149
|
+
class: verdict.class,
|
|
1150
|
+
event: LIFECYCLE_EVENT.VALIDATION_UNREAD,
|
|
1151
|
+
instanceId: message.instanceId,
|
|
1152
|
+
reason: verdict.reason
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
const run = createRun(rt, eventAction(rt, message, rt.config.hookName));
|
|
1156
|
+
run.validation = {
|
|
1157
|
+
validation: verdict.kind,
|
|
1158
|
+
...(verdict.kind === READ.UNREAD && { validationClass: verdict.class }),
|
|
1159
|
+
validationMs: verdict.validationMs
|
|
1160
|
+
};
|
|
1161
|
+
run.claimed = await writeRecord(rt, run, STATE.CLAIMED);
|
|
1162
|
+
await runAction(rt, run);
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
async function describeGroups(rt, input) {
|
|
1166
|
+
const groups = [];
|
|
1167
|
+
let nextToken;
|
|
1168
|
+
do {
|
|
1169
|
+
const page = await send(
|
|
1170
|
+
rt.clients.asgClient,
|
|
1171
|
+
new DescribeAutoScalingGroupsCommand({
|
|
1172
|
+
...input,
|
|
1173
|
+
...(nextToken !== undefined && { NextToken: nextToken })
|
|
1174
|
+
})
|
|
1175
|
+
);
|
|
1176
|
+
if (!Array.isArray(page.AutoScalingGroups)) {
|
|
1177
|
+
throw new Error("DescribeAutoScalingGroups answered with no group list");
|
|
1178
|
+
}
|
|
1179
|
+
groups.push(...page.AutoScalingGroups);
|
|
1180
|
+
nextToken = page.NextToken;
|
|
1181
|
+
} while (nextToken);
|
|
1182
|
+
return groups;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
function undiscovered(detail) {
|
|
1186
|
+
const err = new Error(`The hook's group cannot be discovered: ${detail}`);
|
|
1187
|
+
err.name = DISCOVERY.UNDISCOVERED;
|
|
1188
|
+
return err;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
// Only an operation in progress can leave a correct logical id absent, so any
|
|
1192
|
+
// other status is a wrong logical id, which must page rather than read benign.
|
|
1193
|
+
// An answer that holds no single stack pages too.
|
|
1194
|
+
async function discoverAbsentResource(rt) {
|
|
1195
|
+
const answer = await send(
|
|
1196
|
+
rt.clients.cfnClient,
|
|
1197
|
+
new DescribeStacksCommand({ StackName: rt.config.stackId })
|
|
1198
|
+
);
|
|
1199
|
+
const read = namedStackAnswer(answer.Stacks);
|
|
1200
|
+
if (read.kind === "unreadable") throw undiscovered(read.reason);
|
|
1201
|
+
const status = read.stack.StackStatus;
|
|
1202
|
+
if (typeof status === "string" && status.endsWith("_IN_PROGRESS")) {
|
|
1203
|
+
return { groups: [], mode: DISCOVERY.ABSENT_IN_PROGRESS };
|
|
1204
|
+
}
|
|
1205
|
+
throw undiscovered("the stack holds no such logical id");
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
async function discoverThroughStack(rt) {
|
|
1209
|
+
const { groupLogicalId, stackId } = rt.config;
|
|
1210
|
+
let detail;
|
|
1211
|
+
try {
|
|
1212
|
+
const answer = await send(
|
|
1213
|
+
rt.clients.cfnClient,
|
|
1214
|
+
new DescribeStackResourceCommand({
|
|
1215
|
+
LogicalResourceId: groupLogicalId,
|
|
1216
|
+
StackName: stackId
|
|
1217
|
+
})
|
|
1218
|
+
);
|
|
1219
|
+
detail = answer.StackResourceDetail;
|
|
1220
|
+
} catch (err) {
|
|
1221
|
+
if (
|
|
1222
|
+
err &&
|
|
1223
|
+
err.name === "ValidationError" &&
|
|
1224
|
+
errMessage(err).includes(groupLogicalId)
|
|
1225
|
+
) {
|
|
1226
|
+
return discoverAbsentResource(rt);
|
|
1227
|
+
}
|
|
1228
|
+
throw err;
|
|
1229
|
+
}
|
|
1230
|
+
if (detail === undefined) {
|
|
1231
|
+
throw new Error("DescribeStackResource answered with no resource detail");
|
|
1232
|
+
}
|
|
1233
|
+
const status = String(detail.ResourceStatus);
|
|
1234
|
+
if (status.startsWith("DELETE_")) {
|
|
1235
|
+
return { groups: [], mode: DISCOVERY.BEING_DELETED };
|
|
1236
|
+
}
|
|
1237
|
+
const groups = detail.PhysicalResourceId
|
|
1238
|
+
? await describeGroups(rt, {
|
|
1239
|
+
AutoScalingGroupNames: [detail.PhysicalResourceId]
|
|
1240
|
+
})
|
|
1241
|
+
: [];
|
|
1242
|
+
if (groups.length > 0) return { groups, mode: DISCOVERY.STACK_RESOURCE };
|
|
1243
|
+
if (status.endsWith("_IN_PROGRESS")) {
|
|
1244
|
+
return { groups: [], mode: DISCOVERY.BEING_CREATED };
|
|
1245
|
+
}
|
|
1246
|
+
throw undiscovered("the stack's group is not in Auto Scaling");
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
async function discoverGroups(rt) {
|
|
1250
|
+
const { groupLogicalId, stackId } = rt.config;
|
|
1251
|
+
const tagged = await describeGroups(rt, {
|
|
1252
|
+
Filters: [
|
|
1253
|
+
{ Name: `tag:${STACK_ID_TAG}`, Values: [stackId] },
|
|
1254
|
+
{ Name: `tag:${LOGICAL_ID_TAG}`, Values: [groupLogicalId] }
|
|
1255
|
+
]
|
|
1256
|
+
});
|
|
1257
|
+
if (tagged.length > 0) return { groups: tagged, mode: DISCOVERY.FOUND };
|
|
1258
|
+
return discoverThroughStack(rt);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
async function describeHooks(rt, groupName) {
|
|
1262
|
+
const answer = await send(
|
|
1263
|
+
rt.clients.asgClient,
|
|
1264
|
+
new DescribeLifecycleHooksCommand({ AutoScalingGroupName: groupName })
|
|
1265
|
+
);
|
|
1266
|
+
if (!Array.isArray(answer.LifecycleHooks)) {
|
|
1267
|
+
throw new Error("DescribeLifecycleHooks answered with no hook list");
|
|
1268
|
+
}
|
|
1269
|
+
return answer.LifecycleHooks;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
async function listWaiting(rt, group) {
|
|
1273
|
+
if (!Array.isArray(group.Instances)) {
|
|
1274
|
+
throw new Error("A group answered with no instance list");
|
|
1275
|
+
}
|
|
1276
|
+
const { transition } = rt.config;
|
|
1277
|
+
const waiting = group.Instances.filter((instance) =>
|
|
1278
|
+
GROUP_WAIT_STATES[transition].includes(instance.LifecycleState)
|
|
1279
|
+
);
|
|
1280
|
+
if (transition !== TRANSITION.TERMINATING || !group.WarmPoolConfiguration) {
|
|
1281
|
+
return waiting;
|
|
1282
|
+
}
|
|
1283
|
+
const pool = await readWarmPool(rt, group.AutoScalingGroupName);
|
|
1284
|
+
return [
|
|
1285
|
+
...waiting,
|
|
1286
|
+
...pool.filter((instance) =>
|
|
1287
|
+
[WARMED_PENDING_WAIT, WARMED_TERMINATING_WAIT].includes(
|
|
1288
|
+
instance.LifecycleState
|
|
1289
|
+
)
|
|
1290
|
+
)
|
|
1291
|
+
];
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
async function readActivities(rt, groupName) {
|
|
1295
|
+
const activities = [];
|
|
1296
|
+
let nextToken;
|
|
1297
|
+
for (let page = 0; page < ACTIVITY_PAGE_LIMIT; page += 1) {
|
|
1298
|
+
const answer = await send(
|
|
1299
|
+
rt.clients.asgClient,
|
|
1300
|
+
new DescribeScalingActivitiesCommand({
|
|
1301
|
+
AutoScalingGroupName: groupName,
|
|
1302
|
+
MaxRecords: ACTIVITY_PAGE_SIZE,
|
|
1303
|
+
...(nextToken !== undefined && { NextToken: nextToken })
|
|
1304
|
+
})
|
|
1305
|
+
);
|
|
1306
|
+
if (!Array.isArray(answer.Activities)) {
|
|
1307
|
+
throw new Error("DescribeScalingActivities answered with no list");
|
|
1308
|
+
}
|
|
1309
|
+
activities.push(...answer.Activities);
|
|
1310
|
+
nextToken = answer.NextToken;
|
|
1311
|
+
if (!nextToken) break;
|
|
1312
|
+
}
|
|
1313
|
+
return activities;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
function namesInstance(activity, instanceId) {
|
|
1317
|
+
return String(activity.Description || "")
|
|
1318
|
+
.split(/[^A-Za-z0-9-]+/)
|
|
1319
|
+
.includes(instanceId);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
function dateAction(activities, instance, instanceId, lifecycleState) {
|
|
1323
|
+
const activity = activities.find(
|
|
1324
|
+
(candidate) =>
|
|
1325
|
+
!ENDED_ACTIVITY_STATUSES.includes(candidate.StatusCode) &&
|
|
1326
|
+
namesInstance(candidate, instanceId)
|
|
1327
|
+
);
|
|
1328
|
+
const activityMs = activity ? new Date(activity.StartTime).getTime() : NaN;
|
|
1329
|
+
if (Number.isFinite(activityMs)) {
|
|
1330
|
+
return { activityId: activity.ActivityId, startedAtMs: activityMs };
|
|
1331
|
+
}
|
|
1332
|
+
if (lifecycleState !== WAITING) return undefined;
|
|
1333
|
+
const launchMs =
|
|
1334
|
+
instance && instance.LaunchTime
|
|
1335
|
+
? new Date(instance.LaunchTime).getTime()
|
|
1336
|
+
: NaN;
|
|
1337
|
+
return Number.isFinite(launchMs) ? { startedAtMs: launchMs } : undefined;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
function rescueAction(rt, candidate) {
|
|
1341
|
+
return {
|
|
1342
|
+
groupName: candidate.groupName,
|
|
1343
|
+
hookName: rt.config.hookName,
|
|
1344
|
+
instanceId: candidate.instanceId,
|
|
1345
|
+
origin: ORIGIN.RESCUE,
|
|
1346
|
+
owner: rt.owner,
|
|
1347
|
+
startedAtMs: candidate.startedAtMs,
|
|
1348
|
+
untilMs: rt.invocationEndMs
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
async function reportAction(rt, candidate, state, event, message) {
|
|
1353
|
+
const run = createRun(rt, rescueAction(rt, candidate));
|
|
1354
|
+
await writeRecord(rt, run, state);
|
|
1355
|
+
rt.log(message, {
|
|
1356
|
+
event,
|
|
1357
|
+
groupName: candidate.groupName,
|
|
1358
|
+
instanceId: candidate.instanceId
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
async function applyDecision(rt, tick, candidate, decision) {
|
|
1363
|
+
const { summary } = tick;
|
|
1364
|
+
if (decision === DECISION.DEFER) summary.deferred += 1;
|
|
1365
|
+
if (decision === DECISION.FINISHED) summary.finished += 1;
|
|
1366
|
+
if (decision === DECISION.HELD) summary.held += 1;
|
|
1367
|
+
if (decision === DECISION.REPORTED) summary.reported += 1;
|
|
1368
|
+
if (decision === DECISION.RESCUE) tick.candidates.push(candidate);
|
|
1369
|
+
if (decision === DECISION.UNRESCUED) {
|
|
1370
|
+
summary.unrescued += 1;
|
|
1371
|
+
await reportAction(
|
|
1372
|
+
rt,
|
|
1373
|
+
candidate,
|
|
1374
|
+
STATE.UNRESCUED,
|
|
1375
|
+
LIFECYCLE_EVENT.UNRESCUED,
|
|
1376
|
+
"A lost action reached the sweep below its floor, so it takes its default"
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
if (decision === DECISION.EXPIRED) {
|
|
1380
|
+
summary.expired += 1;
|
|
1381
|
+
await reportAction(
|
|
1382
|
+
rt,
|
|
1383
|
+
candidate,
|
|
1384
|
+
STATE.EXPIRED,
|
|
1385
|
+
LIFECYCLE_EVENT.EXPIRED,
|
|
1386
|
+
"A lost action reached the sweep at or past its heartbeat"
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
async function decideWaiting(rt, tick, groupName, waiting) {
|
|
1392
|
+
const activities = await readActivities(rt, groupName);
|
|
1393
|
+
const instances = await describeInstances(
|
|
1394
|
+
rt,
|
|
1395
|
+
waiting.map((instance) => instance.InstanceId)
|
|
1396
|
+
);
|
|
1397
|
+
for (const { InstanceId: instanceId, LifecycleState: state } of waiting) {
|
|
1398
|
+
const instance = instances.find(
|
|
1399
|
+
(candidate) => candidate.InstanceId === instanceId
|
|
1400
|
+
);
|
|
1401
|
+
const dated = dateAction(activities, instance, instanceId, state);
|
|
1402
|
+
if (dated === undefined || instance === undefined) {
|
|
1403
|
+
tick.summary.undated += 1;
|
|
1404
|
+
rt.log("A waiting action cannot be dated, so it is left alone", {
|
|
1405
|
+
event: LIFECYCLE_EVENT.UNDATED,
|
|
1406
|
+
groupName,
|
|
1407
|
+
instanceId
|
|
1408
|
+
});
|
|
1409
|
+
continue;
|
|
1410
|
+
}
|
|
1411
|
+
const records = ofAction(
|
|
1412
|
+
rt,
|
|
1413
|
+
recordsOfInstance(rt, instance),
|
|
1414
|
+
dated.startedAtMs
|
|
1415
|
+
);
|
|
1416
|
+
const decision = decideAction({
|
|
1417
|
+
deferMs: rt.config.deferMs,
|
|
1418
|
+
floorMs: tick.floorMs,
|
|
1419
|
+
heartbeatMs: heartbeatMsOf(rt),
|
|
1420
|
+
nowMs: rt.now(),
|
|
1421
|
+
records,
|
|
1422
|
+
startedAtMs: dated.startedAtMs
|
|
1423
|
+
});
|
|
1424
|
+
await applyDecision(
|
|
1425
|
+
rt,
|
|
1426
|
+
tick,
|
|
1427
|
+
{ ...dated, groupName, instanceId },
|
|
1428
|
+
decision
|
|
1429
|
+
);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
async function sweepGroup(rt, tick, group) {
|
|
1434
|
+
const groupName = group.AutoScalingGroupName;
|
|
1435
|
+
const waiting = await listWaiting(rt, group);
|
|
1436
|
+
if (waiting.length === 0) return;
|
|
1437
|
+
const hooks = await describeHooks(rt, groupName);
|
|
1438
|
+
if (!hooks.some((hook) => hook.LifecycleHookName === rt.config.hookName)) {
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
const hasLaunchingHook = hooks.some(
|
|
1442
|
+
(hook) => hook.LifecycleTransition === LAUNCHING_TRANSITION
|
|
1443
|
+
);
|
|
1444
|
+
const attributed = [];
|
|
1445
|
+
for (const instance of waiting) {
|
|
1446
|
+
if (instance.LifecycleState === WARMED_PENDING_WAIT && hasLaunchingHook) {
|
|
1447
|
+
tick.summary.unattributed += 1;
|
|
1448
|
+
rt.log(
|
|
1449
|
+
"A warm pool instance's hook cannot be told, so it is left alone",
|
|
1450
|
+
{
|
|
1451
|
+
event: LIFECYCLE_EVENT.UNATTRIBUTED,
|
|
1452
|
+
groupName,
|
|
1453
|
+
instanceId: instance.InstanceId
|
|
1454
|
+
}
|
|
1455
|
+
);
|
|
1456
|
+
} else {
|
|
1457
|
+
attributed.push(instance);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
tick.summary.waiting += attributed.length;
|
|
1461
|
+
if (attributed.length > 0) {
|
|
1462
|
+
await decideWaiting(rt, tick, groupName, attributed);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
async function runRescue(rt, candidate) {
|
|
1467
|
+
const run = createRun(rt, rescueAction(rt, candidate));
|
|
1468
|
+
await putRecord(rt, run, STATE.CLAIMED);
|
|
1469
|
+
run.claimed = true;
|
|
1470
|
+
if (!(await checkpoint(rt, run, CHECKPOINT_CLAIMED))) return;
|
|
1471
|
+
rt.log("A rescue started", {
|
|
1472
|
+
...(candidate.activityId !== undefined && {
|
|
1473
|
+
activityId: candidate.activityId
|
|
1474
|
+
}),
|
|
1475
|
+
event: LIFECYCLE_EVENT.RESCUE_STARTED,
|
|
1476
|
+
groupName: candidate.groupName,
|
|
1477
|
+
instanceId: candidate.instanceId,
|
|
1478
|
+
startLagMs: rt.now() - candidate.startedAtMs
|
|
1479
|
+
});
|
|
1480
|
+
const deps = actionDeps(rt, run);
|
|
1481
|
+
try {
|
|
1482
|
+
await rt.action.processAction(run.action, deps);
|
|
1483
|
+
if (!run.finished)
|
|
1484
|
+
await standDownRun(rt, run, STAND_DOWN_REASON.NO_VERDICT);
|
|
1485
|
+
} catch (err) {
|
|
1486
|
+
await releaseUnlessTerminal(rt, run);
|
|
1487
|
+
throw err;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
function recordTickFailure(rt, tick, err, fields) {
|
|
1492
|
+
tick.summary.failed += 1;
|
|
1493
|
+
tick.failures.push(err);
|
|
1494
|
+
rt.log("The reconcile tick met a failure", {
|
|
1495
|
+
...fields,
|
|
1496
|
+
...errorFields(err),
|
|
1497
|
+
event: LIFECYCLE_EVENT.RECONCILE_FAILED
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
function readRescueFloorMs(rt) {
|
|
1502
|
+
const internals = rt.action._internals;
|
|
1503
|
+
const floorMs =
|
|
1504
|
+
internals && typeof internals.rescueFloorMs === "function"
|
|
1505
|
+
? internals.rescueFloorMs(rt.env)
|
|
1506
|
+
: undefined;
|
|
1507
|
+
return typeof floorMs === "number" && floorMs > 0 ? floorMs : undefined;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
function tickRefusal(rt, floorMs) {
|
|
1511
|
+
if (!rt.config.complete) {
|
|
1512
|
+
return new Error(
|
|
1513
|
+
`The tick refuses an incomplete environment: ${rt.config.missing.join(", ")}`
|
|
1514
|
+
);
|
|
1515
|
+
}
|
|
1516
|
+
return floorMs === undefined
|
|
1517
|
+
? new Error("The action module states no rescue floor")
|
|
1518
|
+
: undefined;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
async function discoverForTick(rt, tick) {
|
|
1522
|
+
const refusal = tickRefusal(rt, tick.floorMs);
|
|
1523
|
+
if (refusal !== undefined) {
|
|
1524
|
+
tick.summary.discovery = DISCOVERY.REFUSED;
|
|
1525
|
+
recordTickFailure(rt, tick, refusal, { step: "refusal" });
|
|
1526
|
+
return [];
|
|
1527
|
+
}
|
|
1528
|
+
try {
|
|
1529
|
+
const { groups, mode } = await discoverGroups(rt);
|
|
1530
|
+
tick.summary.discovery = mode;
|
|
1531
|
+
tick.summary.groups = groups.length;
|
|
1532
|
+
return groups;
|
|
1533
|
+
} catch (err) {
|
|
1534
|
+
tick.summary.discovery = DISCOVERY.UNDISCOVERED;
|
|
1535
|
+
recordTickFailure(rt, tick, err, { step: "discovery" });
|
|
1536
|
+
return [];
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
async function runRescues(rt, tick) {
|
|
1541
|
+
const ordered = [...tick.candidates].sort(
|
|
1542
|
+
(a, b) => a.startedAtMs - b.startedAtMs
|
|
1543
|
+
);
|
|
1544
|
+
const started = ordered.slice(0, RESCUES_PER_TICK);
|
|
1545
|
+
tick.summary.started = started.length;
|
|
1546
|
+
tick.summary.overflow = ordered.length - started.length;
|
|
1547
|
+
const settled = await Promise.allSettled(
|
|
1548
|
+
started.map((candidate) => runRescue(rt, candidate))
|
|
1549
|
+
);
|
|
1550
|
+
settled.forEach((outcome, index) => {
|
|
1551
|
+
if (outcome.status === "fulfilled") return;
|
|
1552
|
+
recordTickFailure(rt, tick, outcome.reason, {
|
|
1553
|
+
groupName: started[index].groupName,
|
|
1554
|
+
instanceId: started[index].instanceId,
|
|
1555
|
+
step: "rescue"
|
|
1556
|
+
});
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
async function runTick(rt) {
|
|
1561
|
+
const tick = {
|
|
1562
|
+
candidates: [],
|
|
1563
|
+
failures: [],
|
|
1564
|
+
floorMs: readRescueFloorMs(rt),
|
|
1565
|
+
summary: {
|
|
1566
|
+
deferred: 0,
|
|
1567
|
+
discovery: undefined,
|
|
1568
|
+
expired: 0,
|
|
1569
|
+
failed: 0,
|
|
1570
|
+
finished: 0,
|
|
1571
|
+
groups: 0,
|
|
1572
|
+
held: 0,
|
|
1573
|
+
overflow: 0,
|
|
1574
|
+
reported: 0,
|
|
1575
|
+
started: 0,
|
|
1576
|
+
unattributed: 0,
|
|
1577
|
+
undated: 0,
|
|
1578
|
+
unrescued: 0,
|
|
1579
|
+
waiting: 0
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
const groups = await discoverForTick(rt, tick);
|
|
1583
|
+
for (const group of groups) {
|
|
1584
|
+
try {
|
|
1585
|
+
await sweepGroup(rt, tick, group);
|
|
1586
|
+
} catch (err) {
|
|
1587
|
+
recordTickFailure(rt, tick, err, {
|
|
1588
|
+
groupName: group.AutoScalingGroupName,
|
|
1589
|
+
step: "sweep"
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
await runRescues(rt, tick);
|
|
1594
|
+
rt.log("Reconcile tick", {
|
|
1595
|
+
event: LIFECYCLE_EVENT.RECONCILE_TICK,
|
|
1596
|
+
...tick.summary
|
|
1597
|
+
});
|
|
1598
|
+
if (tick.failures.length > 0) throw tick.failures[0];
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
async function runRecords(rt, records) {
|
|
1602
|
+
const failures = [];
|
|
1603
|
+
for (const record of records) {
|
|
1604
|
+
try {
|
|
1605
|
+
await runEventRecord(rt, record);
|
|
1606
|
+
} catch (err) {
|
|
1607
|
+
failures.push(err);
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
if (failures.length > 0) throw failures[0];
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
function isTick(event) {
|
|
1614
|
+
return Boolean(event) && event.fjallLifecycleTick === 1;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
// Refuses at init an action module that lacks the two exports the core calls,
|
|
1618
|
+
// so every invocation errors and the Errors alarm shows it.
|
|
1619
|
+
function entry(lifecycleAction, overrides) {
|
|
1620
|
+
const missing = ["processAction", "recoverAfterCrash"].filter(
|
|
1621
|
+
(name) => typeof (lifecycleAction || {})[name] !== "function"
|
|
1622
|
+
);
|
|
1623
|
+
if (missing.length > 0) {
|
|
1624
|
+
throw new Error(`The action module lacks ${missing.join(" and ")}`);
|
|
1625
|
+
}
|
|
1626
|
+
return async (event, context) => {
|
|
1627
|
+
const rt = createRuntime(lifecycleAction, context, overrides);
|
|
1628
|
+
if (isTick(event)) {
|
|
1629
|
+
await runTick(rt);
|
|
1630
|
+
return;
|
|
1631
|
+
}
|
|
1632
|
+
await runRecords(rt, (event && event.Records) || []);
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
exports.entry = entry;
|
|
1637
|
+
|
|
1638
|
+
exports._internals = {
|
|
1639
|
+
belongsToAction,
|
|
1640
|
+
checkMessage,
|
|
1641
|
+
completeAction,
|
|
1642
|
+
createRun,
|
|
1643
|
+
createRuntime,
|
|
1644
|
+
dateAction,
|
|
1645
|
+
decideAction,
|
|
1646
|
+
discoverGroups,
|
|
1647
|
+
entry,
|
|
1648
|
+
errorFields,
|
|
1649
|
+
failureClass,
|
|
1650
|
+
formatRecordValue,
|
|
1651
|
+
isLiveClaim,
|
|
1652
|
+
isNoActiveLifecycleAction,
|
|
1653
|
+
isTerminal,
|
|
1654
|
+
namedStackAnswer,
|
|
1655
|
+
outranks,
|
|
1656
|
+
parseLifecycleMessage,
|
|
1657
|
+
parseRecordValue,
|
|
1658
|
+
readConfig,
|
|
1659
|
+
readEnv,
|
|
1660
|
+
recordCompletion,
|
|
1661
|
+
send,
|
|
1662
|
+
validateAction,
|
|
1663
|
+
writeRecord,
|
|
1664
|
+
yieldsTo,
|
|
1665
|
+
ACTIVITY_PAGE_LIMIT,
|
|
1666
|
+
ACTIVITY_PAGE_SIZE,
|
|
1667
|
+
CLAIM_GRACE_MS,
|
|
1668
|
+
COMPLETION,
|
|
1669
|
+
COMPLETION_RESERVE_MS,
|
|
1670
|
+
COMPLETION_RETRY_BUDGET_MS,
|
|
1671
|
+
COMPLETION_RETRY_INTERVAL_MS,
|
|
1672
|
+
DECISION,
|
|
1673
|
+
DEFAULT_HEARTBEAT_SECONDS,
|
|
1674
|
+
DISCOVERY,
|
|
1675
|
+
FAILURE_CLASS,
|
|
1676
|
+
LIFECYCLE_EVENT,
|
|
1677
|
+
MESSAGE_TOLERANCE_MS,
|
|
1678
|
+
NOT_OURS_CLASS,
|
|
1679
|
+
NOT_WAITING_CLASS,
|
|
1680
|
+
ORIGIN,
|
|
1681
|
+
READ,
|
|
1682
|
+
RECORD_STATES,
|
|
1683
|
+
RECORD_TOLERANCE_SECONDS,
|
|
1684
|
+
RESCUES_PER_TICK,
|
|
1685
|
+
SDK_CALL_TIMEOUT_MS,
|
|
1686
|
+
STAND_DOWN_REASON,
|
|
1687
|
+
STATE,
|
|
1688
|
+
TRANSITION,
|
|
1689
|
+
UNREAD_REASON,
|
|
1690
|
+
VALIDATION_READ_INTERVAL_MS,
|
|
1691
|
+
VALIDATION_WINDOW_MS,
|
|
1692
|
+
WAIT_STATES,
|
|
1693
|
+
YIELD
|
|
1694
|
+
};
|