Initial
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import { isAllowedAuthorityHost, isAllowedGraphHost } from '../data/graphHosts.js';
|
||||
import { normalizeOsFamily } from '../utils/osFamily.js';
|
||||
|
||||
export const loginSchema = z.object({
|
||||
email: z.string().email(),
|
||||
@@ -53,7 +54,7 @@ export const hostSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
fqdn: z.string().optional(),
|
||||
address: z.string().min(1),
|
||||
osFamily: z.string().default('windows'),
|
||||
osFamily: z.preprocess((value) => normalizeOsFamily(value, 'windows'), z.enum(['windows', 'linux', 'other'])).default('windows'),
|
||||
transport: z.enum(['winrm', 'ssh', 'local', 'api']).default('winrm'),
|
||||
port: z.number().int().nullable().optional(),
|
||||
credentialId: z.string().nullable().optional(),
|
||||
@@ -68,10 +69,11 @@ export const hostSchema = z.object({
|
||||
|
||||
export const vcenterConnectionSchema = z.object({
|
||||
name: z.string().min(1).max(120),
|
||||
targetType: z.enum(['vcenter', 'host']).optional().default('vcenter'),
|
||||
baseUrl: z.string().url(),
|
||||
username: z.string().min(1).max(200),
|
||||
password: z.string().optional().default(''),
|
||||
apiMode: z.enum(['auto', 'api', 'rest']).optional().default('auto'),
|
||||
apiMode: z.enum(['auto', 'api', 'rest', 'web-services']).optional().default('auto'),
|
||||
requestTimeoutMs: z.coerce.number().int().min(1000).max(120000).optional().default(20000),
|
||||
allowUntrustedTls: z.boolean().optional().default(false),
|
||||
enabled: z.boolean().optional().default(true),
|
||||
@@ -364,6 +366,13 @@ const runPlanPayloadSchema = z.object({
|
||||
hostGroupIds: z.array(z.string()).optional()
|
||||
});
|
||||
|
||||
export const scriptCompatibilitySchema = z.object({
|
||||
hostId: z.string().optional().default(''),
|
||||
hostGroupId: z.string().optional().default(''),
|
||||
hostIds: z.array(z.string()).optional().default([]),
|
||||
hostGroupIds: z.array(z.string()).optional().default([])
|
||||
});
|
||||
|
||||
export function normalizeScriptPayload(body) {
|
||||
const parsed = scriptPayloadSchema.parse(body);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user