/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Awss3Config, Awss3Config$inboundSchema, Awss3Config$Outbound, Awss3Config$outboundSchema, } from "./awss3config.js"; import { Awss3Credentials, Awss3Credentials$inboundSchema, Awss3Credentials$Outbound, Awss3Credentials$outboundSchema, } from "./awss3credentials.js"; import { Topics, Topics$inboundSchema, Topics$Outbound, Topics$outboundSchema, } from "./topics.js"; export type DestinationCreateAwss3 = { /** * Optional user-provided ID. A UUID will be generated if empty. */ id?: string | undefined; /** * Type of the destination. Must be 'aws_s3'. */ type: "aws_s3"; /** * "*" or an array of enabled topics. */ topics: Topics; /** * Optional JSON schema filter for event matching. Events must match this filter to be delivered to this destination. * * @remarks * Supports operators: $eq, $neq, $gt, $gte, $lt, $lte, $in, $nin, $startsWith, $endsWith, $exist, $or, $and, $not. * If null or empty, all events matching the topic filter will be delivered. * To remove an existing filter when updating a destination, set filter to an empty object `{}`. */ filter?: { [k: string]: any } | null | undefined; config: Awss3Config; credentials: Awss3Credentials; /** * Static key-value pairs merged into event metadata on every attempt. */ deliveryMetadata?: { [k: string]: string } | null | undefined; /** * Arbitrary contextual information stored with the destination. */ metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const DestinationCreateAwss3$inboundSchema: z.ZodType< DestinationCreateAwss3, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), type: z.literal("aws_s3"), topics: Topics$inboundSchema, filter: z.nullable(z.record(z.any())).optional(), config: Awss3Config$inboundSchema, credentials: Awss3Credentials$inboundSchema, delivery_metadata: z.nullable(z.record(z.string())).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "delivery_metadata": "deliveryMetadata", }); }); /** @internal */ export type DestinationCreateAwss3$Outbound = { id?: string | undefined; type: "aws_s3"; topics: Topics$Outbound; filter?: { [k: string]: any } | null | undefined; config: Awss3Config$Outbound; credentials: Awss3Credentials$Outbound; delivery_metadata?: { [k: string]: string } | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const DestinationCreateAwss3$outboundSchema: z.ZodType< DestinationCreateAwss3$Outbound, z.ZodTypeDef, DestinationCreateAwss3 > = z.object({ id: z.string().optional(), type: z.literal("aws_s3"), topics: Topics$outboundSchema, filter: z.nullable(z.record(z.any())).optional(), config: Awss3Config$outboundSchema, credentials: Awss3Credentials$outboundSchema, deliveryMetadata: z.nullable(z.record(z.string())).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { deliveryMetadata: "delivery_metadata", }); }); export function destinationCreateAwss3ToJSON( destinationCreateAwss3: DestinationCreateAwss3, ): string { return JSON.stringify( DestinationCreateAwss3$outboundSchema.parse(destinationCreateAwss3), ); } export function destinationCreateAwss3FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DestinationCreateAwss3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DestinationCreateAwss3' from JSON`, ); }