Class: Pvectl::Commands::Get::Handlers::Backups
- Inherits:
-
Object
- Object
- Pvectl::Commands::Get::Handlers::Backups
- Includes:
- ResourceHandler
- Defined in:
- lib/pvectl/commands/get/handlers/backups.rb
Overview
Handler for listing backups.
Unlike Snapshots handler, Backups allows listing all backups or filtering by optional VMID.
Instance Method Summary collapse
-
#initialize(service: nil) ⇒ Backups
constructor
A new instance of Backups.
-
#list(node: nil, name: nil, args: [], storage: nil, **_options) ⇒ Array<Models::Backup>
Lists backups with optional VMID filter.
-
#presenter ⇒ Presenters::Backup
Returns presenter for backups.
Methods included from ResourceHandler
Constructor Details
#initialize(service: nil) ⇒ Backups
Returns a new instance of Backups.
19 20 21 |
# File 'lib/pvectl/commands/get/handlers/backups.rb', line 19 def initialize(service: nil) @service = service end |
Instance Method Details
#list(node: nil, name: nil, args: [], storage: nil, **_options) ⇒ Array<Models::Backup>
Lists backups with optional VMID filter.
30 31 32 33 34 35 |
# File 'lib/pvectl/commands/get/handlers/backups.rb', line 30 def list(node: nil, name: nil, args: [], storage: nil, **) vmid = args.first&.to_i vmid = nil if vmid&.zero? service.list(vmid: vmid, storage: storage) end |
#presenter ⇒ Presenters::Backup
Returns presenter for backups.
40 41 42 |
# File 'lib/pvectl/commands/get/handlers/backups.rb', line 40 def presenter Pvectl::Presenters::Backup.new end |