IProxmoxClient.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. namespace RackPeek.Domain.Discovery;
  2. /// <summary>Reads a Proxmox VE API. The IO half of hypervisor discovery.</summary>
  3. public interface IProxmoxClient {
  4. /// <summary>Where this client is pointed, for error messages.</summary>
  5. string Endpoint { get; }
  6. /// <summary>
  7. /// The scope a vmid is unique within — the cluster name where there is one, and
  8. /// the node otherwise. Part of every guest's identity, so a guest that migrates
  9. /// between nodes stays the same resource.
  10. /// </summary>
  11. Task<string> GetIdentityScopeAsync(CancellationToken cancellationToken = default);
  12. Task<IReadOnlyList<ProxmoxNode>> GetNodesAsync(CancellationToken cancellationToken = default);
  13. /// <summary>
  14. /// Adds what only the per-node status call knows — currently the Proxmox version.
  15. /// Returns the node unchanged if the token may not read it: a read-only token
  16. /// without Sys.Audit can still see the guests, and a partial answer beats none.
  17. /// </summary>
  18. Task<ProxmoxNode> EnrichAsync(ProxmoxNode node, CancellationToken cancellationToken = default);
  19. /// <summary>Guests of one kind on one node. <paramref name="endpoint" /> is qemu or lxc.</summary>
  20. Task<IReadOnlyList<ProxmoxGuest>> GetGuestsAsync(
  21. string node,
  22. string endpoint,
  23. CancellationToken cancellationToken = default);
  24. /// <summary>
  25. /// Physical disks on a node. Needs the same permission as the status call, so it
  26. /// is gathered as part of enrichment and simply absent without it.
  27. /// </summary>
  28. Task<IReadOnlyList<ProxmoxDisk>> GetDisksAsync(string node, CancellationToken cancellationToken = default);
  29. /// <summary>Display adapters in a node, from its PCI device list.</summary>
  30. Task<IReadOnlyList<ProxmoxGpu>> GetGpusAsync(string node, CancellationToken cancellationToken = default);
  31. Task<ProxmoxGuestConfig> GetGuestConfigAsync(
  32. string node,
  33. string endpoint,
  34. int vmId,
  35. CancellationToken cancellationToken = default);
  36. }