SIGN IN SIGN UP

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.

0 0 106 Java
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import {
LambdaClient,
UpdateFunctionConfigurationCommand,
waitUntilFunctionUpdated,
} from "@aws-sdk/client-lambda";
import { readFileSync } from "node:fs";
import { dirnameFromMetaUrl } from "@aws-doc-sdk-examples/lib/utils/util-fs.js";
import { waitForFunctionUpdated } from "../waiters/index.js";
const dirname = dirnameFromMetaUrl(import.meta.url);
2022-09-19 14:05:31 -04:00
/** snippet-start:[javascript.v3.lambda.actions.UpdateFunctionConfiguration] */
const updateFunctionConfiguration = (funcName) => {
const client = new LambdaClient({});
const config = readFileSync(`${dirname}../functions/config.json`).toString();
const command = new UpdateFunctionConfigurationCommand({
...JSON.parse(config),
FunctionName: funcName,
});
const result = client.send(command);
waitForFunctionUpdated({ FunctionName: funcName });
return result;
};
2022-09-19 14:05:31 -04:00
/** snippet-end:[javascript.v3.lambda.actions.UpdateFunctionConfiguration] */
export { updateFunctionConfiguration };