UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

176 lines (163 loc) 6.14 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { smartUnion } from "../types/smartUnion.js"; import { Active, Active$inboundSchema, } from "./getsecurityfirewallconfiglogheaderssecurityresponse200applicationjsonresponsebodydraftrules2.js"; import { Draft, Draft$inboundSchema, GetSecurityFirewallConfigSecurityChanges, GetSecurityFirewallConfigSecurityChanges$inboundSchema, GetSecurityFirewallConfigSecurityCrs, GetSecurityFirewallConfigSecurityCrs$inboundSchema, GetSecurityFirewallConfigSecurityIps, GetSecurityFirewallConfigSecurityIps$inboundSchema, GetSecurityFirewallConfigSecurityResponseConditions, GetSecurityFirewallConfigSecurityResponseConditions$inboundSchema, GetSecurityFirewallConfigSecurityResponseManagedRules, GetSecurityFirewallConfigSecurityResponseManagedRules$inboundSchema, GetSecurityFirewallConfigSecurityResponseRules, GetSecurityFirewallConfigSecurityResponseRules$inboundSchema, GetSecurityFirewallConfigSecurityResponseRulesets, GetSecurityFirewallConfigSecurityResponseRulesets$inboundSchema, } from "./getsecurityfirewallconfigsecurityresponsemanagedrules.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export const GetSecurityFirewallConfigLogHeadersSecurityResponse2 = { Wildcard: "*", } as const; export type GetSecurityFirewallConfigLogHeadersSecurityResponse2 = ClosedEnum< typeof GetSecurityFirewallConfigLogHeadersSecurityResponse2 >; export type GetSecurityFirewallConfigSecurityResponseLogHeaders = | Array<string> | GetSecurityFirewallConfigLogHeadersSecurityResponse2; export type GetSecurityFirewallConfigVersions = { ownerId: string; projectKey: string; id: string; version: number; updatedAt: string; firewallEnabled: boolean; crs?: GetSecurityFirewallConfigSecurityCrs | undefined; rules: Array<GetSecurityFirewallConfigSecurityResponseRules>; ips: Array<GetSecurityFirewallConfigSecurityIps>; rulesets?: GetSecurityFirewallConfigSecurityResponseRulesets | undefined; conditions?: | Array<GetSecurityFirewallConfigSecurityResponseConditions> | undefined; changes: Array<GetSecurityFirewallConfigSecurityChanges>; managedRules?: | GetSecurityFirewallConfigSecurityResponseManagedRules | undefined; botIdEnabled?: boolean | undefined; logHeaders?: | Array<string> | GetSecurityFirewallConfigLogHeadersSecurityResponse2 | undefined; }; export type GetSecurityFirewallConfigResponseBody = { active: Active | null; draft: Draft | null; versions: Array<GetSecurityFirewallConfigVersions>; }; /** @internal */ export const GetSecurityFirewallConfigLogHeadersSecurityResponse2$inboundSchema: z.ZodNativeEnum<typeof GetSecurityFirewallConfigLogHeadersSecurityResponse2> = z.nativeEnum(GetSecurityFirewallConfigLogHeadersSecurityResponse2); /** @internal */ export const GetSecurityFirewallConfigSecurityResponseLogHeaders$inboundSchema: z.ZodType< GetSecurityFirewallConfigSecurityResponseLogHeaders, z.ZodTypeDef, unknown > = smartUnion([ z.array(types.string()), GetSecurityFirewallConfigLogHeadersSecurityResponse2$inboundSchema, ]); export function getSecurityFirewallConfigSecurityResponseLogHeadersFromJSON( jsonString: string, ): SafeParseResult< GetSecurityFirewallConfigSecurityResponseLogHeaders, SDKValidationError > { return safeParse( jsonString, (x) => GetSecurityFirewallConfigSecurityResponseLogHeaders$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetSecurityFirewallConfigSecurityResponseLogHeaders' from JSON`, ); } /** @internal */ export const GetSecurityFirewallConfigVersions$inboundSchema: z.ZodType< GetSecurityFirewallConfigVersions, z.ZodTypeDef, unknown > = z.object({ ownerId: types.string(), projectKey: types.string(), id: types.string(), version: types.number(), updatedAt: types.string(), firewallEnabled: types.boolean(), crs: types.optional(GetSecurityFirewallConfigSecurityCrs$inboundSchema), rules: z.array(GetSecurityFirewallConfigSecurityResponseRules$inboundSchema), ips: z.array(GetSecurityFirewallConfigSecurityIps$inboundSchema), rulesets: types.optional( GetSecurityFirewallConfigSecurityResponseRulesets$inboundSchema, ), conditions: types.optional( z.array(GetSecurityFirewallConfigSecurityResponseConditions$inboundSchema), ), changes: z.array(GetSecurityFirewallConfigSecurityChanges$inboundSchema), managedRules: types.optional( GetSecurityFirewallConfigSecurityResponseManagedRules$inboundSchema, ), botIdEnabled: types.optional(types.boolean()), logHeaders: types.optional( smartUnion([ z.array(types.string()), GetSecurityFirewallConfigLogHeadersSecurityResponse2$inboundSchema, ]), ), }); export function getSecurityFirewallConfigVersionsFromJSON( jsonString: string, ): SafeParseResult<GetSecurityFirewallConfigVersions, SDKValidationError> { return safeParse( jsonString, (x) => GetSecurityFirewallConfigVersions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetSecurityFirewallConfigVersions' from JSON`, ); } /** @internal */ export const GetSecurityFirewallConfigResponseBody$inboundSchema: z.ZodType< GetSecurityFirewallConfigResponseBody, z.ZodTypeDef, unknown > = z.object({ active: types.nullable(Active$inboundSchema), draft: types.nullable(Draft$inboundSchema), versions: z.array( z.lazy(() => GetSecurityFirewallConfigVersions$inboundSchema), ), }); export function getSecurityFirewallConfigResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetSecurityFirewallConfigResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetSecurityFirewallConfigResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetSecurityFirewallConfigResponseBody' from JSON`, ); }