serverless-aws-lambda
Version:
AWS Application Load Balancer and API Gateway - Lambda dev tool for Serverless. Allows Express synthax in handlers. Supports packaging, local invoking and offline ALB, APG, S3, SNS, SQS, DynamoDB Stream server mocking.
60 lines (59 loc) • 2.38 kB
TypeScript
import type { ServerResponse, IncomingHttpHeaders, IncomingMessage } from "http";
import type { ILambda } from "../../../defineConfig";
import { XMLBuilder } from "fast-xml-parser";
export interface BucketConfig {
deletionPolicy: "Delete" | "Retain" | "RetainExceptOnCreate";
versioning?: "Enabled" | "Suspended";
tags?: Record<string, string>;
}
declare const StorageClass: readonly ["STANDARD", "REDUCED_REDUNDANCY", "STANDARD_IA", "ONEZONE_IA", "INTELLIGENT_TIERING", "GLACIER", "DEEP_ARCHIVE", "OUTPOSTS", "GLACIER_IR", "SNOW"];
export type LocalS3Object = {
currentKey: string;
type?: string;
cacheControl?: string;
contentDisposition?: string;
contentEncoding?: string;
contentLanguage?: string;
expires?: number;
websiteRedirectLocation?: string;
StorageClass: (typeof StorageClass)[number];
ETag: string;
LastModified: number;
size: number;
metadata: Record<string, any>;
versions: Record<string, any>;
tags?: Record<string, any>;
};
interface LocalS3PersistenceV2 {
version: number;
buckets: {
[name: string]: {
date: number;
objects: {
[key: string]: LocalS3Object;
};
} & BucketConfig;
};
}
export declare abstract class S3LocalService {
#private;
abstract exec(res: ServerResponse, ...rest: any): Promise<void> | void;
static localStoragePath: string;
static persist: boolean;
static persistence: LocalS3PersistenceV2;
static XMLBuilder: XMLBuilder;
static genLocalKey(bucket: string, key: string, version?: string): string;
static bootstrap(): Promise<void>;
static createBucketDir(bucketName: string, config: BucketConfig): Promise<void>;
static saveState(): void;
static isValidBucketName(bucket: string): boolean;
isValidStorageClass(storage: any, res: ServerResponse): boolean;
static callableLambdas: ILambda[];
requestId: string;
metadata: Record<string, any>;
constructor(headers: IncomingHttpHeaders);
hasNot(bucket: string, res: ServerResponse): true | undefined;
static removeObject(bucket: string, key: string, sourceIPAddress: string, requestId: string): Promise<void>;
static getTagsFromRequest(req: IncomingMessage, RequestId: string, type: "Bucket" | "Object"): Promise<Record<string, string> | undefined>;
}
export {};