/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 681619485e9f */ import * as z from "zod/v4"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { EnvironmentVariableType, EnvironmentVariableType$inboundSchema, EnvironmentVariableType$outboundSchema, } from "./environmentvariabletype.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; export type EnvironmentVariableConfig = { /** * Variable name */ name: string; /** * Variable value (encrypted in database) */ value: string; /** * Variable type (plain or secret) */ type: EnvironmentVariableType; /** * Target resource patterns (null = all resources, array = wildcard patterns) */ targetResources: Array | null; }; /** @internal */ export const EnvironmentVariableConfig$inboundSchema: z.ZodType< EnvironmentVariableConfig, unknown > = z.object({ name: z.string(), value: z.string(), type: EnvironmentVariableType$inboundSchema, targetResources: z.nullable(z.array(z.string())), }); /** @internal */ export type EnvironmentVariableConfig$Outbound = { name: string; value: string; type: string; targetResources: Array | null; }; /** @internal */ export const EnvironmentVariableConfig$outboundSchema: z.ZodType< EnvironmentVariableConfig$Outbound, EnvironmentVariableConfig > = z.object({ name: z.string(), value: z.string(), type: EnvironmentVariableType$outboundSchema, targetResources: z.nullable(z.array(z.string())), }); export function environmentVariableConfigToJSON( environmentVariableConfig: EnvironmentVariableConfig, ): string { return JSON.stringify( EnvironmentVariableConfig$outboundSchema.parse(environmentVariableConfig), ); } export function environmentVariableConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EnvironmentVariableConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EnvironmentVariableConfig' from JSON`, ); }