Class: Pvectl::Repositories::Capabilities

Inherits:
Base
  • Object
show all
Defined in:
lib/pvectl/repositories/capabilities.rb

Overview

Repository for Proxmox node capabilities.

Aggregates feature information from the two most useful capability endpoints — QEMU CPU models and QEMU machine types — into a flat collection of Capability models. The cpu-flags and migration capability endpoints are intentionally out of scope for the initial implementation (YAGNI); they can be added when there is a concrete consumer need.

Examples:

List capabilities for a node

repo = Capabilities.new(connection)
caps = repo.list(node: "pve1")
caps.each { |c| puts "#{c.kind}: #{c.name}" }

See Also:

Constant Summary collapse

CPU_ENDPOINT =

CPU capability endpoint path (without leading slash).

"capabilities/qemu/cpu"
MACHINES_ENDPOINT =

Machine type capability endpoint path (without leading slash).

"capabilities/qemu/machines"

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize

Constructor Details

This class inherits a constructor from Pvectl::Repositories::Base

Instance Method Details

#list(node:) ⇒ Array<Models::Capability>

Lists capabilities for a node.

Combines ‘GET /nodes/node/capabilities/qemu/cpu` and `GET /nodes/node/capabilities/qemu/machines`. Each entry becomes a Capability instance — CPU models first, then machine types.

Parameters:

  • node (String)

    cluster node name (required)

Returns:

Raises:

  • (ArgumentError)

    when ‘node` is nil/empty

  • (StandardError)

    propagated from the API on auth/connection failure



38
39
40
41
42
# File 'lib/pvectl/repositories/capabilities.rb', line 38

def list(node:)
  raise ArgumentError, "node is required" if node.nil? || node.to_s.empty?

  cpus(node) + machines(node)
end