/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AuthConfiguration, AuthConfiguration$inboundSchema, } from "./authconfiguration.js"; import { LoadBalancerConfig, LoadBalancerConfig$inboundSchema, } from "./loadbalancerconfig.js"; import { ProcessAutoscalerConfig, ProcessAutoscalerConfig$inboundSchema, } from "./processautoscalerconfig.js"; import { StaticProcessAllocationConfig, StaticProcessAllocationConfig$inboundSchema, } from "./staticprocessallocationconfig.js"; export type ApplicationServiceConfig = { /** * The configuration for the Process Autoscaler for this application. * * @remarks * Autoscaling must be enabled on a per-region basis. * EXPERIMENTAL - This feature is in closed beta. */ processAutoscalerConfig?: ProcessAutoscalerConfig | undefined; loadBalancer?: LoadBalancerConfig | undefined; /** * The headroom configuration for each region. */ staticProcessAllocation: Array; }; /** * An application object is the top level namespace for the game server. */ export type Application = { /** * The email address or token id for the user that deleted the application. */ deletedBy: string | null; /** * When the application was deleted. */ deletedAt: Date | null; /** * When the application was created. */ createdAt: Date; createdBy: string; /** * System generated unique identifier for an organization. Not guaranteed to have a specific format. */ orgId: string; serviceConfig: ApplicationServiceConfig | null; /** * Configure [player authentication](https://hathora.dev/docs/backend-integrations/lobbies-and-matchmaking/auth-service) for your application. Use Hathora's built-in auth providers or use your own [custom authentication](https://hathora.dev/docs/lobbies-and-matchmaking/auth-service#custom-auth-provider). */ authConfiguration: AuthConfiguration; /** * Secret that is used for identity and access management. */ appSecret: string; /** * System generated unique identifier for an application. */ appId: string; /** * Readable name for an application. Must be unique within an organization. */ appName: string; }; /** @internal */ export const ApplicationServiceConfig$inboundSchema: z.ZodType< ApplicationServiceConfig, z.ZodTypeDef, unknown > = z.object({ processAutoscalerConfig: ProcessAutoscalerConfig$inboundSchema.optional(), loadBalancer: LoadBalancerConfig$inboundSchema.optional(), staticProcessAllocation: z.array(StaticProcessAllocationConfig$inboundSchema), }); export function applicationServiceConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApplicationServiceConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApplicationServiceConfig' from JSON`, ); } /** @internal */ export const Application$inboundSchema: z.ZodType< Application, z.ZodTypeDef, unknown > = z.object({ deletedBy: z.nullable(z.string()), deletedAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)), createdBy: z.string(), orgId: z.string(), serviceConfig: z.nullable( z.lazy(() => ApplicationServiceConfig$inboundSchema), ), authConfiguration: AuthConfiguration$inboundSchema, appSecret: z.string(), appId: z.string(), appName: z.string(), }); export function applicationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Application$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Application' from JSON`, ); }