Class: Fog::Compute::Ecloud::ComputePool

Inherits:
Ecloud::Model show all
Defined in:
lib/fog/compute/ecloud/models/compute_pool.rb

Instance Attribute Summary

Attributes inherited from Ecloud::Model

#loaded

Instance Method Summary collapse

Methods inherited from Ecloud::Model

#load_unless_loaded!

Instance Method Details

#cpu_usageObject



24
25
26
27
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 24

def cpu_usage
  # time ? query = "/details?time=#{Time.parse(time).utc.strftime("%Y-%m-%dT%H:%M:%SZ")}" : query = ""
  @cpu_usage ||= Fog::Compute::Ecloud::CpuUsageDetailSummary.new(:service => service, :href => "#{service.base_path}/computePools/#{id}/usage/cpu")
end

#detached_disksObject



46
47
48
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 46

def detached_disks
  @detached_disks ||= self.service.detached_disks(:href => "#{service.base_path}/detacheddisks/computepools/#{id}")
end

#edit(options) ⇒ Object



58
59
60
61
62
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 58

def edit(options)
  options[:uri] = href
  data = service.compute_pool_edit(options).body
  pool = collection.from_data(data)
end

#environmentObject



50
51
52
53
54
55
56
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 50

def environment
  @environment ||= begin
                     reload unless other_links
                     environment_link = other_links.find{|l| l[:type] == "application/vnd.tmrk.cloud.environment"}
                     self.service.environments.get(environment_link[:href])
                   end
end

#idObject



64
65
66
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 64

def id
  href.scan(/\d+/)[0]
end

#layoutObject



20
21
22
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 20

def layout
  @layout ||= Fog::Compute::Ecloud::Layouts.new(:service => service, :href => "#{service.base_path}/layout/computePools/#{id}").first
end

#memory_usageObject



29
30
31
32
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 29

def memory_usage
  # time ? query = "/details?time=#{Time.parse(time).utc.strftime("%Y-%m-%dT%H:%M:%SZ")}" : query = ""
  @memory_usage ||= Fog::Compute::Ecloud::MemoryUsageDetailSummary.new(:service => service, :href => "#{service.base_path}/computePools/#{id}/usage/memory")
end

#operating_system_familiesObject



38
39
40
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 38

def operating_system_families
  @operating_system_families ||= Fog::Compute::Ecloud::OperatingSystemFamilies.new(:service => service, :href => "#{service.base_path}/operatingSystemFamilies/computePools/#{id}")
end

#reloadObject



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 68

def reload
  @servers = nil
  @layout = nil
  @cpu_usage = nil
  @memory_usage = nil
  @storage_usage = nil
  @operating_system_families = nil
  @templates = nil
  @detached_disks = nil
  @environment = nil
  super
end

#serversObject



16
17
18
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 16

def servers
  @servers ||= Fog::Compute::Ecloud::Servers.new( :service => service, :href => "#{service.base_path}/virtualMachines/computePools/#{id}" )
end

#storage_usageObject



34
35
36
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 34

def storage_usage
  @storage_usage ||= Fog::Compute::Ecloud::StorageUsageDetailSummary.new(:service => service, :href => "#{service.base_path}/computePools/#{id}/usage/storage")
end

#templatesObject



42
43
44
# File 'lib/fog/compute/ecloud/models/compute_pool.rb', line 42

def templates
  @templates ||= self.service.templates(:href => "#{service.base_path}/templates/computePools/#{id}")
end