Class: VCloudSdk::VdcStorageProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_vcloud_sdk/vdc_storage_profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(storage_profile_xml_obj) ⇒ VdcStorageProfile

Returns a new instance of VdcStorageProfile.



6
7
8
9
10
11
12
# File 'lib/ruby_vcloud_sdk/vdc_storage_profile.rb', line 6

def initialize(storage_profile_xml_obj)
  @storage_profile_xml_obj = storage_profile_xml_obj
  @name = @storage_profile_xml_obj[:name]
  @storage_used_mb = @storage_profile_xml_obj[:storageUsedMB].to_i
  @storage_limit_mb = @storage_profile_xml_obj[:storageLimitMB].to_i
  @vdc_name = @storage_profile_xml_obj[:vdcName]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/ruby_vcloud_sdk/vdc_storage_profile.rb', line 4

def name
  @name
end

Instance Method Details

#available_storageObject

Return storageLimitMB - storageUsedMB Return -1 if ‘storageLimitMB’ is 0



16
17
18
19
20
# File 'lib/ruby_vcloud_sdk/vdc_storage_profile.rb', line 16

def available_storage
  return -1 if @storage_limit_mb == 0

  @storage_limit_mb - @storage_used_mb
end