/* * 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 { AWSSQSConfig, AWSSQSConfig$inboundSchema, AWSSQSConfig$Outbound, AWSSQSConfig$outboundSchema, } from "./awssqsconfig.js"; import { AWSSQSCredentials, AWSSQSCredentials$inboundSchema, AWSSQSCredentials$Outbound, AWSSQSCredentials$outboundSchema, } from "./awssqscredentials.js"; import { Topics, Topics$inboundSchema, Topics$Outbound, Topics$outboundSchema, } from "./topics.js"; export type DestinationAWSSQS = { /** * Control plane generated ID or user provided ID for the destination. */ id: string; /** * Type of the destination. */ type: "aws_sqs"; /** * "*" 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; /** * ISO Date when the destination was disabled, or null if enabled. */ disabledAt: Date | null; /** * ISO Date when the destination was created. */ createdAt: Date; /** * ISO Date when the destination was last updated. */ updatedAt: Date; config: AWSSQSConfig; credentials: AWSSQSCredentials; /** * 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; /** * A human-readable representation of the destination target (SQS queue name). Read-only. */ target?: string | undefined; /** * A URL link to the destination target (AWS Console link to the queue). Read-only. */ targetUrl?: string | null | undefined; }; /** @internal */ export const DestinationAWSSQS$inboundSchema: z.ZodType< DestinationAWSSQS, z.ZodTypeDef, unknown > = z.object({ id: z.string(), type: z.literal("aws_sqs"), topics: Topics$inboundSchema, filter: z.nullable(z.record(z.any())).optional(), disabled_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), config: AWSSQSConfig$inboundSchema, credentials: AWSSQSCredentials$inboundSchema, delivery_metadata: z.nullable(z.record(z.string())).optional(), metadata: z.nullable(z.record(z.string())).optional(), target: z.string().optional(), target_url: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "disabled_at": "disabledAt", "created_at": "createdAt", "updated_at": "updatedAt", "delivery_metadata": "deliveryMetadata", "target_url": "targetUrl", }); }); /** @internal */ export type DestinationAWSSQS$Outbound = { id: string; type: "aws_sqs"; topics: Topics$Outbound; filter?: { [k: string]: any } | null | undefined; disabled_at: string | null; created_at: string; updated_at: string; config: AWSSQSConfig$Outbound; credentials: AWSSQSCredentials$Outbound; delivery_metadata?: { [k: string]: string } | null | undefined; metadata?: { [k: string]: string } | null | undefined; target?: string | undefined; target_url?: string | null | undefined; }; /** @internal */ export const DestinationAWSSQS$outboundSchema: z.ZodType< DestinationAWSSQS$Outbound, z.ZodTypeDef, DestinationAWSSQS > = z.object({ id: z.string(), type: z.literal("aws_sqs"), topics: Topics$outboundSchema, filter: z.nullable(z.record(z.any())).optional(), disabledAt: z.nullable(z.date().transform(v => v.toISOString())), createdAt: z.date().transform(v => v.toISOString()), updatedAt: z.date().transform(v => v.toISOString()), config: AWSSQSConfig$outboundSchema, credentials: AWSSQSCredentials$outboundSchema, deliveryMetadata: z.nullable(z.record(z.string())).optional(), metadata: z.nullable(z.record(z.string())).optional(), target: z.string().optional(), targetUrl: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { disabledAt: "disabled_at", createdAt: "created_at", updatedAt: "updated_at", deliveryMetadata: "delivery_metadata", targetUrl: "target_url", }); }); export function destinationAWSSQSToJSON( destinationAWSSQS: DestinationAWSSQS, ): string { return JSON.stringify( DestinationAWSSQS$outboundSchema.parse(destinationAWSSQS), ); } export function destinationAWSSQSFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DestinationAWSSQS$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DestinationAWSSQS' from JSON`, ); }