apigw-vtl-emulator
Version: 
JavaScript VTL engine for AWS API Gateway mapping templates - works in both Node.js and browsers
170 lines • 4.29 kB
TypeScript
/**
 * Context Functions - Implementation of $context variables for AWS API Gateway VTL
 */
export declare class ContextFunctions {
    private context;
    constructor(context: any);
    accountId: string;
    apiId: string;
    requestId: string;
    extendedRequestId: string;
    httpMethod: string;
    stage: string;
    deploymentId: string;
    domainName: string;
    domainPrefix: string;
    path: string;
    protocol: string;
    resourceId: string;
    resourcePath: string;
    requestTime: string;
    requestTimeEpoch: number;
    isCanaryRequest: boolean;
    wafResponseCode: string;
    webaclArn: string;
    identity: IdentityContext;
    authorizer: AuthorizerContext;
    error: ErrorContext;
    requestOverride: RequestOverrideContext;
    responseOverride: ResponseOverrideContext;
    getAccountId(): string;
    getApiId(): string;
    getRequestId(): string;
    getExtendedRequestId(): string;
    getHttpMethod(): string;
    getStage(): string;
    getDeploymentId(): string;
    getDomainName(): string;
    getDomainPrefix(): string;
    getPath(): string;
    getProtocol(): string;
    getResourceId(): string;
    getResourcePath(): string;
    getRequestTime(): string;
    getRequestTimeEpoch(): number;
    getIsCanaryRequest(): boolean;
    getWafResponseCode(): string;
    getWebaclArn(): string;
    getIdentity(): IdentityContext;
    getAuthorizer(): AuthorizerContext;
    getError(): ErrorContext;
    getRequestOverride(): RequestOverrideContext;
    getResponseOverride(): ResponseOverrideContext;
}
/**
 * Identity Context
 */
export declare class IdentityContext {
    private context;
    constructor(context: any);
    accountId: string;
    apiKey: string | null;
    apiKeyId: string | null;
    caller: string;
    cognitoAuthenticationProvider: string;
    cognitoAuthenticationType: string;
    cognitoIdentityId: string;
    cognitoIdentityPoolId: string;
    principalOrgId: string;
    sourceIp: string;
    user: string;
    userAgent: string;
    userArn: string;
    vpcId: string;
    vpceId: string;
    clientCert: ClientCertContext;
    getIdentityMap(): Record<string, any>;
    getAccountId(): string;
    getApiKey(): string | null;
    getApiKeyId(): string | null;
    getCaller(): string;
    getCognitoAuthenticationProvider(): string;
    getCognitoAuthenticationType(): string;
    getCognitoIdentityId(): string;
    getCognitoIdentityPoolId(): string;
    getPrincipalOrgId(): string;
    getSourceIp(): string;
    getUser(): string;
    getUserAgent(): string;
    getUserArn(): string;
    getVpcId(): string;
    getVpceId(): string;
    getClientCert(): ClientCertContext;
}
/**
 * Client Certificate Context
 */
export declare class ClientCertContext {
    getClientCertPem(): string;
    getSubjectDN(): string;
    getIssuerDN(): string;
    getSerialNumber(): string;
    getValidity(): ValidityContext;
}
/**
 * Certificate Validity Context
 */
export declare class ValidityContext {
    getNotBefore(): string;
    getNotAfter(): string;
}
/**
 * Authorizer Context
 */
export declare class AuthorizerContext {
    private context;
    constructor(context: any);
    principalId: string;
    claims: any;
    key: string;
    numKey: number;
    boolKey: boolean;
    user_id: string;
    scope: string;
    getPrincipalId(): string;
    getClaims(): any;
    get(property: string): any;
}
/**
 * Error Context
 */
export declare class ErrorContext {
    getMessage(): string;
    getMessageString(): string;
    getResponseType(): string;
    getValidationErrorString(): string;
}
/**
 * Request Override Context
 */
export declare class RequestOverrideContext {
    getHeader(): HeaderContext;
    getPath(): PathContext;
    getQuerystring(): QuerystringContext;
}
/**
 * Header Context
 */
export declare class HeaderContext {
    get(headerName: string): string | null;
}
/**
 * Path Context
 */
export declare class PathContext {
    get(pathName: string): string | null;
}
/**
 * Query String Context
 */
export declare class QuerystringContext {
    get(querystringName: string): string | null;
}
/**
 * Response Override Context
 */
export declare class ResponseOverrideContext {
    getStatus(): string;
    getHeader(): HeaderContext;
}
//# sourceMappingURL=context-functions.d.ts.map