UNPKG

3.31 kBTypeScriptView Raw
1import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
2import * as ec2 from '@aws-cdk/aws-ec2';
3import * as iam from '@aws-cdk/aws-iam';
4import * as lambda from '@aws-cdk/aws-lambda';
5import { ConstructNode, Resource } from '@aws-cdk/core';
6import { Construct } from 'constructs';
7/**
8 * Properties for creating a Lambda@Edge function
9 */
10export interface EdgeFunctionProps extends lambda.FunctionProps {
11 /**
12 * The stack ID of Lambda@Edge function.
13 *
14 * @default - `edge-lambda-stack-${region}`
15 */
16 readonly stackId?: string;
17}
18/**
19 * A Lambda@Edge function.
20 *
21 * Convenience resource for requesting a Lambda function in the 'us-east-1' region for use with Lambda@Edge.
22 * Implements several restrictions enforced by Lambda@Edge.
23 *
24 * Note that this construct requires that the 'us-east-1' region has been bootstrapped.
25 * See https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html or 'cdk bootstrap --help' for options.
26 *
27 * @resource AWS::Lambda::Function
28 */
29export declare class EdgeFunction extends Resource implements lambda.IVersion {
30 private static readonly EDGE_REGION;
31 readonly edgeArn: string;
32 readonly functionName: string;
33 readonly functionArn: string;
34 readonly grantPrincipal: iam.IPrincipal;
35 readonly isBoundToVpc = false;
36 readonly permissionsNode: ConstructNode;
37 readonly role?: iam.IRole;
38 readonly version: string;
39 readonly architecture: lambda.Architecture;
40 readonly resourceArnsForGrantInvoke: string[];
41 private readonly _edgeFunction;
42 constructor(scope: Construct, id: string, props: EdgeFunctionProps);
43 get lambda(): lambda.IFunction;
44 /**
45 * Convenience method to make `EdgeFunction` conform to the same interface as `Function`.
46 */
47 get currentVersion(): lambda.IVersion;
48 addAlias(aliasName: string, options?: lambda.AliasOptions): lambda.Alias;
49 /**
50 * Not supported. Connections are only applicable to VPC-enabled functions.
51 */
52 get connections(): ec2.Connections;
53 get latestVersion(): lambda.IVersion;
54 addEventSourceMapping(id: string, options: lambda.EventSourceMappingOptions): lambda.EventSourceMapping;
55 addPermission(id: string, permission: lambda.Permission): void;
56 addToRolePolicy(statement: iam.PolicyStatement): void;
57 grantInvoke(identity: iam.IGrantable): iam.Grant;
58 grantInvokeUrl(identity: iam.IGrantable): iam.Grant;
59 metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
60 metricDuration(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
61 metricErrors(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
62 metricInvocations(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
63 metricThrottles(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
64 /** Adds an event source to this function. */
65 addEventSource(source: lambda.IEventSource): void;
66 configureAsyncInvoke(options: lambda.EventInvokeConfigOptions): void;
67 addFunctionUrl(options?: lambda.FunctionUrlOptions): lambda.FunctionUrl;
68 /** Create a function in-region */
69 private createInRegionFunction;
70 /** Create a support stack and function in us-east-1, and a SSM reader in-region */
71 private createCrossRegionFunction;
72 private createCrossRegionArnReader;
73 private edgeStack;
74}