/* * 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 { BuildV3, BuildV3$inboundSchema } from "./buildv3.js"; import { ContainerPort, ContainerPort$inboundSchema } from "./containerport.js"; import { LoadBalancerConfig, LoadBalancerConfig$inboundSchema, } from "./loadbalancerconfig.js"; import { ProcessAutoscalerConfig, ProcessAutoscalerConfig$inboundSchema, } from "./processautoscalerconfig.js"; import { StaticProcessAllocationConfig, StaticProcessAllocationConfig$inboundSchema, } from "./staticprocessallocationconfig.js"; export type ApplicationWithLatestDeploymentAndBuildServiceConfig = { /** * 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; }; export type ApplicationWithLatestDeploymentAndBuildEnv = { value: string; name: string; }; export type ApplicationWithLatestDeploymentAndBuildDeployment = { /** * The id of the fleet. */ fleetId?: string | undefined; /** * Arbitrary metadata associated with a deployment. */ deploymentTag?: string | undefined; /** * Option to shut down processes that have had no new connections or rooms * * @remarks * for five minutes. */ idleTimeoutEnabled: boolean; /** * The environment variable that our process will have access to at runtime. */ env: Array; /** * Governs how many [rooms](https://hathora.dev/docs/concepts/hathora-entities#room) can be scheduled in a process. */ roomsPerProcess: number; /** * Additional ports your server listens on. */ additionalContainerPorts: Array; /** * A container port object represents the transport configruations for how your server will listen. */ defaultContainerPort: ContainerPort; /** * When the deployment was created. */ createdAt: Date; createdBy: string; /** * The number of GPUs allocated to your process. Must be an integer. * * @remarks * If not provided, the requested GPU is 0. */ requestedGPU?: number | undefined; /** * EXPERIMENTAL - this feature is in closed beta. * * @remarks * The number of GPUs allocated to your process. Must be an integer. * If not provided, the requested GPU is 0. */ experimentalRequestedGPU?: number | undefined; /** * The amount of memory allocated to your process. By default, this is capped * * @remarks * at 8192 MB, but can be increased further on the Enterprise tier. */ requestedMemoryMB: number; /** * The number of cores allocated to your process. */ requestedCPU: number; /** * System generated id for a deployment. */ deploymentId: string; /** * Tag to associate an external version with a build. It is accessible via [`GetBuild()`](https://hathora.dev/api#tag/BuildsV3/operation/GetBuild). */ buildTag?: string | undefined; /** * System generated id for a build. Can also be user defined when creating a build. */ buildId: string; /** * System generated unique identifier for an application. */ appId: string; /** * A build represents a game server artifact and its associated metadata. */ build: BuildV3; }; /** * An application object is the top level namespace for the game server. */ export type ApplicationWithLatestDeploymentAndBuild = { /** * 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: ApplicationWithLatestDeploymentAndBuildServiceConfig | 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; deployment?: ApplicationWithLatestDeploymentAndBuildDeployment | undefined; }; /** @internal */ export const ApplicationWithLatestDeploymentAndBuildServiceConfig$inboundSchema: z.ZodType< ApplicationWithLatestDeploymentAndBuildServiceConfig, z.ZodTypeDef, unknown > = z.object({ processAutoscalerConfig: ProcessAutoscalerConfig$inboundSchema.optional(), loadBalancer: LoadBalancerConfig$inboundSchema.optional(), staticProcessAllocation: z.array( StaticProcessAllocationConfig$inboundSchema, ), }); export function applicationWithLatestDeploymentAndBuildServiceConfigFromJSON( jsonString: string, ): SafeParseResult< ApplicationWithLatestDeploymentAndBuildServiceConfig, SDKValidationError > { return safeParse( jsonString, (x) => ApplicationWithLatestDeploymentAndBuildServiceConfig$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ApplicationWithLatestDeploymentAndBuildServiceConfig' from JSON`, ); } /** @internal */ export const ApplicationWithLatestDeploymentAndBuildEnv$inboundSchema: z.ZodType = z.object({ value: z.string(), name: z.string(), }); export function applicationWithLatestDeploymentAndBuildEnvFromJSON( jsonString: string, ): SafeParseResult< ApplicationWithLatestDeploymentAndBuildEnv, SDKValidationError > { return safeParse( jsonString, (x) => ApplicationWithLatestDeploymentAndBuildEnv$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ApplicationWithLatestDeploymentAndBuildEnv' from JSON`, ); } /** @internal */ export const ApplicationWithLatestDeploymentAndBuildDeployment$inboundSchema: z.ZodType< ApplicationWithLatestDeploymentAndBuildDeployment, z.ZodTypeDef, unknown > = z.object({ fleetId: z.string().optional(), deploymentTag: z.string().optional(), idleTimeoutEnabled: z.boolean(), env: z.array( z.lazy(() => ApplicationWithLatestDeploymentAndBuildEnv$inboundSchema), ), roomsPerProcess: z.number().int(), additionalContainerPorts: z.array(ContainerPort$inboundSchema), defaultContainerPort: ContainerPort$inboundSchema, createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v) ), createdBy: z.string(), requestedGPU: z.number().optional(), experimentalRequestedGPU: z.number().optional(), requestedMemoryMB: z.number(), requestedCPU: z.number(), deploymentId: z.string(), buildTag: z.string().optional(), buildId: z.string(), appId: z.string(), build: BuildV3$inboundSchema, }); export function applicationWithLatestDeploymentAndBuildDeploymentFromJSON( jsonString: string, ): SafeParseResult< ApplicationWithLatestDeploymentAndBuildDeployment, SDKValidationError > { return safeParse( jsonString, (x) => ApplicationWithLatestDeploymentAndBuildDeployment$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ApplicationWithLatestDeploymentAndBuildDeployment' from JSON`, ); } /** @internal */ export const ApplicationWithLatestDeploymentAndBuild$inboundSchema: z.ZodType< ApplicationWithLatestDeploymentAndBuild, 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(() => ApplicationWithLatestDeploymentAndBuildServiceConfig$inboundSchema ), ), authConfiguration: AuthConfiguration$inboundSchema, appSecret: z.string(), appId: z.string(), appName: z.string(), deployment: z.lazy(() => ApplicationWithLatestDeploymentAndBuildDeployment$inboundSchema ).optional(), }); export function applicationWithLatestDeploymentAndBuildFromJSON( jsonString: string, ): SafeParseResult< ApplicationWithLatestDeploymentAndBuild, SDKValidationError > { return safeParse( jsonString, (x) => ApplicationWithLatestDeploymentAndBuild$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ApplicationWithLatestDeploymentAndBuild' from JSON`, ); }