Class: Pvectl::Commands::Get::Handlers::Services
- Inherits:
-
Object
- Object
- Pvectl::Commands::Get::Handlers::Services
- Includes:
- ResourceHandler
- Defined in:
- lib/pvectl/commands/get/handlers/services.rb
Overview
Handler for listing systemd services on Proxmox nodes.
Implements ResourceHandler interface for the “services” resource type. Uses Repositories::Service for data access and Presenters::Service for formatting.
When no node filter is supplied, lists services across all online nodes. The –node flag restricts the listing to a single node.
Instance Method Summary collapse
-
#initialize(repository: nil) ⇒ Services
constructor
Creates handler with optional repository for dependency injection.
-
#list(node: nil, name: nil, **_options) ⇒ Array<Models::Service>
Lists services, optionally filtered by node and service name.
-
#presenter ⇒ Presenters::Service
Returns presenter for services.
Methods included from ResourceHandler
Constructor Details
#initialize(repository: nil) ⇒ Services
Creates handler with optional repository for dependency injection.
29 30 31 |
# File 'lib/pvectl/commands/get/handlers/services.rb', line 29 def initialize(repository: nil) @repository = repository end |
Instance Method Details
#list(node: nil, name: nil, **_options) ⇒ Array<Models::Service>
Lists services, optionally filtered by node and service name.
39 40 41 42 43 |
# File 'lib/pvectl/commands/get/handlers/services.rb', line 39 def list(node: nil, name: nil, **) services = repository.list(node: node) services = services.select { |s| s.service == name } if name services end |
#presenter ⇒ Presenters::Service
Returns presenter for services.
48 49 50 |
# File 'lib/pvectl/commands/get/handlers/services.rb', line 48 def presenter Pvectl::Presenters::Service.new end |