2013-06-20 19:36:34 +02:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
2013-08-27 11:19:54 +02:00
|
|
|
class VcloudDirector
|
2013-06-20 19:36:34 +02:00
|
|
|
|
2013-07-09 15:16:00 +02:00
|
|
|
class Vapp < Model
|
2013-09-16 15:38:38 +01:00
|
|
|
|
2013-06-20 19:36:34 +02:00
|
|
|
identity :id
|
2013-09-16 15:38:38 +01:00
|
|
|
|
2013-06-20 19:36:34 +02:00
|
|
|
attribute :name
|
|
|
|
attribute :type
|
|
|
|
attribute :href
|
|
|
|
attribute :description, :aliases => :Description
|
|
|
|
attribute :deployed, :type => :boolean
|
|
|
|
attribute :status
|
2013-08-19 16:04:25 +02:00
|
|
|
attribute :lease_settings, :aliases => :LeaseSettingsSection
|
2013-06-24 13:46:30 +02:00
|
|
|
attribute :network_section, :aliases => :"ovf:NetworkSection", :squash => :"ovf:Network"
|
2013-06-20 19:36:34 +02:00
|
|
|
attribute :network_config, :aliases => :NetworkConfigSection, :squash => :NetworkConfig
|
2013-06-24 13:46:30 +02:00
|
|
|
attribute :owner, :aliases => :Owner, :squash => :User
|
2013-06-20 19:36:34 +02:00
|
|
|
attribute :InMaintenanceMode, :type => :boolean
|
2013-09-16 15:38:38 +01:00
|
|
|
|
2013-06-24 13:46:30 +02:00
|
|
|
def vms
|
|
|
|
requires :id
|
2013-07-09 15:16:00 +02:00
|
|
|
service.vms(:vapp => self)
|
2013-06-24 13:46:30 +02:00
|
|
|
end
|
|
|
|
|
2013-08-26 16:57:58 +02:00
|
|
|
def tags
|
|
|
|
requires :id
|
|
|
|
service.tags(:vm => self)
|
|
|
|
end
|
2013-09-16 15:38:38 +01:00
|
|
|
|
|
|
|
def undeploy
|
2013-09-16 16:50:14 +01:00
|
|
|
response = service.undeploy(id)
|
|
|
|
service.process_task(response.body)
|
2013-09-16 15:38:38 +01:00
|
|
|
end
|
|
|
|
|
2013-09-17 14:52:14 +03:00
|
|
|
def power_on
|
|
|
|
response = service.post_vm_poweron(id)
|
|
|
|
service.process_task(response.body)
|
|
|
|
end
|
|
|
|
|
|
|
|
def power_off
|
|
|
|
response = service.post_vm_poweroff(id)
|
|
|
|
service.process_task(response.body)
|
|
|
|
end
|
|
|
|
|
2013-09-20 10:29:31 +03:00
|
|
|
def destroy
|
|
|
|
response = service.delete_vapp(id)
|
|
|
|
service.process_task(response.body)
|
|
|
|
end
|
|
|
|
|
2013-06-20 19:36:34 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-09-16 15:38:38 +01:00
|
|
|
end
|