208 lines
5.8 KiB
TypeScript
208 lines
5.8 KiB
TypeScript
import type { Construct } from 'constructs';
|
|
import type { IFunction } from './function-base';
|
|
import * as iam from '../../aws-iam';
|
|
import type { Duration, IResource } from '../../core';
|
|
import { Resource } from '../../core';
|
|
import type { IUrlRef, UrlReference } from '../../interfaces/generated/aws-lambda-interfaces.generated';
|
|
/**
|
|
* The auth types for a function url
|
|
*/
|
|
export declare enum FunctionUrlAuthType {
|
|
/**
|
|
* Restrict access to authenticated IAM users only
|
|
*/
|
|
AWS_IAM = "AWS_IAM",
|
|
/**
|
|
* Bypass IAM authentication to create a public endpoint
|
|
*/
|
|
NONE = "NONE"
|
|
}
|
|
/**
|
|
* The invoke modes for a Lambda function
|
|
*/
|
|
export declare enum InvokeMode {
|
|
/**
|
|
* Default option. Lambda invokes your function using the Invoke API operation.
|
|
* Invocation results are available when the payload is complete.
|
|
* The maximum payload size is 6 MB.
|
|
*/
|
|
BUFFERED = "BUFFERED",
|
|
/**
|
|
* Your function streams payload results as they become available.
|
|
* Lambda invokes your function using the InvokeWithResponseStream API operation.
|
|
* The maximum response payload size is 20 MB, however, you can request a quota increase.
|
|
*/
|
|
RESPONSE_STREAM = "RESPONSE_STREAM"
|
|
}
|
|
/**
|
|
* All http request methods
|
|
*/
|
|
export declare enum HttpMethod {
|
|
/**
|
|
* The GET method requests a representation of the specified resource.
|
|
*/
|
|
GET = "GET",
|
|
/**
|
|
* The PUT method replaces all current representations of the target resource with the request payload.
|
|
*/
|
|
PUT = "PUT",
|
|
/**
|
|
* The HEAD method asks for a response identical to that of a GET request, but without the response body.
|
|
*/
|
|
HEAD = "HEAD",
|
|
/**
|
|
* The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.
|
|
*/
|
|
POST = "POST",
|
|
/**
|
|
* The DELETE method deletes the specified resource.
|
|
*/
|
|
DELETE = "DELETE",
|
|
/**
|
|
* The PATCH method applies partial modifications to a resource.
|
|
*/
|
|
PATCH = "PATCH",
|
|
/**
|
|
* The OPTIONS method describes the communication options for the target resource.
|
|
*/
|
|
OPTIONS = "OPTIONS",
|
|
/**
|
|
* The wildcard entry to allow all methods.
|
|
*/
|
|
ALL = "*"
|
|
}
|
|
/**
|
|
* Specifies a cross-origin access property for a function URL
|
|
*/
|
|
export interface FunctionUrlCorsOptions {
|
|
/**
|
|
* Whether to allow cookies or other credentials in requests to your function URL.
|
|
*
|
|
* @default false
|
|
*/
|
|
readonly allowCredentials?: boolean;
|
|
/**
|
|
* Headers that are specified in the Access-Control-Request-Headers header.
|
|
*
|
|
* @default - No headers allowed.
|
|
*/
|
|
readonly allowedHeaders?: string[];
|
|
/**
|
|
* An HTTP method that you allow the origin to execute.
|
|
*
|
|
* @default - [HttpMethod.ALL]
|
|
*/
|
|
readonly allowedMethods?: HttpMethod[];
|
|
/**
|
|
* One or more origins you want customers to be able to access the bucket from.
|
|
*
|
|
* @default - No origins allowed.
|
|
*/
|
|
readonly allowedOrigins?: string[];
|
|
/**
|
|
* One or more headers in the response that you want customers to be able to access from their applications.
|
|
*
|
|
* @default - No headers exposed.
|
|
*/
|
|
readonly exposedHeaders?: string[];
|
|
/**
|
|
* The time in seconds that your browser is to cache the preflight response for the specified resource.
|
|
*
|
|
* @default - Browser default of 5 seconds.
|
|
*/
|
|
readonly maxAge?: Duration;
|
|
}
|
|
/**
|
|
* A Lambda function Url
|
|
*/
|
|
export interface IFunctionUrl extends IResource, IUrlRef {
|
|
/**
|
|
* The url of the Lambda function.
|
|
*
|
|
* @attribute FunctionUrl
|
|
*/
|
|
readonly url: string;
|
|
/**
|
|
* The ARN of the function this URL refers to
|
|
*
|
|
* @attribute FunctionArn
|
|
*/
|
|
readonly functionArn: string;
|
|
/**
|
|
* The authType of the function URL, used for access control
|
|
*
|
|
* @attribute AuthType
|
|
*/
|
|
readonly authType: FunctionUrlAuthType;
|
|
/**
|
|
* Grant the given identity permissions to invoke this Lambda Function URL
|
|
*/
|
|
grantInvokeUrl(identity: iam.IGrantable): iam.Grant;
|
|
}
|
|
/**
|
|
* Options to add a url to a Lambda function
|
|
*/
|
|
export interface FunctionUrlOptions {
|
|
/**
|
|
* The type of authentication that your function URL uses.
|
|
*
|
|
* @default FunctionUrlAuthType.AWS_IAM
|
|
*/
|
|
readonly authType?: FunctionUrlAuthType;
|
|
/**
|
|
* The cross-origin resource sharing (CORS) settings for your function URL.
|
|
*
|
|
* @default - No CORS configuration.
|
|
*/
|
|
readonly cors?: FunctionUrlCorsOptions;
|
|
/**
|
|
* The type of invocation mode that your Lambda function uses.
|
|
*
|
|
* @default InvokeMode.BUFFERED
|
|
*/
|
|
readonly invokeMode?: InvokeMode;
|
|
}
|
|
/**
|
|
* Properties for a FunctionUrl
|
|
*/
|
|
export interface FunctionUrlProps extends FunctionUrlOptions {
|
|
/**
|
|
* The function to which this url refers.
|
|
* It can also be an `Alias` but not a `Version`.
|
|
*/
|
|
readonly function: IFunction;
|
|
}
|
|
/**
|
|
* Defines a Lambda function url
|
|
*
|
|
* @resource AWS::Lambda::Url
|
|
*/
|
|
export declare class FunctionUrl extends Resource implements IFunctionUrl {
|
|
/**
|
|
* Uniquely identifies this class.
|
|
*/
|
|
static readonly PROPERTY_INJECTION_ID: string;
|
|
/**
|
|
* The url of the Lambda function.
|
|
*/
|
|
readonly url: string;
|
|
/**
|
|
* The ARN of the function this URL refers to
|
|
*/
|
|
readonly functionArn: string;
|
|
/**
|
|
* The authentication type used for this Function URL
|
|
*/
|
|
readonly authType: FunctionUrlAuthType;
|
|
private readonly function;
|
|
constructor(scope: Construct, id: string, props: FunctionUrlProps);
|
|
get urlRef(): UrlReference;
|
|
/**
|
|
* [disable-awslint:no-grants]
|
|
*/
|
|
grantInvokeUrl(grantee: iam.IGrantable): iam.Grant;
|
|
private instanceOfVersion;
|
|
private instanceOfAlias;
|
|
private renderCors;
|
|
}
|