@codification/cutwater-aws
Version:
A library providing general functionality for TypeScript based AWS projects.
86 lines • 4.91 kB
TypeScript
/// <reference types="node" />
import { CloudFrontCustomOrigin, CloudFrontHeaders, CloudFrontRequest, CloudFrontRequestEvent, CloudFrontResponseEvent, CloudFrontResultResponse } from 'aws-lambda';
import { IncomingHttpHeaders, IncomingMessage } from 'http';
/**
* @beta
*/
export declare class LambdaEdgeUtils {
/**
* Returns a new `CloudFrontHeaders` object with the specified `headerList` removed.
*
* This method also removes all headers that are black listed, as found
* [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions}.
*
* @param headers - the `CloudFrontHeaders` to be filtered
* @param headerList - names of the headers to be removed
* @returns a new filtered `CloudFrontHeaders` object
*/
static stripHeaders(headers: CloudFrontHeaders, headerList: string[]): CloudFrontHeaders;
/**
* Returns a new `CloudFrontHeaders` object with the read-only viewer request headers
* (as specified [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions})
* removed.
*
* This method also removes all headers that are black listed, as found
* [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions}.
*
* @param headers - the `CloudFrontHeaders` to be filtered
* @returns a new filtered `CloudFrontHeaders` object
*/
static stripViewerRequestHeaders(headers: CloudFrontHeaders): CloudFrontHeaders;
/**
* Returns a new `CloudFrontHeaders` object with the read-only origin request headers
* (as specified [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions})
* removed.
*
* This method also removes all headers that are black listed, as found
* [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions}.
*
* @param headers - the `CloudFrontHeaders` to be filtered
* @returns a new filtered `CloudFrontHeaders` object
*/
static stripOriginRequestHeaders(headers: CloudFrontHeaders): CloudFrontHeaders;
/**
* Returns a new `CloudFrontHeaders` object with the read-only viewer response headers
* (as specified [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions})
* removed.
*
* This method also removes all headers that are black listed, as found
* [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions}.
*
* @param headers - the `CloudFrontHeaders` to be filtered
* @returns a new filtered `CloudFrontHeaders` object
*/
static stripViewerResponseHeaders(headers: CloudFrontHeaders): CloudFrontHeaders;
/**
* Returns a new `CloudFrontHeaders` object with the read-only origin response headers
* (as specified [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions})
* removed.
*
* This method also removes all headers that are black listed, as found
* [here]{@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-header-restrictions}.
*
* @param headers - the `CloudFrontHeaders` to be filtered
* @returns a new filtered `CloudFrontHeaders` object
*/
static stripOriginResponseHeaders(headers: CloudFrontHeaders): CloudFrontHeaders;
/**
* Converts `CloudFrontHeaders` to `IncomingHttpHeaders` provided by node.
*
* @param headers - the headers from CloudFront to be converted
* @returns the converted headers
*/
static toCloudFrontHeaders(headers: IncomingHttpHeaders): CloudFrontHeaders;
/**
* Converts an origin's response (`IncomingMessage`) to a response that can be returned to a CloudFront viewer.
*
* @param originResponse - the response recieved from the origin
* @returns a response to be returned to a CloudFront viewer
*/
static originResponseToCloudFrontResultResponse(originResponse: IncomingMessage): Promise<CloudFrontResultResponse>;
static toCloudFrontCustomOrigin(request: CloudFrontRequest): CloudFrontCustomOrigin;
static isCustomOriginRequestEvent(event: CloudFrontRequestEvent): boolean;
static isCustomOriginResponseEvent(event: CloudFrontResponseEvent): boolean;
static toIncomingHttpHeaders(headers?: CloudFrontHeaders): IncomingHttpHeaders;
}
//# sourceMappingURL=LambdaEdgeUtils.d.ts.map