Class: Pvectl::Commands::Get::Handlers::Tasks

Inherits:
Object
  • Object
show all
Includes:
ResourceHandler
Defined in:
lib/pvectl/commands/get/handlers/tasks.rb

Overview

Handler for listing Proxmox tasks (async operations).

Implements ResourceHandler interface for the “tasks” resource type. Delegates to Services::TaskListing for multi-node task listing.

Examples:

Using via ResourceRegistry

handler = ResourceRegistry.for("tasks")
tasks = handler.list(node: "pve1", limit: 20)
presenter = handler.presenter

See Also:

Instance Method Summary collapse

Methods included from ResourceHandler

#selector_class

Constructor Details

#initialize(service: nil) ⇒ Tasks

Creates handler with optional service for dependency injection.

Parameters:



26
27
28
# File 'lib/pvectl/commands/get/handlers/tasks.rb', line 26

def initialize(service: nil)
  @service = service
end

Instance Method Details

#list(node: nil, name: nil, limit: 50, since: nil, until_time: nil, type_filter: nil, status_filter: nil, **_options) ⇒ Array<Models::TaskEntry>

Lists tasks with optional filtering.

Parameters:

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

    filter by node name (nil = all nodes)

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

    unused, for interface compatibility

  • limit (Integer) (defaults to: 50)

    max entries (default 50)

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

    start time filter

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

    end time filter

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

    task type filter

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

    status filter

Returns:



40
41
42
43
44
45
46
47
# File 'lib/pvectl/commands/get/handlers/tasks.rb', line 40

def list(node: nil, name: nil, limit: 50, since: nil, until_time: nil,
         type_filter: nil, status_filter: nil, **_options)
  service.list(
    node: node, vmid: nil, limit: limit, since: since,
    until_time: until_time, type_filter: type_filter,
    status_filter: status_filter
  )
end

#presenterPresenters::TaskEntry

Returns presenter for task entries.

Returns:



52
53
54
# File 'lib/pvectl/commands/get/handlers/tasks.rb', line 52

def presenter
  Pvectl::Presenters::TaskEntry.new
end