Class: VCloudCloud::Steps::Undeploy

Inherits:
VCloudCloud::Step show all
Defined in:
lib/cloud/vcloud/steps/undeploy.rb

Overview

Undeployment means deallocation of all resources for a vApp/VM like CPU and memory from a vDC resource pool. Undeploying a vApp automatically undeploys all of the virtual machines it contains. www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/operations/POST-UndeployVApp.html

Instance Attribute Summary

Attributes inherited from VCloudCloud::Step

#client, #state

Instance Method Summary collapse

Methods inherited from VCloudCloud::Step

#cleanup, #initialize, #rollback

Constructor Details

This class inherits a constructor from VCloudCloud::Step

Instance Method Details

#perform(ref, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/cloud/vcloud/steps/undeploy.rb', line 7

def perform(ref, &block)
  entity = client.reload state[ref]
  if entity['deployed'] == 'true'
    link = entity.undeploy_link
    raise "#{entity.name} can't be undeployed" unless link
    params = VCloudSdk::Xml::WrapperFactory.create_instance 'UndeployVAppParams'
    client.invoke_and_wait :post, link, :payload => params
    state[ref] = client.reload entity
  end
end