@vates/types 1.25.0 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/common.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import type { XoHost } from './xo.mjs';
1
+ import type { XoHost, XoNetwork, XoVif } from './xo.mjs';
2
2
  declare const __brand: unique symbol;
3
3
  export type Branded<TBrand extends string, TType = string> = TType & {
4
4
  [__brand]: TBrand;
@@ -603,4 +603,28 @@ export type XapiVmStats = XapiStatsResponse<XapiVmStatsRaw>;
603
603
  export type XapiPoolStats = Record<XoHost['id'], XapiHostStats | {
604
604
  error: Record<string, unknown>;
605
605
  }>;
606
+ export type TrafficRuleProtocol = (typeof TRAFFIC_RULE_PROTOCOLS)[number];
607
+ export declare const SDN_CONTROLLER_OF_RULES_KEY = "xo:sdn-controller:of-rules";
608
+ export declare const TRAFFIC_RULE_PROTOCOLS: readonly ["ARP", "ICMP", "IP", "TCP", "UDP"];
609
+ export declare const TRAFFIC_RULE_PROTOCOLS_WITH_PORT: readonly TrafficRuleProtocol[];
610
+ export type TrafficRuleTargetType = XoNetwork['type'] | XoVif['type'];
611
+ export type TrafficRuleDirection = 'from' | 'to' | 'from/to';
612
+ export type RawTrafficRule = {
613
+ allow: boolean;
614
+ protocol: string;
615
+ ipRange: string;
616
+ direction: string;
617
+ port?: string;
618
+ };
619
+ type BaseTrafficRule = RawTrafficRule & {
620
+ id: string;
621
+ networkId: XoNetwork['id'];
622
+ };
623
+ export type TrafficRule = (BaseTrafficRule & {
624
+ type: XoVif['type'];
625
+ sourceId: XoVif['id'];
626
+ }) | (BaseTrafficRule & {
627
+ type: XoNetwork['type'];
628
+ sourceId: XoNetwork['id'];
629
+ });
606
630
  export {};
package/dist/common.mjs CHANGED
@@ -451,3 +451,6 @@ export const SUPPORTED_VDI_FORMAT = {
451
451
  vhd: 'vhd',
452
452
  qcow2: 'qcow2',
453
453
  };
454
+ export const SDN_CONTROLLER_OF_RULES_KEY = 'xo:sdn-controller:of-rules';
455
+ export const TRAFFIC_RULE_PROTOCOLS = ['ARP', 'ICMP', 'IP', 'TCP', 'UDP'];
456
+ export const TRAFFIC_RULE_PROTOCOLS_WITH_PORT = ['TCP', 'UDP'];
@@ -1,7 +1,56 @@
1
1
  import { WrappedXenApiRecord, XenApiHost, XenApiHostWrapped, XenApiNetwork, XenApiNetworkWrapped, XenApiRecord, XenApiSr, XenApiTask, XenApiVbd, XenApiVdi, XenApiVif, XenApiVm, XenApiVmWrapped, XenApiVtpm } from '../xen-api.mjs';
2
- import type { BOND_MODE, OPAQUE_REF_NULL, SUPPORTED_VDI_FORMAT, VBD_MODE, VBD_TYPE, VDI_TYPE, VIF_LOCKING_MODE } from '../common.mjs';
2
+ import type { BOND_MODE, OPAQUE_REF_NULL, SUPPORTED_VDI_FORMAT, VBD_MODE, VBD_TYPE, VDI_TYPE, VIF_LOCKING_MODE, VM_OPERATIONS } from '../common.mjs';
3
3
  import type { PassThrough, Readable } from 'node:stream';
4
4
  import type { XapiXoRecord, XoGpuGroup, XoHost, XoNetwork, XoPif, XoSr, XoUser, XoVdi, XoVgpuType, XoVm, XoVmTemplate, XoVif, XoVmSnapshot } from '../xo.mjs';
5
+ /**
6
+ * Properties accepted by {@link Xapi.editVm}.
7
+ *
8
+ * Field names match the canonical (camelCase) properties defined by the
9
+ * underlying `_editVm` (via `makeEditObject`). `_editVm` still resolves the
10
+ * snake_case and legacy aliases, but the canonical names are used here.
11
+ */
12
+ export interface EditVmProps {
13
+ affinityHost?: string | null;
14
+ autoPoweron?: boolean;
15
+ blockedOperations?: Partial<Record<VM_OPERATIONS, boolean | string | null>>;
16
+ coresPerSocket?: number | string | null;
17
+ cpuCap?: number | null;
18
+ cpuMask?: number[];
19
+ cpuWeight?: number | null;
20
+ cpus?: number;
21
+ cpusStaticMax?: number | string;
22
+ /**
23
+ * Update VM creation metadata stored under `other_config.xo:*`. The object is
24
+ * merged with the existing data.
25
+ */
26
+ creation?: {
27
+ user?: string;
28
+ };
29
+ expNestedHvm?: boolean;
30
+ hasVendorDevice?: boolean;
31
+ highAvailability?: 'best-effort' | 'restart' | '';
32
+ hvmBootFirmware?: string | null;
33
+ memory?: number | string;
34
+ memoryMax?: number | string;
35
+ memoryMin?: number | string;
36
+ memoryStaticMax?: number | string;
37
+ nameDescription?: string;
38
+ nameLabel?: string;
39
+ nestedVirt?: boolean;
40
+ nicType?: string | null;
41
+ notes?: string | null;
42
+ PV_args?: string;
43
+ secureBoot?: boolean;
44
+ startDelay?: number;
45
+ suspendSr?: string | null;
46
+ tags?: string[];
47
+ uefiMode?: 'setup' | 'user';
48
+ vga?: 'std' | 'cirrus';
49
+ videoram?: 1 | 2 | 4 | 8 | 16;
50
+ viridian?: boolean;
51
+ virtualizationMode?: 'pv' | 'hvm';
52
+ xenStoreData?: Record<string, string | null>;
53
+ }
5
54
  export type XcpPatches = {
6
55
  changelog?: {
7
56
  author: string;
@@ -105,6 +154,7 @@ export interface Xapi {
105
154
  xenstore_data?: Record<string, string>;
106
155
  }): Promise<XenApiVdi['$ref']>;
107
156
  SR_reclaimSpace(ref: XenApiSr['$ref']): Promise<void>;
157
+ editVm(id: XoVm['id'], props: EditVmProps, checkLimits?: (limits: Record<string, number>, vm: XenApiVmWrapped) => Promise<void>): Promise<void>;
108
158
  startVm(id: XoVm['id'], opts?: {
109
159
  bypassMacAddressesCheck?: boolean;
110
160
  force?: boolean;
package/dist/xo-app.d.mts CHANGED
@@ -76,7 +76,7 @@ export type XoApp = {
76
76
  };
77
77
  config: {
78
78
  get<T = string>(path: string): T;
79
- getOptional(path: string): Record<string, string> | undefined;
79
+ getOptional<T = unknown>(path: string): T | undefined;
80
80
  getOptionalDuration(path: string): number | undefined;
81
81
  getGuiRoutes(): Promise<{
82
82
  default: {
@@ -269,6 +269,8 @@ export type XoApp = {
269
269
  rebootVm?: boolean;
270
270
  parentTask?: VatesTask;
271
271
  }): Promise<void>;
272
+ setVmResourceSet(vmId: XoVm['id'], resourceSetId: string | null, force?: boolean): Promise<void>;
273
+ shareVmResourceSet(vmId: XoVm['id']): Promise<void>;
272
274
  removeUserFromGroup(userId: XoUser['id'], id: XoGroup['id']): Promise<void>;
273
275
  runJob(job: AnyXoJob, schedule: XoSchedule): void;
274
276
  runWithApiContext: (user: XoUser | undefined, fn: () => void) => Promise<unknown>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vates/types",
3
3
  "private": false,
4
- "version": "1.25.0",
4
+ "version": "1.26.0",
5
5
  "main": "./dist/index.mjs",
6
6
  "exports": {
7
7
  ".": {