import {z} from 'zod' export type Readonlyattribute = {Value: unknown, Scope?: ('global' | 'local') | undefined, Type?: ('scalar' | 'vector' | 'keylist' | 'associate') | undefined}; export type Servicegroupattribute = {Value: unknown, Scope?: ('global' | 'local') | undefined, Type?: ('scalar' | 'vector' | 'keylist' | 'associate') | undefined}; export type Servicegroupdependency = {GroupName: string, DependencyType: 'online_local_firm' | 'online_local_soft' | 'online_local_hard' | 'online_global_firm' | 'online_global_soft' | 'online_global_hard' | 'online_remote_firm' | 'online_remote_soft' | 'online_remote_hard' | 'offline_local' | 'none'}; export type ServicegroupV2v0Dependency = {Parents?: Array | undefined, Children: Array}; export type GroupfreezeV2v0 = {Frozen?: boolean | undefined, Persistent?: boolean | undefined}; export type GroupstateV2v0 = {System?: string | undefined, State: string, Propagate?: boolean | undefined, Ifprobed?: boolean | undefined, Force?: boolean | undefined}; export type GroupsystemV2v0 = {System?: string | undefined, Priority?: number | undefined}; export type ServicegroupV2v0 = {ActiveCount?: Readonlyattribute | undefined, AdministratorGroups?: Servicegroupattribute | undefined, Administrators?: Servicegroupattribute | undefined, Authority?: Readonlyattribute | undefined, AutoClearCount?: Readonlyattribute | undefined, AutoClearInterval?: Servicegroupattribute | undefined, AutoClearLimit?: Servicegroupattribute | undefined, AutoDisabled?: Servicegroupattribute | undefined, AutoFailOver?: Servicegroupattribute | undefined, AutoRestart?: Servicegroupattribute | undefined, AutoStart?: Servicegroupattribute | undefined, AutoStartIfPartial?: Servicegroupattribute | undefined, AutoStartList?: Servicegroupattribute | undefined, AutoStartPolicy?: Servicegroupattribute | undefined, CapacityReserved?: Readonlyattribute | undefined, ClusterFailOverPolicy?: Servicegroupattribute | undefined, ClusterList?: Servicegroupattribute | undefined, ContainerInfo?: Servicegroupattribute | undefined, CurrentCount?: Readonlyattribute | undefined, DeferAutoStart?: Readonlyattribute | undefined, Dependency?: ServicegroupV2v0Dependency | undefined, DisableFaultMessages?: Servicegroupattribute | undefined, Enabled?: Servicegroupattribute | undefined, Evacuate?: Servicegroupattribute | undefined, Evacuating?: Readonlyattribute | undefined, EvacList?: Readonlyattribute | undefined, EvacuatingForGroup?: Readonlyattribute | undefined, Failover?: Readonlyattribute | undefined, FailOverPolicy?: Servicegroupattribute | undefined, FaultPropagation?: Servicegroupattribute | undefined, FromQ?: Readonlyattribute | undefined, Frozen?: Readonlyattribute | undefined, FrozenState?: GroupfreezeV2v0 | undefined, GroupOwner?: Servicegroupattribute | undefined, GroupRecipients?: Servicegroupattribute | undefined, Guests?: Servicegroupattribute | undefined, IntentOnline?: Readonlyattribute | undefined, IntentionalOnlineList?: Readonlyattribute | undefined, LastSuccess?: Readonlyattribute | undefined, Load?: Servicegroupattribute | undefined, ManageFaults?: Servicegroupattribute | undefined, ManualOps?: Servicegroupattribute | undefined, MeterWeight?: Servicegroupattribute | undefined, MigrateQ?: Readonlyattribute | undefined, Name?: string | undefined, NumRetries?: Readonlyattribute | undefined, OnlineAtUnfreeze?: Readonlyattribute | undefined, OnlineClearParent?: Servicegroupattribute | undefined, OnlineRetryInterval?: Servicegroupattribute | undefined, OnlineRetryLimit?: Servicegroupattribute | undefined, OperatorGroups?: Servicegroupattribute | undefined, Operators?: Servicegroupattribute | undefined, Parallel?: Servicegroupattribute | undefined, PathCount?: Readonlyattribute | undefined, PCVAllowOnline?: Readonlyattribute | undefined, PolicyIntention?: Readonlyattribute | undefined, PreOnline?: Servicegroupattribute | undefined, PreOnlining?: Readonlyattribute | undefined, PreonlineTimeout?: Servicegroupattribute | undefined, Prerequisites?: Servicegroupattribute | undefined, PreSwitch?: Servicegroupattribute | undefined, PreSwitching?: Readonlyattribute | undefined, PrintTree?: Servicegroupattribute | undefined, Priority?: Servicegroupattribute | undefined, Probed?: Readonlyattribute | undefined, ProbesPending?: Readonlyattribute | undefined, ProPCV?: Servicegroupattribute | undefined, Responding?: Readonlyattribute | undefined, SourceFile?: Servicegroupattribute | undefined, States?: Array | undefined, SysDownPolicy?: Servicegroupattribute | undefined, SystemList?: Array | undefined, SystemZones?: Servicegroupattribute | undefined, Tag?: Readonlyattribute | undefined, TargetCount?: Readonlyattribute | undefined, TFrozen?: Servicegroupattribute | undefined, ToQ?: Readonlyattribute | undefined, TriggerPath?: Servicegroupattribute | undefined, TriggerResFault?: Servicegroupattribute | undefined, TriggerResRestart?: Servicegroupattribute | undefined, TriggerResStateChange?: Servicegroupattribute | undefined, TriggersEnabled?: Servicegroupattribute | undefined, TypeDependencies?: Servicegroupattribute | undefined, UnSteadyCount?: Servicegroupattribute | undefined, UserAssoc?: Servicegroupattribute | undefined, UserIntGlobal?: Servicegroupattribute | undefined, UserStrGlobal?: Servicegroupattribute | undefined, UserIntLocal?: Servicegroupattribute | undefined, UserStrLocal?: Servicegroupattribute | undefined, VCSi3Info?: Servicegroupattribute | undefined}; export type PatchApiClustersClusterNameServicegroupsGroupNameArgs = {ClusterName: string, GroupName: string, body: ServicegroupV2v0}; export type PatchApiClustersClusterNameServicegroupsGroupNameOptions = {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 service group * * PATCH /clusters/{ClusterName}/servicegroups/{GroupName} */ export const patchApiClustersClusterNameServicegroupsGroupName = async (args: PatchApiClustersClusterNameServicegroupsGroupNameArgs, options: PatchApiClustersClusterNameServicegroupsGroupNameOptions) => { 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))}/servicegroups/${encodeURIComponent(String(args.GroupName))}${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()) };