Class: Vcloud::CLI::Utils::StopVapp

Inherits:
Object
  • Object
show all
Includes:
Methadone::CLILogging, Methadone::Main
Defined in:
lib/vcloud/cli/utils/stop_vapp.rb

Class Method Summary collapse

Class Method Details

.runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vcloud/cli/utils/stop_vapp.rb', line 13

def self.run

  main do |identifier|
    vcloud = ::Fog::Compute::VcloudDirector.new
    if identifier =~ /^vapp-[-0-9a-f]+/
      vapp = Vcloud::Core::Vapp.new(identifier)
    else
      vapp = Vcloud::Core::Vapp.get_by_name(identifier)
    end
    Fog.mock! if ENV['FOG_MOCK']
    task = vcloud.post_undeploy_vapp(vapp.id).body
    vcloud.process_task(task)
  end

  arg :identifier

  description "
  "

  go!

end