Class: Pvectl::Commands::EditContainer

Inherits:
Object
  • Object
show all
Includes:
EditResourceCommand
Defined in:
lib/pvectl/commands/edit_container.rb,
sig/pvectl/commands/edit_container.rbs

Overview

Handler for the pvectl edit container command.

Includes EditResourceCommand for shared workflow and overrides template methods with container-specific behavior.

Examples:

Basic usage

pvectl edit container 200

With custom editor

pvectl edit container 200 --editor nano

Dry-run mode

pvectl edit container 200 --dry-run

Instance Method Summary collapse

Methods included from EditResourceCommand

#build_editor_session, #display_diff, #execute, included, #initialize, #load_config, #service_options, #usage_error

Instance Method Details

#build_edit_service(connection) ⇒ Services::EditContainer

Builds the container edit service.

Parameters:

  • API connection

Returns:

  • container edit service



46
47
48
49
50
51
52
53
# File 'lib/pvectl/commands/edit_container.rb', line 46

def build_edit_service(connection)
  ct_repo = Pvectl::Repositories::Container.new(connection)
  Pvectl::Services::EditContainer.new(
    container_repository: ct_repo,
    editor_session: build_editor_session,
    options: service_options
  )
end

#execute_params(resource_id) ⇒ Hash

Builds execution parameters from a container ID.

Parameters:

  • CTID (converted to Integer)

Returns:

  • parameters for the edit service



38
39
40
# File 'lib/pvectl/commands/edit_container.rb', line 38

def execute_params(resource_id)
  { ctid: resource_id.to_i }
end

#resource_id_labelString

Returns human label for container IDs.

Returns:

  • human label for container IDs



30
31
32
# File 'lib/pvectl/commands/edit_container.rb', line 30

def resource_id_label
  "CTID"
end

#resource_labelString

Returns human label for container resources.

Returns:

  • human label for container resources



25
26
27
# File 'lib/pvectl/commands/edit_container.rb', line 25

def resource_label
  "container"
end