Class: Pvectl::Repositories::Subscription

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

Overview

Repository for Proxmox subscription information per node.

Wraps the ‘GET /nodes/node/subscription` endpoint and aggregates subscription records across all nodes in the cluster.

Examples:

Listing subscriptions across the cluster

repo = Subscription.new(connection)
repo.list.each { |s| puts "#{s.node}: #{s.status} #{s.level}" }

See Also:

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#get(node) ⇒ Models::Subscription

Fetches the subscription record for a single node.

Parameters:

  • node (String)

    node name

Returns:



34
35
36
# File 'lib/pvectl/repositories/subscription.rb', line 34

def get(node)
  fetch_for(node)
end

#list(node: nil) ⇒ Array<Models::Subscription>

Lists subscription records for cluster nodes.

Returns one Subscription per online node. Offline / unreachable nodes return a Subscription with status=“unreachable” so the output remains stable instead of silently dropping rows.

Parameters:

  • node (String, nil) (defaults to: nil)

    filter to a single node (otherwise all online nodes)

Returns:



25
26
27
28
# File 'lib/pvectl/repositories/subscription.rb', line 25

def list(node: nil)
  node_names = node ? [node] : online_node_names
  node_names.map { |name| fetch_for(name) }
end