1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vcloud/requests/compute/undeploy.rb
2014-02-19 12:30:59 +00:00

31 lines
1.1 KiB
Ruby

module Fog
module Vcloud
class Compute
class Real
def undeploy(vapp_uri, save_state = false)
# builder = Builder::XmlMarkup.new
# builder.UndeployVAppParams(:xmlns => 'http://www.vmware.com/vcloud/v1',
# :saveState => save_state) {}
builder = if version =='1.0'
"<UndeployVAppParams saveState=\"#{save_state.to_s}\" xmlns=\"http://www.vmware.com/vcloud/v1\"/>"
else
<<EOF
<UndeployVAppParams xmlns="http://www.vmware.com/vcloud/v1.5">
<UndeployPowerAction>shutdown</UndeployPowerAction>
</UndeployVAppParams>
EOF
end
request(
:body => builder,
:expects => 202,
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.undeployVAppParams+xml' },
:method => 'POST',
:uri => vapp_uri + '/action/undeploy',
:parse => true
)
end
end
end
end
end