@aws-lambda-powertools/parser
Version:
The parser package for the Powertools for AWS Lambda (TypeScript) library.
39 lines (38 loc) • 1.21 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VpcLatticeSchema = void 0;
const zod_1 = require("zod");
/**
* Zod schema for VPC Lattice event
*
* @example
* ```json
* {
"raw_path": "/testpath",
* "method": "GET",
* "headers": {
* "user_agent": "curl/7.64.1",
* "x-forwarded-for": "10.213.229.10",
* "host": "test-lambda-service-3908sdf9u3u.dkfjd93.vpc-lattice-svcs.us-east-2.on.aws",
* "accept": "*\/*",
* },
* "query_string_parameters": {
* "order-id": "1"
* },
* "body": "eyJ0ZXN0IjogImV2ZW50In0=",
* "is_base64_encoded": true
*}
* ```
*
* @see {@link VpcLatticeEvent | `VpcLatticeEvent`}
* @see {@link https://docs.aws.amazon.com/vpc-lattice/latest/ug/lambda-functions.html#receive-event-from-service}
*/
const VpcLatticeSchema = zod_1.z.object({
method: zod_1.z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS']),
raw_path: zod_1.z.string(),
body: zod_1.z.string(),
is_base64_encoded: zod_1.z.boolean(),
headers: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
query_string_parameters: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
});
exports.VpcLatticeSchema = VpcLatticeSchema;