Module: Pvectl::Commands::DeleteCommand
- Includes:
- IrreversibleCommand
- Included in:
- DeleteContainer, DeleteVm
- Defined in:
- lib/pvectl/commands/delete_command.rb,
sig/pvectl/commands/delete_command.rbs
Overview
Delete-specific functionality built on IrreversibleCommand.
Adds delete-specific behavior:
- Confirmation message mentioning disk destruction
- --keep-disks and --purge options in service_options
- Delegates to Services::ResourceDelete
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ void
Hook called when module is included.
Instance Method Summary collapse
- #apply_selectors ⇒ Array[untyped]
-
#confirm_operation(resources) ⇒ Boolean
Confirms delete operation — always required (uses --yes flag, not --force).
- #determine_exit_code ⇒ Integer
- #execute ⇒ Integer
-
#initialize ⇒ DeleteCommand
A new instance of DeleteCommand.
- #load_config ⇒ void
- #no_resources_found ⇒ Integer
- #output_results ⇒ void
- #perform_operation ⇒ Integer
- #resolve_resources ⇒ Array[untyped]
- #resource_type_symbol ⇒ Symbol
- #selector_strings ⇒ Array[String]
-
#service_options ⇒ Hash
Builds service options with delete-specific flags.
- #supported_resource? ⇒ Boolean
- #supported_types ⇒ Array[String]
- #usage_error ⇒ Integer
Methods included from IrreversibleCommand
Class Method Details
.included(base) ⇒ void
This method returns an undefined value.
Hook called when module is included.
25 26 27 |
# File 'lib/pvectl/commands/delete_command.rb', line 25 def self.included(base) base.extend(IrreversibleCommand::ClassMethods) end |
Instance Method Details
#apply_selectors ⇒ Array[untyped]
28 |
# File 'sig/pvectl/commands/delete_command.rbs', line 28 def apply_selectors: (Array[untyped] resources) -> Array[untyped] |
#confirm_operation(resources) ⇒ Boolean
Confirms delete operation — always required (uses --yes flag, not --force).
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/pvectl/commands/delete_command.rb', line 65 def confirm_operation(resources) return true if [:yes] $stdout.puts (resources) $stdout.puts "" $stdout.puts irreversibility_warning $stdout.print "Proceed? [y/N]: " response = $stdin.gets&.strip&.downcase %w[y yes].include?(response) end |
#determine_exit_code ⇒ Integer
38 |
# File 'sig/pvectl/commands/delete_command.rbs', line 38 def determine_exit_code: (Array[untyped] results) -> Integer |
#execute ⇒ Integer
12 |
# File 'sig/pvectl/commands/delete_command.rbs', line 12 def execute: () -> Integer |
#initialize ⇒ DeleteCommand
Returns a new instance of DeleteCommand.
10 |
# File 'sig/pvectl/commands/delete_command.rbs', line 10 def initialize: (String? resource_type, Array[String] | String | nil resource_ids, Hash[Symbol, untyped] , Hash[Symbol, untyped] ) -> void |
#load_config ⇒ void
This method returns an undefined value.
32 |
# File 'sig/pvectl/commands/delete_command.rbs', line 32 def load_config: () -> void |
#no_resources_found ⇒ Integer
42 |
# File 'sig/pvectl/commands/delete_command.rbs', line 42 def no_resources_found: () -> Integer |
#output_results ⇒ void
This method returns an undefined value.
36 |
# File 'sig/pvectl/commands/delete_command.rbs', line 36 def output_results: (Array[untyped] results) -> void |
#perform_operation ⇒ Integer
22 |
# File 'sig/pvectl/commands/delete_command.rbs', line 22 def perform_operation: () -> Integer |
#resolve_resources ⇒ Array[untyped]
24 |
# File 'sig/pvectl/commands/delete_command.rbs', line 24 def resolve_resources: (untyped connection) -> Array[untyped] |
#resource_type_symbol ⇒ Symbol
16 |
# File 'sig/pvectl/commands/delete_command.rbs', line 16 def resource_type_symbol: () -> Symbol |
#selector_strings ⇒ Array[String]
26 |
# File 'sig/pvectl/commands/delete_command.rbs', line 26 def selector_strings: () -> Array[String] |
#service_options ⇒ Hash
Builds service options with delete-specific flags.
111 112 113 114 115 116 |
# File 'lib/pvectl/commands/delete_command.rb', line 111 def opts = super opts[:keep_disks] = true if [:"keep-disks"] opts[:purge] = true if [:purge] opts end |
#supported_resource? ⇒ Boolean
20 |
# File 'sig/pvectl/commands/delete_command.rbs', line 20 def supported_resource?: () -> bool |
#supported_types ⇒ Array[String]
18 |
# File 'sig/pvectl/commands/delete_command.rbs', line 18 def supported_types: () -> Array[String] |
#usage_error ⇒ Integer
40 |
# File 'sig/pvectl/commands/delete_command.rbs', line 40 def usage_error: (String ) -> Integer |