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

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

Instance Attribute Summary

Attributes inherited from Ecloud::Model

#loaded

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Ecloud::Model

#load_unless_loaded!, #reload

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#cpu_usageObject



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

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



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

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

#edit(options) ⇒ Object



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

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

#environmentObject



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

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



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

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

#layoutObject



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

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

#memory_usageObject



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

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



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

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

#serversObject



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

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

#storage_usageObject



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

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

#templatesObject



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

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