# FunctionVersionUpgrade

Aspect for upgrading function versions when the provided feature flag is enabled.

This can be necessary when the feature flag
changes the function hash, as such changes must be associated with a new
version. This aspect will change the function description in these cases,
which "validates" the new function hash.

Extends: FunctionVersionUpgrade
Implements: IAspect

- Source: [`aws-lambda/lib/function.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-lambda/lib/function.ts#L1896)
- Type last changed: v2.27.0 · 3 Jun 2022

## Example

```ts
const stack = new Stack();
Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(LAMBDA_RECOGNIZE_VERSION_PROPS));
```

## Initializer

```ts
new FunctionVersionUpgrade(featureFlag: string, enabled?: boolean)
```

## Methods

- `visit(node: IConstruct): void` — All aspects can visit an IConstruct.
