UNPKG

@aws-lambda-powertools/parser

Version:
45 lines (44 loc) 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventBridgeSchema = void 0; const zod_1 = require("zod"); /** * Zod schema for EventBridge event * * @example * ```json * { * "version": "0", * "id": "6a7e8feb-b491-4cf7-a9f1-bf3703467718", * "detail-type": "EC2 Instance State-change Notification", * "source": "aws.ec2", * "account": "111122223333", * "time": "2017-12-22T18:43:48Z", * "region": "us-west-1", * "resources": [ * "arn:aws:ec2:us-west-1:123456789012:instance/i-1234567890abcdef0" * ], * "detail": { * "instance_id": "i-1234567890abcdef0", * "state": "terminated" * }, * "replay-name": "replay_archive" * } * ``` * * @see {@link EventBridgeEvent | `EventBridgeEvent`} * @see {@link https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-events.html} */ const EventBridgeSchema = zod_1.z.object({ version: zod_1.z.string(), id: zod_1.z.string(), source: zod_1.z.string(), account: zod_1.z.string(), time: zod_1.z.iso.datetime(), region: zod_1.z.string(), resources: zod_1.z.array(zod_1.z.string()), 'detail-type': zod_1.z.string(), detail: zod_1.z.unknown(), 'replay-name': zod_1.z.string().optional(), }); exports.EventBridgeSchema = EventBridgeSchema;