2011-10-05 05:58:50 -04:00
|
|
|
require 'fog/vcloud/models/compute/helpers/status'
|
2011-09-26 11:20:17 -04:00
|
|
|
module Fog
|
|
|
|
module Vcloud
|
|
|
|
class Compute
|
|
|
|
class Vapp < Fog::Vcloud::Model
|
2011-10-05 05:58:50 -04:00
|
|
|
include Fog::Vcloud::Compute::Helpers::Status
|
|
|
|
|
2012-01-30 09:24:14 -05:00
|
|
|
identity :href, :aliases => :Href
|
|
|
|
attribute :links, :aliases => :Link, :type => :array
|
|
|
|
ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd
|
2011-09-26 11:20:17 -04:00
|
|
|
|
|
|
|
attribute :name
|
|
|
|
attribute :type
|
|
|
|
attribute :status
|
2011-10-05 05:58:50 -04:00
|
|
|
attribute :description, :aliases => :Description
|
2011-09-26 11:20:17 -04:00
|
|
|
attribute :deployed, :type => :boolean
|
2011-10-05 05:58:50 -04:00
|
|
|
|
2011-09-26 11:20:17 -04:00
|
|
|
attribute :children, :aliases => :Children, :squash => :Vm
|
|
|
|
attribute :lease_settings, :aliases => :LeaseSettingsSection
|
2011-10-05 05:58:50 -04:00
|
|
|
|
2012-01-30 09:24:14 -05:00
|
|
|
attribute :network_configs, :aliases => :NetworkConfigSection
|
|
|
|
|
|
|
|
has_up :vdc
|
2011-09-26 11:20:17 -04:00
|
|
|
|
|
|
|
def servers
|
|
|
|
@servers ||= Fog::Vcloud::Compute::Servers.
|
2012-12-22 18:22:50 -05:00
|
|
|
new( :service => service,
|
2011-09-26 11:20:17 -04:00
|
|
|
:href => href,
|
|
|
|
:vapp => self
|
|
|
|
)
|
|
|
|
end
|
2011-10-05 05:58:50 -04:00
|
|
|
|
|
|
|
def networks
|
|
|
|
@networks ||= Fog::Vcloud::Compute::Networks.
|
2012-12-22 18:22:50 -05:00
|
|
|
new( :service => service,
|
2011-10-05 05:58:50 -04:00
|
|
|
:href => href
|
|
|
|
)
|
|
|
|
end
|
2013-02-02 01:40:10 -05:00
|
|
|
|
|
|
|
def ready?
|
|
|
|
reload_status # always ensure we have the correct status
|
|
|
|
status != '0'
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def reload_status
|
|
|
|
vapp = service.get_vapp(href)
|
|
|
|
self.status = vapp.status
|
|
|
|
end
|
2011-09-26 11:20:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|