Class: Pvectl::Commands::Get::Handlers::Subscription
- Inherits:
-
Object
- Object
- Pvectl::Commands::Get::Handlers::Subscription
- Includes:
- ResourceHandler
- Defined in:
- lib/pvectl/commands/get/handlers/subscription.rb
Overview
Handler for ‘pvectl get subscription`.
Aggregates subscription records across cluster nodes via Repositories::Subscription. Supports filtering to a single node with ‘–node`.
Instance Method Summary collapse
- #describe(name:, node: nil, args: [], vmid: nil) ⇒ Models::Subscription
-
#initialize(repository: nil) ⇒ Subscription
constructor
A new instance of Subscription.
- #list(node: nil, name: nil, args: [], storage: nil, **_options) ⇒ Array<Models::Subscription>
- #presenter ⇒ Presenters::Subscription
Methods included from ResourceHandler
Constructor Details
#initialize(repository: nil) ⇒ Subscription
Returns a new instance of Subscription.
20 21 22 |
# File 'lib/pvectl/commands/get/handlers/subscription.rb', line 20 def initialize(repository: nil) @repository = repository end |
Instance Method Details
#describe(name:, node: nil, args: [], vmid: nil) ⇒ Models::Subscription
38 39 40 41 42 43 44 45 |
# File 'lib/pvectl/commands/get/handlers/subscription.rb', line 38 def describe(name:, node: nil, args: [], vmid: nil) raise ArgumentError, "Invalid node name" if name.nil? || name.empty? record = repository.get(name) raise Pvectl::ResourceNotFoundError, "Subscription not found for node: #{name}" if record.nil? record end |
#list(node: nil, name: nil, args: [], storage: nil, **_options) ⇒ Array<Models::Subscription>
26 27 28 |
# File 'lib/pvectl/commands/get/handlers/subscription.rb', line 26 def list(node: nil, name: nil, args: [], storage: nil, **) repository.list(node: node) end |
#presenter ⇒ Presenters::Subscription
31 32 33 |
# File 'lib/pvectl/commands/get/handlers/subscription.rb', line 31 def presenter Pvectl::Presenters::Subscription.new end |