@vates/types 1.5.0 → 1.7.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
@@ -528,65 +528,69 @@ type XapiStatsResponse<T> = {
528
528
  interval: number;
529
529
  stats: T;
530
530
  };
531
+ type StatValues = (number | null)[];
532
+ type RecordStatValues = Record<string, StatValues>;
531
533
  export type XapiStatsGranularity = 'seconds' | 'minutes' | 'hours' | 'days';
532
- export type XapiHostStats = XapiStatsResponse<{
533
- cpus?: Record<string, number[]>;
534
+ export type XapiHostStatsRaw = {
535
+ cpus?: RecordStatValues;
534
536
  ioThroughput?: {
535
- r: Record<string, number[]>;
536
- w: Record<string, number[]>;
537
+ r: RecordStatValues;
538
+ w: RecordStatValues;
537
539
  };
538
540
  iops?: {
539
- r: Record<string, number[]>;
540
- w: Record<string, number[]>;
541
+ r: RecordStatValues;
542
+ w: RecordStatValues;
541
543
  };
542
- iowait?: Record<string, number[]>;
544
+ iowait?: RecordStatValues;
543
545
  latency?: {
544
- r: Record<string, number[]>;
545
- w: Record<string, number[]>;
546
+ r: RecordStatValues;
547
+ w: RecordStatValues;
546
548
  };
547
- load?: number[];
548
- memory?: number[];
549
- memoryFree?: number[];
549
+ load?: StatValues;
550
+ memory?: StatValues;
551
+ memoryFree?: StatValues;
550
552
  pifs?: {
551
- rx: Record<string, number[]>;
552
- tx: Record<string, number[]>;
553
+ rx: RecordStatValues;
554
+ tx: RecordStatValues;
553
555
  };
554
- }>;
555
- export type XapiVmStats = XapiStatsResponse<{
556
- cpus?: Record<string, number[]>;
557
- cpuUsage?: number[];
558
- runstateFullrun?: number[];
559
- runstateFullContention?: number[];
560
- runstatePartialRun?: number[];
561
- runstatePartialContention?: number[];
562
- runstateConcurrencyHazard?: number[];
563
- runstateBlocked?: number[];
556
+ };
557
+ export type XapiHostStats = XapiStatsResponse<XapiHostStatsRaw>;
558
+ export type XapiVmStatsRaw = {
559
+ cpus?: RecordStatValues;
560
+ cpuUsage?: StatValues;
561
+ runstateFullrun?: StatValues;
562
+ runstateFullContention?: StatValues;
563
+ runstatePartialRun?: StatValues;
564
+ runstatePartialContention?: StatValues;
565
+ runstateConcurrencyHazard?: StatValues;
566
+ runstateBlocked?: StatValues;
564
567
  iops?: {
565
- r: Record<string, number[]>;
566
- w: Record<string, number[]>;
568
+ r: RecordStatValues;
569
+ w: RecordStatValues;
567
570
  };
568
- memory?: number[];
569
- memoryFree?: number[];
570
- memoryTarget?: number[];
571
+ memory?: StatValues;
572
+ memoryFree?: StatValues;
573
+ memoryTarget?: StatValues;
571
574
  vifs?: {
572
- rx: Record<string, number[]>;
573
- tx: Record<string, number[]>;
575
+ rx: RecordStatValues;
576
+ tx: RecordStatValues;
574
577
  };
575
578
  vifErrors?: {
576
- rx: Record<string, number[]>;
577
- tx: Record<string, number[]>;
579
+ rx: RecordStatValues;
580
+ tx: RecordStatValues;
578
581
  };
579
582
  xvds?: {
580
- w?: Record<string, number[]>;
581
- r?: Record<string, number[]>;
582
- total?: Record<string, number[]>;
583
+ w?: RecordStatValues;
584
+ r?: RecordStatValues;
585
+ total?: RecordStatValues;
583
586
  };
584
587
  vbdLatency?: {
585
- w: Record<string, number[]>;
586
- r: Record<string, number[]>;
588
+ w: RecordStatValues;
589
+ r: RecordStatValues;
587
590
  };
588
- vbdIowait?: Record<string, number[]>;
589
- vbdInflight?: Record<string, number[]>;
590
- vbdAvgquSz?: Record<string, number[]>;
591
- }>;
591
+ vbdIowait?: RecordStatValues;
592
+ vbdInflight?: RecordStatValues;
593
+ vbdAvgquSz?: RecordStatValues;
594
+ };
595
+ export type XapiVmStats = XapiStatsResponse<XapiVmStatsRaw>;
592
596
  export {};
package/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './common.mjs';
2
2
  export * from './xen-api.mjs';
3
3
  export * from './xo.mjs';
4
+ export * from './lib/xen-orchestra-xapi.mjs';
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './common.mjs';
2
2
  export * from './xen-api.mjs';
3
3
  export * from './xo.mjs';
4
+ export * from './lib/xen-orchestra-xapi.mjs';
@@ -1,5 +1,6 @@
1
- import { WrappedXenApiRecord, XenApiNetworkWrapped, XenApiRecord } from '../xen-api.mjs';
2
- import type { XoHost, XoNetwork, XoPif } from '../xo.mjs';
1
+ import { WrappedXenApiRecord, XenApiNetworkWrapped, XenApiRecord, XenApiSr, XenApiVdi, XenApiVm, XenApiVmWrapped } from '../xen-api.mjs';
2
+ import type { Readable } from 'node:stream';
3
+ import type { XoGpuGroup, XoVgpuType, XoHost, XoNetwork, XoPif, XoSr, XoUser, XoVdi, XoVm, XoVmTemplate } from '../xo.mjs';
3
4
  type XcpPatches = {
4
5
  changelog?: {
5
6
  author: string;
@@ -46,5 +47,75 @@ export interface Xapi {
46
47
  deleteNetwork(id: XoNetwork['id']): Promise<void>;
47
48
  listMissingPatches(host: XoHost['id']): Promise<XcpPatches[] | XsPatches[]>;
48
49
  pool_emergencyShutdown(): Promise<void>;
50
+ resumeVm(id: XoVm['id']): Promise<void>;
51
+ unpauseVm(id: XoVm['id']): Promise<void>;
52
+ startVm(id: XoVm['id'], opts?: {
53
+ bypassMacAddressesCheck?: boolean;
54
+ force?: boolean;
55
+ hostId?: XoHost['id'];
56
+ /**
57
+ * if startOnly is true and the VM is not halted, throw VM_BAD_POWER_STATE
58
+ * otherwise, unpause/resume the VM
59
+ *
60
+ * @default false
61
+ */
62
+ startOnly?: boolean;
63
+ }): Promise<void>;
64
+ VM_import(stream: Readable, srRef?: XenApiSr['$ref'], onVmCreation?: null | ((vm: XenApiVm) => unknown)): Promise<XenApiVm['$ref']>;
65
+ createVm(templateUuid: XoVmTemplate['uuid'], metadataVm: {
66
+ affinityHost?: XoHost['id'];
67
+ name_label: string;
68
+ nameLabel?: string;
69
+ clone?: boolean;
70
+ installRepository?: XoVdi['id'] | '' | null;
71
+ vdis?: (/** Create VDI */ {
72
+ name_label: string;
73
+ size: number;
74
+ sr?: XoSr['id'];
75
+ name_description?: string;
76
+ } | /** Update VDI*/ {
77
+ userdevice: string;
78
+ name_label?: string;
79
+ size?: number;
80
+ sr?: XoSr['id'];
81
+ name_description?: string;
82
+ } | /** Destroy VDI*/ {
83
+ destroy: true;
84
+ userdevice: string;
85
+ })[];
86
+ vifs?: (/** Create/update VIF */ {
87
+ device?: string;
88
+ ipv4_allowed?: string[];
89
+ ipv6_allowed?: string[];
90
+ mac?: string;
91
+ mtu?: number;
92
+ network: string;
93
+ } | /** Destroy VIF */ {
94
+ destroy: true;
95
+ device: string;
96
+ })[];
97
+ existingVdis?: {
98
+ $SR: XoSr['id'];
99
+ size: number;
100
+ userdevice: string;
101
+ }[];
102
+ vgpuType?: XoVgpuType['id'];
103
+ gpuGroup?: XoGpuGroup['id'];
104
+ copyHostBiosStrings?: boolean;
105
+ }, checkLimits?: boolean, creatorId?: XoUser['id'], opts?: {
106
+ destroyAllVifs: boolean;
107
+ }): Promise<XenApiVmWrapped>;
108
+ VDI_destroyCloudInitConfig(vdiRef: XenApiVdi['$ref'], opts?: {
109
+ timeLimit?: number;
110
+ }): Promise<void>;
111
+ VM_createCloudInitConfig(vmRef: XenApiVm['$ref'], cloudConfig: string, opts?: {
112
+ networkConfig?: string;
113
+ }): Promise<XoVdi['uuid']>;
114
+ VM_destroy(vmRef: XenApiVm['$ref'], opts?: {
115
+ deleteDisks?: boolean;
116
+ force?: boolean;
117
+ bypassBlockedOperation?: boolean;
118
+ forceDeleteDefaultTemplate?: boolean;
119
+ }): Promise<void>;
49
120
  }
50
121
  export {};
@@ -184,6 +184,8 @@ type XenApiVmCallMethods = {
184
184
  (method: 'hard_shutdown'): Promise<void>;
185
185
  (method: 'clean_reboot'): Promise<void>;
186
186
  (method: 'hard_reboot'): Promise<void>;
187
+ (method: 'pause'): Promise<void>;
188
+ (method: 'suspend'): Promise<void>;
187
189
  (method: 'record_data_source', dataSource: string): Promise<void>;
188
190
  (method: 'forget_data_source_archives', dataSource: string): Promise<void>;
189
191
  };
@@ -676,11 +678,13 @@ export interface XenApiSm {
676
678
  other_config: Record<string, string>;
677
679
  required_api_version: string;
678
680
  required_cluster_stack: string[];
681
+ supported_image_formats?: string[];
679
682
  type: string;
680
683
  uuid: string;
681
684
  vendor: string;
682
685
  version: string;
683
686
  }
687
+ export type XenApiSmWrapped = WrapperXenApi<XenApiSm, 'SM'>;
684
688
  export interface XenApiSr {
685
689
  $ref: Branded<'SR'>;
686
690
  allowed_operations: STORAGE_OPERATIONS[];
package/dist/xo.d.mts CHANGED
@@ -434,6 +434,19 @@ export type XoSr = BaseXapiXo & {
434
434
  type: 'SR';
435
435
  usage: number;
436
436
  };
437
+ export type XoSm = BaseXapiXo & {
438
+ id: Branded<'SM'>;
439
+ SM_type: string;
440
+ vendor: string;
441
+ name_label: string;
442
+ name_description: string;
443
+ configuration: Record<string, string>;
444
+ features: Record<string, number>;
445
+ driver_filename: string;
446
+ required_cluster_stack: string[];
447
+ supported_image_formats: string[];
448
+ type: 'SM';
449
+ };
437
450
  export type XoUser = {
438
451
  authProviders?: Record<string, string>;
439
452
  email: string;
@@ -467,6 +480,7 @@ type BaseXoVdi = BaseXapiXo & {
467
480
  name_label: string;
468
481
  other_config: Record<string, string>;
469
482
  parent?: XoVdiUnmanaged['id'];
483
+ image_format?: string;
470
484
  size: number;
471
485
  snapshots: XoVdiSnapshot['id'][];
472
486
  tags: string[];
@@ -555,7 +569,7 @@ export type XoVtpm = BaseXapiXo & {
555
569
  id: Branded<'VTPM'>;
556
570
  type: 'VTPM';
557
571
  };
558
- export type XapiXoRecord = XoAlarm | XoGpuGroup | XoHost | XoMessage | XoNetwork | XoPci | XoPgpu | XoPif | XoPool | XoSr | XoVbd | XoVdi | XoVdiSnapshot | XoVdiUnmanaged | XoVgpu | XoVgpuType | XoVif | XoVm | XoVmController | XoVmSnapshot | XoVmTemplate | XoVtpm;
572
+ export type XapiXoRecord = XoAlarm | XoGpuGroup | XoHost | XoMessage | XoNetwork | XoPci | XoPgpu | XoPif | XoPool | XoSr | XoVbd | XoVdi | XoVdiSnapshot | XoVdiUnmanaged | XoVgpu | XoVgpuType | XoVif | XoVm | XoVmController | XoVmSnapshot | XoVmTemplate | XoVtpm | XoSm;
559
573
  export type NonXapiXoRecord = XoGroup | XoProxy | XoJob | XoBackupRepository | XoSchedule | XoServer | XoUser;
560
574
  export type XoRecord = XapiXoRecord | NonXapiXoRecord;
561
575
  export type AnyXoVm = XoVm | XoVmSnapshot | XoVmTemplate | XoVmController;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vates/types",
3
3
  "private": false,
4
- "version": "1.5.0",
4
+ "version": "1.7.0",
5
5
  "main": "./dist/index.mjs",
6
6
  "exports": {
7
7
  ".": {