import * as cloudwatch from "../../aws-cloudwatch";
import { IProfilingGroup } from "../../aws-codeguruprofiler";
import * as ec2 from "../../aws-ec2";
import * as iam from "../../aws-iam";
import * as kms from "../../aws-kms";
import * as logs from "../../aws-logs";
import * as sqs from "../../aws-sqs";
import { Duration } from "../../core";
import { Construct } from 'constructs';
import { Architecture } from './architecture';
import { Code, CodeConfig } from './code';
import { ICodeSigningConfig } from './code-signing-config';
import { EventInvokeConfigOptions } from './event-invoke-config';
import { IEventSource } from './event-source';
import { FileSystem } from './filesystem';
import { FunctionAttributes, FunctionBase, IFunction } from './function-base';
import { LambdaInsightsVersion } from './lambda-insights';
import { Version, VersionOptions } from './lambda-version';
import { ILayerVersion } from './layers';
import { Runtime } from './runtime';
import { LogRetentionRetryOptions } from './log-retention';
/**
 * (experimental) X-Ray Tracing Modes (https://docs.aws.amazon.com/lambda/latest/dg/API_TracingConfig.html).
 *
 * @experimental
 */
export declare enum Tracing {
    /**
     * (experimental) Lambda will respect any tracing header it receives from an upstream service.
     *
     * If no tracing header is received, Lambda will call X-Ray for a tracing decision.
     *
     * @experimental
     */
    ACTIVE = "Active",
    /**
     * (experimental) Lambda will only trace the request from an upstream service if it contains a tracing header with "sampled=1".
     *
     * @experimental
     */
    PASS_THROUGH = "PassThrough",
    /**
     * (experimental) Lambda will not trace any request.
     *
     * @experimental
     */
    DISABLED = "Disabled"
}
/**
 * (experimental) Non runtime options.
 *
 * @experimental
 */
export interface FunctionOptions extends EventInvokeConfigOptions {
    /**
     * (experimental) A description of the function.
     *
     * @default - No description.
     * @experimental
     */
    readonly description?: string;
    /**
     * (experimental) The function execution time (in seconds) after which Lambda terminates the function.
     *
     * Because the execution time affects cost, set this value
     * based on the function's expected execution time.
     *
     * @default Duration.seconds(3)
     * @experimental
     */
    readonly timeout?: Duration;
    /**
     * (experimental) Key-value pairs that Lambda caches and makes available for your Lambda functions.
     *
     * Use environment variables to apply configuration changes, such
     * as test and production environment configurations, without changing your
     * Lambda function source code.
     *
     * @default - No environment variables.
     * @experimental
     */
    readonly environment?: {
        [key: string]: string;
    };
    /**
     * (experimental) A name for the function.
     *
     * @default - AWS CloudFormation generates a unique physical ID and uses that
     * ID for the function's name. For more information, see Name Type.
     * @experimental
     */
    readonly functionName?: string;
    /**
     * (experimental) The amount of memory, in MB, that is allocated to your Lambda function.
     *
     * Lambda uses this value to proportionally allocate the amount of CPU
     * power. For more information, see Resource Model in the AWS Lambda
     * Developer Guide.
     *
     * @default 128
     * @experimental
     */
    readonly memorySize?: number;
    /**
     * (experimental) Initial policy statements to add to the created Lambda Role.
     *
     * You can call `addToRolePolicy` to the created lambda to add statements post creation.
     *
     * @default - No policy statements are added to the created Lambda role.
     * @experimental
     */
    readonly initialPolicy?: iam.PolicyStatement[];
    /**
     * (experimental) Lambda execution role.
     *
     * This is the role that will be assumed by the function upon execution.
     * It controls the permissions that the function will have. The Role must
     * be assumable by the 'lambda.amazonaws.com' service principal.
     *
     * The default Role automatically has permissions granted for Lambda execution. If you
     * provide a Role, you must add the relevant AWS managed policies yourself.
     *
     * The relevant managed policies are "service-role/AWSLambdaBasicExecutionRole" and
     * "service-role/AWSLambdaVPCAccessExecutionRole".
     *
     * @default - A unique role will be generated for this lambda function.
     * Both supplied and generated roles can always be changed by calling `addToRolePolicy`.
     * @experimental
     */
    readonly role?: iam.IRole;
    /**
     * (experimental) VPC network to place Lambda network interfaces.
     *
     * Specify this if the Lambda function needs to access resources in a VPC.
     *
     * @default - Function is not placed within a VPC.
     * @experimental
     */
    readonly vpc?: ec2.IVpc;
    /**
     * (experimental) Where to place the network interfaces within the VPC.
     *
     * Only used if 'vpc' is supplied. Note: internet access for Lambdas
     * requires a NAT gateway, so picking Public subnets is not allowed.
     *
     * @default - the Vpc default strategy if not specified
     * @experimental
     */
    readonly vpcSubnets?: ec2.SubnetSelection;
    /**
     * (experimental) The list of security groups to associate with the Lambda's network interfaces.
     *
     * Only used if 'vpc' is supplied.
     *
     * @default - If the function is placed within a VPC and a security group is
     * not specified, either by this or securityGroup prop, a dedicated security
     * group will be created for this function.
     * @experimental
     */
    readonly securityGroups?: ec2.ISecurityGroup[];
    /**
     * (experimental) Whether to allow the Lambda to send all network traffic.
     *
     * If set to false, you must individually add traffic rules to allow the
     * Lambda to connect to network targets.
     *
     * @default true
     * @experimental
     */
    readonly allowAllOutbound?: boolean;
    /**
     * (experimental) Enabled DLQ.
     *
     * If `deadLetterQueue` is undefined,
     * an SQS queue with default options will be defined for your Function.
     *
     * @default - false unless `deadLetterQueue` is set, which implies DLQ is enabled.
     * @experimental
     */
    readonly deadLetterQueueEnabled?: boolean;
    /**
     * (experimental) The SQS queue to use if DLQ is enabled.
     *
     * @default - SQS queue with 14 day retention period if `deadLetterQueueEnabled` is `true`
     * @experimental
     */
    readonly deadLetterQueue?: sqs.IQueue;
    /**
     * (experimental) Enable AWS X-Ray Tracing for Lambda Function.
     *
     * @default Tracing.Disabled
     * @experimental
     */
    readonly tracing?: Tracing;
    /**
     * (experimental) Enable profiling.
     *
     * @default - No profiling.
     * @see https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html
     * @experimental
     */
    readonly profiling?: boolean;
    /**
     * (experimental) Profiling Group.
     *
     * @default - A new profiling group will be created if `profiling` is set.
     * @see https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html
     * @experimental
     */
    readonly profilingGroup?: IProfilingGroup;
    /**
     * (experimental) Specify the version of CloudWatch Lambda insights to use for monitoring.
     *
     * @default - No Lambda Insights
     * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-Getting-Started-docker.html
     * @experimental
     */
    readonly insightsVersion?: LambdaInsightsVersion;
    /**
     * (experimental) A list of layers to add to the function's execution environment.
     *
     * You can configure your Lambda function to pull in
     * additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies
     * that can be used by multiple functions.
     *
     * @default - No layers.
     * @experimental
     */
    readonly layers?: ILayerVersion[];
    /**
     * (experimental) The maximum of concurrent executions you want to reserve for the function.
     *
     * @default - No specific limit - account limit.
     * @see https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html
     * @experimental
     */
    readonly reservedConcurrentExecutions?: number;
    /**
     * (experimental) Event sources for this function.
     *
     * You can also add event sources using `addEventSource`.
     *
     * @default - No event sources.
     * @experimental
     */
    readonly events?: IEventSource[];
    /**
     * (experimental) The number of days log events are kept in CloudWatch Logs.
     *
     * When updating
     * this property, unsetting it doesn't remove the log retention policy. To
     * remove the retention policy, set the value to `INFINITE`.
     *
     * @default logs.RetentionDays.INFINITE
     * @experimental
     */
    readonly logRetention?: logs.RetentionDays;
    /**
     * (experimental) The IAM role for the Lambda function associated with the custom resource that sets the retention policy.
     *
     * @default - A new role is created.
     * @experimental
     */
    readonly logRetentionRole?: iam.IRole;
    /**
     * (experimental) When log retention is specified, a custom resource attempts to create the CloudWatch log group.
     *
     * These options control the retry policy when interacting with CloudWatch APIs.
     *
     * @default - Default AWS SDK retry options.
     * @experimental
     */
    readonly logRetentionRetryOptions?: LogRetentionRetryOptions;
    /**
     * (experimental) Options for the `lambda.Version` resource automatically created by the `fn.currentVersion` method.
     *
     * @default - default options as described in `VersionOptions`
     * @experimental
     */
    readonly currentVersionOptions?: VersionOptions;
    /**
     * (experimental) The filesystem configuration for the lambda function.
     *
     * @default - will not mount any filesystem
     * @experimental
     */
    readonly filesystem?: FileSystem;
    /**
     * (experimental) Lambda Functions in a public subnet can NOT access the internet.
     *
     * Use this property to acknowledge this limitation and still place the function in a public subnet.
     *
     * @default false
     * @see https://stackoverflow.com/questions/52992085/why-cant-an-aws-lambda-function-inside-a-public-subnet-in-a-vpc-connect-to-the/52994841#52994841
     * @experimental
     */
    readonly allowPublicSubnet?: boolean;
    /**
     * (experimental) The AWS KMS key that's used to encrypt your function's environment variables.
     *
     * @default - AWS Lambda creates and uses an AWS managed customer master key (CMK).
     * @experimental
     */
    readonly environmentEncryption?: kms.IKey;
    /**
     * (experimental) Code signing config associated with this function.
     *
     * @default - Not Sign the Code
     * @experimental
     */
    readonly codeSigningConfig?: ICodeSigningConfig;
    /**
     * (experimental) The system architectures compatible with this lambda function.
     *
     * @default Architecture.X86_64
     * @experimental
     */
    readonly architecture?: Architecture;
}
/**
 * @experimental
 */
export interface FunctionProps extends FunctionOptions {
    /**
     * (experimental) The runtime environment for the Lambda function that you are uploading.
     *
     * For valid values, see the Runtime property in the AWS Lambda Developer
     * Guide.
     *
     * Use `Runtime.FROM_IMAGE` when when defining a function from a Docker image.
     *
     * @experimental
     */
    readonly runtime: Runtime;
    /**
     * (experimental) The source code of your Lambda function.
     *
     * You can point to a file in an
     * Amazon Simple Storage Service (Amazon S3) bucket or specify your source
     * code as inline text.
     *
     * @experimental
     */
    readonly code: Code;
    /**
     * (experimental) The name of the method within your code that Lambda calls to execute your function.
     *
     * The format includes the file name. It can also include
     * namespaces and other qualifiers, depending on the runtime.
     * For more information, see https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-features.html#gettingstarted-features-programmingmodel.
     *
     * Use `Handler.FROM_IMAGE` when defining a function from a Docker image.
     *
     * NOTE: If you specify your source code as inline text by specifying the
     * ZipFile property within the Code property, specify index.function_name as
     * the handler.
     *
     * @experimental
     */
    readonly handler: string;
}
/**
 * (experimental) Deploys a file from inside the construct library as a function.
 *
 * The supplied file is subject to the 4096 bytes limit of being embedded in a
 * CloudFormation template.
 *
 * The construct includes an associated role with the lambda.
 *
 * This construct does not yet reproduce all features from the underlying resource
 * library.
 *
 * @experimental
 */
export declare class Function extends FunctionBase {
    /**
     * (experimental) Returns a `lambda.Version` which represents the current version of this Lambda function. A new version will be created every time the function's configuration changes.
     *
     * You can specify options for this version using the `currentVersionOptions`
     * prop when initializing the `lambda.Function`.
     *
     * @experimental
     */
    get currentVersion(): Version;
    /** @internal */
    static _VER_PROPS: {
        [key: string]: boolean;
    };
    /**
     * (experimental) Record whether specific properties in the `AWS::Lambda::Function` resource should also be associated to the Version resource.
     *
     * See 'currentVersion' section in the module README for more details.
     *
     * @param propertyName The property to classify.
     * @param locked whether the property should be associated to the version or not.
     * @experimental
     */
    static classifyVersionProperty(propertyName: string, locked: boolean): void;
    /**
     * (experimental) Import a lambda function into the CDK using its ARN.
     *
     * @experimental
     */
    static fromFunctionArn(scope: Construct, id: string, functionArn: string): IFunction;
    /**
     * (experimental) Creates a Lambda function object which represents a function not defined within this stack.
     *
     * @param scope The parent construct.
     * @param id The name of the lambda construct.
     * @param attrs the attributes of the function to import.
     * @experimental
     */
    static fromFunctionAttributes(scope: Construct, id: string, attrs: FunctionAttributes): IFunction;
    /**
     * (experimental) Return the given named metric for this Lambda.
     *
     * @experimental
     */
    static metricAll(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
    /**
     * (experimental) Metric for the number of Errors executing all Lambdas.
     *
     * @default sum over 5 minutes
     * @experimental
     */
    static metricAllErrors(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
    /**
     * (experimental) Metric for the Duration executing all Lambdas.
     *
     * @default average over 5 minutes
     * @experimental
     */
    static metricAllDuration(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
    /**
     * (experimental) Metric for the number of invocations of all Lambdas.
     *
     * @default sum over 5 minutes
     * @experimental
     */
    static metricAllInvocations(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
    /**
     * (experimental) Metric for the number of throttled invocations of all Lambdas.
     *
     * @default sum over 5 minutes
     * @experimental
     */
    static metricAllThrottles(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
    /**
     * (experimental) Metric for the number of concurrent executions across all Lambdas.
     *
     * @default max over 5 minutes
     * @experimental
     */
    static metricAllConcurrentExecutions(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
    /**
     * (experimental) Metric for the number of unreserved concurrent executions across all Lambdas.
     *
     * @default max over 5 minutes
     * @experimental
     */
    static metricAllUnreservedConcurrentExecutions(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
    /**
     * (experimental) Name of this function.
     *
     * @experimental
     */
    readonly functionName: string;
    /**
     * (experimental) ARN of this function.
     *
     * @experimental
     */
    readonly functionArn: string;
    /**
     * (experimental) Execution role associated with this function.
     *
     * @experimental
     */
    readonly role?: iam.IRole;
    /**
     * (experimental) The runtime configured for this lambda.
     *
     * @experimental
     */
    readonly runtime: Runtime;
    /**
     * (experimental) The principal this Lambda Function is running as.
     *
     * @experimental
     */
    readonly grantPrincipal: iam.IPrincipal;
    /**
     * (experimental) The DLQ associated with this Lambda Function (this is an optional attribute).
     *
     * @experimental
     */
    readonly deadLetterQueue?: sqs.IQueue;
    /**
     * (experimental) The construct node where permissions are attached.
     *
     * @experimental
     */
    readonly permissionsNode: import("constructs").Node;
    /**
     * (experimental) Whether the addPermission() call adds any permissions.
     *
     * True for new Lambdas, false for version $LATEST and imported Lambdas
     * from different accounts.
     *
     * @experimental
     */
    protected readonly canCreatePermissions = true;
    private readonly layers;
    private _logGroup?;
    /**
     * Environment variables for this function
     */
    private environment;
    private readonly currentVersionOptions?;
    private _currentVersion?;
    /**
     * @experimental
     */
    constructor(scope: Construct, id: string, props: FunctionProps);
    /**
     * (experimental) Adds an environment variable to this Lambda function.
     *
     * If this is a ref to a Lambda function, this operation results in a no-op.
     *
     * @param key The environment variable key.
     * @param value The environment variable's value.
     * @param options Environment variable options.
     * @experimental
     */
    addEnvironment(key: string, value: string, options?: EnvironmentOptions): this;
    /**
     * (experimental) Adds one or more Lambda Layers to this Lambda function.
     *
     * @param layers the layers to be added.
     * @experimental
     * @throws if there are already 5 layers on this function, or the layer is incompatible with this function's runtime.
     */
    addLayers(...layers: ILayerVersion[]): void;
    /**
     * (experimental) The LogGroup where the Lambda function's logs are made available.
     *
     * If either `logRetention` is set or this property is called, a CloudFormation custom resource is added to the stack that
     * pre-creates the log group as part of the stack deployment, if it already doesn't exist, and sets the correct log retention
     * period (never expire, by default).
     *
     * Further, if the log group already exists and the `logRetention` is not set, the custom resource will reset the log retention
     * to never expire even if it was configured with a different value.
     *
     * @experimental
     */
    get logGroup(): logs.ILogGroup;
    /** @internal */
    _checkEdgeCompatibility(): void;
    /**
     * Configured lambda insights on the function if specified. This is acheived by adding an imported layer which is added to the
     * list of lambda layers on synthesis.
     *
     * https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-extension-versions.html
     */
    private configureLambdaInsights;
    private renderEnvironment;
    /**
     * If configured, set up the VPC-related properties
     *
     * Returns the VpcConfig that should be added to the
     * Lambda creation properties.
     */
    private configureVpc;
    private buildDeadLetterQueue;
    private buildDeadLetterConfig;
    private buildTracingConfig;
    private validateProfiling;
}
/**
 * (experimental) Environment variables options.
 *
 * @experimental
 */
export interface EnvironmentOptions {
    /**
     * (experimental) When used in Lambda@Edge via edgeArn() API, these environment variables will be removed.
     *
     * If not set, an error will be thrown.
     *
     * @default false - using the function in Lambda
     * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-requirements-lambda-function-configuration
     * @experimental
     * @Edge will throw
     */
    readonly removeInEdge?: boolean;
}
export declare function verifyCodeConfig(code: CodeConfig, props: FunctionProps): void;
