mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[vcloud_director] Add ability to undeploy vApp
This commit is contained in:
parent
e2c22289ed
commit
31954efdaa
3 changed files with 33 additions and 7 deletions
|
@ -109,6 +109,7 @@ module Fog
|
||||||
request :get_vms_by_metadata
|
request :get_vms_by_metadata
|
||||||
request :get_vm
|
request :get_vm
|
||||||
request :post_task_cancel
|
request :post_task_cancel
|
||||||
|
request :undeploy
|
||||||
|
|
||||||
class Model < Fog::Model
|
class Model < Fog::Model
|
||||||
def initialize(attrs={})
|
def initialize(attrs={})
|
||||||
|
|
|
@ -5,10 +5,10 @@ module Fog
|
||||||
class VcloudDirector
|
class VcloudDirector
|
||||||
|
|
||||||
class Vapp < Model
|
class Vapp < Model
|
||||||
|
|
||||||
|
|
||||||
identity :id
|
identity :id
|
||||||
|
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :type
|
attribute :type
|
||||||
attribute :href
|
attribute :href
|
||||||
|
@ -20,7 +20,7 @@ module Fog
|
||||||
attribute :network_config, :aliases => :NetworkConfigSection, :squash => :NetworkConfig
|
attribute :network_config, :aliases => :NetworkConfigSection, :squash => :NetworkConfig
|
||||||
attribute :owner, :aliases => :Owner, :squash => :User
|
attribute :owner, :aliases => :Owner, :squash => :User
|
||||||
attribute :InMaintenanceMode, :type => :boolean
|
attribute :InMaintenanceMode, :type => :boolean
|
||||||
|
|
||||||
def vms
|
def vms
|
||||||
requires :id
|
requires :id
|
||||||
service.vms(:vapp => self)
|
service.vms(:vapp => self)
|
||||||
|
@ -30,9 +30,12 @@ module Fog
|
||||||
requires :id
|
requires :id
|
||||||
service.tags(:vm => self)
|
service.tags(:vm => self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def undeploy
|
||||||
|
service.undeploy(id)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
22
lib/fog/vcloud_director/requests/compute/undeploy.rb
Normal file
22
lib/fog/vcloud_director/requests/compute/undeploy.rb
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class VcloudDirector
|
||||||
|
class Real
|
||||||
|
def undeploy(vapp_id)
|
||||||
|
body = <<EOF
|
||||||
|
<UndeployVAppParams xmlns="http://www.vmware.com/vcloud/v1.5">
|
||||||
|
<UndeployPowerAction>shutdown</UndeployPowerAction>
|
||||||
|
</UndeployVAppParams>
|
||||||
|
EOF
|
||||||
|
request(
|
||||||
|
:body => body,
|
||||||
|
:expects => 202,
|
||||||
|
:method => 'POST',
|
||||||
|
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.undeployVAppParams+xml' },
|
||||||
|
:path => "vApp/#{vapp_id}/action/undeploy"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue