MCPcopy
hub / github.com/serverless/serverless / restore

Method restore

packages/serverless/lib/plugins/aws/dev/index.js:731–753  ·  view source on GitHub ↗

* Restores the serverless service configuration to its original state. Specifically: * 1. Resets the IAM configuration. * 2. Resets all function configurations to their original handler, runtime, and environment variables. * * @async * @returns {Promise } A promise that resol

()

Source from the content-addressed store, hash-verified

729 * @returns {Promise<void>} A promise that resolves once all configurations have been successfully restored.
730 */
731 async restore() {
732 logger.debug(
733 'Restoring service configuration to its original state in memory',
734 )
735 this.serverless.service.provider.iam = this.originalIamConfig
736
737 this.serverless.service.getAllFunctions().forEach((functionName) => {
738 const functionConfig = this.serverless.service.getFunction(functionName)
739
740 const originalFunctionConfig = this.originalFunctionConfigs[functionName]
741
742 // If the function was not updated, we don't need to restore it
743 if (!originalFunctionConfig) {
744 return
745 }
746
747 const { handler, runtime, environment } = originalFunctionConfig
748
749 functionConfig.handler = handler
750 functionConfig.environment = environment
751 functionConfig.runtime = this.provider.getRuntime(runtime)
752 })
753 }
754
755 /**
756 * Clears service-level and per-function package artifacts in the in-memory configuration.

Callers 1

devMethod · 0.95

Calls 4

debugMethod · 0.80
getAllFunctionsMethod · 0.80
getFunctionMethod · 0.45
getRuntimeMethod · 0.45

Tested by

no test coverage detected