Class: A2::Subcommand::NodeMgmt::BulkDeleteById

Inherits:
CmdParse::Command
  • Object
show all
Includes:
Approved
Defined in:
lib/a2/subcommands/node_mgmt.rb

Instance Method Summary collapse

Methods included from Approved

#add_approval_option!, #ask_for_approval, #with_approval

Constructor Details

#initializeBulkDeleteById

Returns a new instance of BulkDeleteById.



40
41
42
43
# File 'lib/a2/subcommands/node_mgmt.rb', line 40

def initialize
  super('bulk-delete-by-ids', takes_commands: false)
  @opt = add_approval_option!(options)
end

Instance Method Details

#execute(ids) ⇒ Object



45
46
47
48
49
# File 'lib/a2/subcommands/node_mgmt.rb', line 45

def execute(ids)
  with_approval(message: "delete nodes", auto_approved: @opt[:auto_approved]) do
    puts JSON.pretty_generate(A2::Client.new(command_parser.data).bulk_delete_managed_nodes_by_id(id))
  end
end