def poweroff_vm(vmId)
      builder = Nokogiri::XML::Builder.new do |xml|
      xml.UndeployVAppParams(
        "xmlns" => "http://www.vmware.com/vcloud/v1.5") {
        xml.UndeployPowerAction 'powerOff'
      }
      end

      params = {
        'method' => :post,
        'command' => "/vApp/vm-#{vmId}/action/undeploy"
      }

      response, headers = send_request(params, builder.to_xml,
                      "application/vnd.vmware.vcloud.undeployVAppParams+xml")
      task_id = headers[:location].gsub(/.*\/task\//, "")
      task_id
    end
def poweroff_vm(vmId)
      builder = Nokogiri::XML::Builder.new do |xml|
      xml.UndeployVAppParams(
        "xmlns" => "http://www.vmware.com/vcloud/v1.5") {
        xml.UndeployPowerAction 'powerOff'
      }
      end

      params = {
        'method' => :post,
        'command' => "/vApp/vm-
      }

      response, headers = send_request(params, builder.to_xml,
                      "application/vnd.vmware.vcloud.undeployVAppParams+xml")
      task_id = headers[:location].gsub(/.*\/task\//, "")
      task_id
    end
def poweroff_vm ( vmId ) builder = Nokogiri :: XML :: Builder . new do | xml | xml . UndeployVAppParams ( "xmlns" => "http://www.vmware.com/vcloud/v1.5" ) { xml . UndeployPowerAction 'powerOff' } end params = { 'method' => :post , 'command' => "/vApp/vm-#{vmId}/action/undeploy" } response , headers = send_request ( params , builder . to_xml , "application/vnd.vmware.vcloud.undeployVAppParams+xml" ) task_id = headers [ :location ] . gsub ( / \/ \/ / , "" ) task_id end
Shutdown a given vm
Shutdown a given vm