import {z} from 'zod' export type Attribute = {Value: unknown, Type?: ('scalar' | 'vector' | 'keylist' | 'associate') | undefined, KeyAttribute?: boolean | undefined}; export type Link = {rel?: string | undefined, href?: string | undefined}; export type Operation = {Name?: string | undefined, href?: string | undefined}; export type ExcludedDisk = {DiskId?: string | undefined, Name?: string | undefined, Links?: Array | undefined, Operations?: Array | undefined}; export type Systemfreeze = {Evacuate?: boolean | undefined, Frozen?: boolean | undefined, Persistent?: boolean | undefined}; export type SystemV2v0 = {AgentsStopped?: Attribute | undefined, AvailableCapacity?: Attribute | undefined, Capacity?: Attribute | undefined, ConfigBlockCount?: Attribute | undefined, ConfigCheckSum?: Attribute | undefined, ConfigDiskState?: Attribute | undefined, ConfigFile?: Attribute | undefined, ConfigInfoCnt?: Attribute | undefined, ConfigModDate?: Attribute | undefined, CPUThresholdLevel?: Attribute | undefined, CPUUsage?: Attribute | undefined, CPUUsageMonitoring?: Attribute | undefined, ConnectorState?: Attribute | undefined, CurrentLimits?: Attribute | undefined, DiskHbStatus?: Attribute | undefined, DynamicLoad?: Attribute | undefined, EngineRestarted?: Attribute | undefined, EngineVersion?: Attribute | undefined, ExcludedDisks?: Array | undefined, FencingWeight?: Attribute | undefined, Frozen?: Attribute | undefined, FrozenState?: Systemfreeze | undefined, GUIIPAddr?: Attribute | undefined, HostAvailableForecast?: Attribute | undefined, HostMonitor?: Attribute | undefined, HostUtilization?: Attribute | undefined, LicenseType?: Attribute | undefined, Limits?: Attribute | undefined, LinkHbStatus?: Attribute | undefined, LLTNodeId?: Attribute | undefined, LoadTimeCounter?: Attribute | undefined, LoadTimeThreshold?: Attribute | undefined, LoadWarningLevel?: Attribute | undefined, MemThresholdLevel?: Attribute | undefined, MeterRecord?: Attribute | undefined, NoAutoDisable?: Attribute | undefined, NodeId?: Attribute | undefined, OnGrpCnt?: Attribute | undefined, ReservedCapacity?: Attribute | undefined, ShutdownTimeout?: Attribute | undefined, Site?: Attribute | undefined, SourceFile?: Attribute | undefined, SupportedProtocol?: Attribute | undefined, SwapThresholdLevel?: Attribute | undefined, SysInfo?: Attribute | undefined, SysName?: Attribute | undefined, SysState?: Attribute | undefined, SystemLocation?: Attribute | undefined, SystemOwner?: Attribute | undefined, SystemRecipients?: Attribute | undefined, TFrozen?: Attribute | undefined, TRSE?: Attribute | undefined, UpDownState?: Attribute | undefined, UserInt?: Attribute | undefined, UserStr?: Attribute | undefined, VCSFeatures?: Attribute | undefined, VCSMode?: Attribute | undefined}; export type PatchApiClustersClusterNameSystemsSystemNameArgs = {ClusterName: string, SystemName: string, body: SystemV2v0}; export type PatchApiClustersClusterNameSystemsSystemNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; export const response = z.object({detail: z.string().optional(), status: z.number().int().optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Operate on a cluster system * * PATCH /clusters/{ClusterName}/systems/{SystemName} */ export const patchApiClustersClusterNameSystemsSystemName = async (args: PatchApiClustersClusterNameSystemsSystemNameArgs, options: PatchApiClustersClusterNameSystemsSystemNameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/clusters/${encodeURIComponent(String(args.ClusterName))}/systems/${encodeURIComponent(String(args.SystemName))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(response, await res.json()) };