import { Construct } from "constructs"; import * as cdk from "aws-cdk-lib"; import * as lambda from "aws-cdk-lib/aws-lambda"; import { FunctionProps, Function as Fn } from "./Function.js"; import * as Config from "./Config.js"; import { SSTConstruct } from "./Construct.js"; import { Permissions } from "./util/permission.js"; export declare type StackProps = cdk.StackProps; /** * The Stack construct extends cdk.Stack. It automatically prefixes the stack names with the stage and app name to ensure that they can be deployed to multiple regions in the same AWS account. It also ensure that the stack uses the same AWS profile and region as the app. They're defined using functions that return resources that can be imported by other stacks. * * @example * * ```js * import { StackContext } from "@serverless-stack/resources"; * * export function MyStack({ stack }: StackContext) { * // Define your stack * } * ``` */ export declare class Stack extends cdk.Stack { /** * The current stage of the stack. */ readonly stage: string; /** * @internal */ readonly defaultFunctionProps: FunctionProps[]; /** * @internal */ readonly customResourceHandler: lambda.Function; private readonly metadata; constructor(scope: Construct, id: string, props?: StackProps); /** * The default function props to be applied to all the Lambda functions in the stack. * * @example * ```js * stack.setDefaultFunctionProps({ * srcPath: "backend", * runtime: "nodejs16.x", * }); * ``` */ setDefaultFunctionProps(props: FunctionProps): void; /** * Adds additional default Permissions to be applied to all Lambda functions in the stack. * * @example * ```js * stack.addDefaultFunctionPermissions(["sqs", "s3"]); * ``` */ addDefaultFunctionPermissions(permissions: Permissions): void; /** * Adds additional default environment variables to be applied to all Lambda functions in the stack. * * @example * ```js * stack.addDefaultFunctionEnv({ * DYNAMO_TABLE: table.name * }); * ``` */ addDefaultFunctionEnv(environment: Record): void; /** * Adds additional default config to be applied to all Lambda functions in the stack. * * @deprecated The "addDefaultFunctionConfig" method will be removed in SST v2. Pass Parameters and Secrets in through the "addDefaultFunctionBinding" function. Read more about how to upgrade here — https://docs.serverless-stack.com/upgrade-guide#upgrade-to-v116 * * @example * ```js * // Change * stack.addDefaultFunctionConfig([STRIPE_KEY]); * * // To * stack.addDefaultFunctionBinding([STRIPE_KEY]); * ``` */ addDefaultFunctionConfig(config: (Config.Secret | Config.Parameter)[]): void; /** * Binds additional resources to be applied to all Lambda functions in the stack. * * @example * ```js * app.addDefaultFunctionBinding([STRIPE_KEY, bucket]); * ``` */ addDefaultFunctionBinding(bind: SSTConstruct[]): void; /** * Adds additional default layers to be applied to all Lambda functions in the stack. * * @example * ```js * stack.addDefaultFunctionLayers(["arn:aws:lambda:us-east-1:123456789012:layer:nodejs:3"]); * ``` */ addDefaultFunctionLayers(layers: lambda.ILayerVersion[]): void; /** * Returns all the Function instances in this stack. * * @example * ```js * stack.getAllFunctions(); * ``` */ getAllFunctions(): Fn[]; private doGetAllFunctions; /** * Add outputs to this stack * * @example * ```js * stack.addOutputs({ * TableName: table.name, * }); * ``` * * ```js * stack.addOutputs({ * TableName: { * value: table.name, * exportName: "MyTableName", * } * }); * ``` */ addOutputs(outputs: Record): void; setStackMetadata(metadata: any): void; private createCustomResourceHandler; private createStackMetadataResource; private static checkForPropsIsConstruct; private static checkForEnvInProps; }