/** * Copyright 2019 Leon Rinkel and vmngr/libvirt contributers. * * This file is part of the vmngr/libvirt project and is subject to the MIT * license as in the LICENSE file in the project root. * * @brief Contains actual libvirt bindings and related declarations. */ import bindings from "bindings"; // TODO: Check whether it is possible to not use default in this case. // tslint:disable-next-line:no-default-export export default bindings("libvirt"); export declare interface HypervisorOptions { uri: string; } export declare class Hypervisor { constructor(options: HypervisorOptions); connectOpen(): Promise; connectClose(): Promise; connectListAllDomains(flags?: ConnectListAllDomainsFlags): Promise; connectListDomains(): Promise; connectListDefinedDomains(): Promise; connectGetMaxVcpus(type?: string): Promise; connectGetHostname(): Promise; domainCreateXML(xml: string): Promise; domainDefineXML(xml: string): Promise; domainGetInfo(domain: Domain): Promise; domainGetID(domain: Domain): Promise; domainGetName(domain: Domain): Promise; domainGetUUIDString(domain: Domain): Promise; domainLookupByID(id: number): Promise; domainLookupByName(name: string): Promise; domainLookupByUUIDString(uuid: string): Promise; domainSave(domain: Domain, filename: string): Promise; domainRestore(filename: string): Promise; domainCreate(domain: Domain): Promise; domainShutdown(domain: Domain): Promise; domainGetXMLDesc(domain: Domain, flags?: DomainGetXMLDescFlags): Promise; nodeGetInfo(): Promise; } export declare const enum ConnectListAllDomainsFlags { ACTIVE = 1, INACTIVE = 2, PERSISTENT = 4, TRANSIENT = 8, RUNNING = 16, PAUSED = 32, SHUTOFF = 64, OTHER = 128, MANAGEDSAVE = 256, NO_MANAGEDSAVE = 512, AUTOSTART = 1024, NO_AUTOSTART = 2048, HAS_SNAPSHOT = 4096, NO_SNAPSHOT = 8192, HAS_CHECKPOINT = 16384, NO_CHECKPOINT = 32768, } export declare const enum DomainGetXMLDescFlags { SECURE = 1, INACTIVE = 2, UPDATE_CPU = 4, MIGRATABLE = 8, } export declare class Domain {} export declare const enum DomainState { NOSTATE = 0, RUNNING = 1, BLOCKED = 2, PAUSED = 3, SHUTDOWN = 4, SHUTOFF = 5, CRASHED = 6, PMSUSPENDED = 7, } export declare interface DomainInfo { state: DomainState; maxMem: number; memory: number; nrVirtCpu: number; cpuTime: number; } export declare interface NodeInfo { model: string; memory: number; cpus: number; mhz: number; nodes: number; sockets: number; cores: number; threads: number; }