Class: Pvectl::Commands::Get::Handlers::Snapshots
- Inherits:
-
Object
- Object
- Pvectl::Commands::Get::Handlers::Snapshots
- Includes:
- ResourceHandler
- Defined in:
- lib/pvectl/commands/get/handlers/snapshots.rb
Overview
Handler for listing and describing snapshots.
Uses –vmid flag (repeatable) for VM/CT filtering and –node for node filtering. Without –vmid, operates cluster-wide.
Instance Method Summary collapse
-
#describe(name:, node: nil, args: [], vmid: nil, **_options) ⇒ Models::SnapshotDescription
Describes a snapshot by name.
-
#initialize(service: nil) ⇒ Snapshots
constructor
A new instance of Snapshots.
-
#list(node: nil, name: nil, args: [], storage: nil, vmid: nil, **_options) ⇒ Array<Models::Snapshot>
Lists snapshots, optionally filtered by VMIDs and/or node.
-
#presenter ⇒ Presenters::Snapshot
Returns presenter for snapshots.
Methods included from ResourceHandler
Constructor Details
#initialize(service: nil) ⇒ Snapshots
Returns a new instance of Snapshots.
21 22 23 |
# File 'lib/pvectl/commands/get/handlers/snapshots.rb', line 21 def initialize(service: nil) @service = service end |
Instance Method Details
#describe(name:, node: nil, args: [], vmid: nil, **_options) ⇒ Models::SnapshotDescription
Describes a snapshot by name.
43 44 45 46 |
# File 'lib/pvectl/commands/get/handlers/snapshots.rb', line 43 def describe(name:, node: nil, args: [], vmid: nil, **) parsed_vmids = parse_vmids(vmid) service.describe(parsed_vmids, name, node: node) end |
#list(node: nil, name: nil, args: [], storage: nil, vmid: nil, **_options) ⇒ Array<Models::Snapshot>
Lists snapshots, optionally filtered by VMIDs and/or node.
31 32 33 34 |
# File 'lib/pvectl/commands/get/handlers/snapshots.rb', line 31 def list(node: nil, name: nil, args: [], storage: nil, vmid: nil, **) parsed_vmids = parse_vmids(vmid) service.list(parsed_vmids, node: node) end |
#presenter ⇒ Presenters::Snapshot
Returns presenter for snapshots.
51 52 53 |
# File 'lib/pvectl/commands/get/handlers/snapshots.rb', line 51 def presenter Pvectl::Presenters::Snapshot.new end |