/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { ExportMetadataField, ExportMetadataField$inboundSchema, ExportMetadataField$Outbound, ExportMetadataField$outboundSchema, } from "./export-metadata-field.js"; import { S3CompressionType, S3CompressionType$inboundSchema, S3CompressionType$outboundSchema, } from "./s3-compression-type.js"; import { S3EncryptionType, S3EncryptionType$inboundSchema, S3EncryptionType$outboundSchema, } from "./s3-encryption-type.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type S3JobConfig = { /** * S3 bucket name */ bucket?: string | undefined; compression?: S3CompressionType | undefined; encryption?: S3EncryptionType | undefined; /** * Custom S3-compatible endpoint URL; must be https on a publicly routable host */ endpointUrl?: string | undefined; /** * Optional user-selected metadata columns */ exportMetadataFields?: Array | undefined; /** * Optional prefix for S3 keys (e.g., "flexprice-exports/") */ keyPrefix?: string | undefined; /** * AWS region (e.g., "us-west-2") */ region?: string | undefined; /** * Use path-style addressing (required for MinIO) */ usePathStyle?: boolean | undefined; }; /** @internal */ export const S3JobConfig$inboundSchema: z.ZodMiniType = z .pipe( z.object({ bucket: types.optional(types.string()), compression: types.optional(S3CompressionType$inboundSchema), encryption: types.optional(S3EncryptionType$inboundSchema), endpoint_url: types.optional(types.string()), export_metadata_fields: types.optional( z.array(ExportMetadataField$inboundSchema), ), key_prefix: types.optional(types.string()), region: types.optional(types.string()), use_path_style: types.optional(types.boolean()), }), z.transform((v) => { return remap$(v, { "endpoint_url": "endpointUrl", "export_metadata_fields": "exportMetadataFields", "key_prefix": "keyPrefix", "use_path_style": "usePathStyle", }); }), ); /** @internal */ export type S3JobConfig$Outbound = { bucket?: string | undefined; compression?: string | undefined; encryption?: string | undefined; endpoint_url?: string | undefined; export_metadata_fields?: Array | undefined; key_prefix?: string | undefined; region?: string | undefined; use_path_style?: boolean | undefined; }; /** @internal */ export const S3JobConfig$outboundSchema: z.ZodMiniType< S3JobConfig$Outbound, S3JobConfig > = z.pipe( z.object({ bucket: z.optional(z.string()), compression: z.optional(S3CompressionType$outboundSchema), encryption: z.optional(S3EncryptionType$outboundSchema), endpointUrl: z.optional(z.string()), exportMetadataFields: z.optional( z.array(ExportMetadataField$outboundSchema), ), keyPrefix: z.optional(z.string()), region: z.optional(z.string()), usePathStyle: z.optional(z.boolean()), }), z.transform((v) => { return remap$(v, { endpointUrl: "endpoint_url", exportMetadataFields: "export_metadata_fields", keyPrefix: "key_prefix", usePathStyle: "use_path_style", }); }), ); export function s3JobConfigToJSON(s3JobConfig: S3JobConfig): string { return JSON.stringify(S3JobConfig$outboundSchema.parse(s3JobConfig)); } export function s3JobConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => S3JobConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'S3JobConfig' from JSON`, ); }