class VCloudSdk::Xml::Vdc
Public Instance Methods
add_disk_link()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 4 def add_disk_link get_nodes(XML_TYPE[:LINK], type: MEDIA_TYPE[:DISK_CREATE_PARAMS]) .first end
available_cpu_cores()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 76 def available_cpu_cores cpu_resource = get_nodes("ComputeCapacity") .first.get_nodes("Cpu").first available_cpu_clock_speed = get_available_resource(cpu_resource) # clock units can only be MHz or GHz units = cpu_resource.get_nodes("Units").first.content if units == "MHz" available_cpu_clock_speed = available_cpu_clock_speed / 1000 end # We assume 1 GHz is converted to 1 vCpu core available_cpu_clock_speed end
available_memory_mb()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 91 def available_memory_mb memory_resource = get_nodes("ComputeCapacity") .first.get_nodes("Memory").first available_memory = get_available_resource(memory_resource) # clock units can only be MB or GB units = memory_resource.get_nodes("Units").first.content available_memory = available_memory * 1024 if units == "GB" available_memory end
available_network(name)
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 60 def available_network(name) get_nodes("Network", type: MEDIA_TYPE[:NETWORK], name: name) .first end
available_networks()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 55 def available_networks get_nodes("Network", type: MEDIA_TYPE[:NETWORK]) end
disks(name = nil)
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 10 def disks(name = nil) if name.nil? get_nodes("ResourceEntity", type: MEDIA_TYPE[:DISK]) else get_nodes("ResourceEntity", type: MEDIA_TYPE[:DISK], name: name) .first end end
edge_gateways_link()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 43 def edge_gateways_link get_nodes(XML_TYPE[:LINK], rel: "edgeGateways") .first end
get_vapp_templates(name)
click to toggle source
vApp Template names are not unique so multiple ones can be returned.
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 50 def get_vapp_templates(name) get_nodes("ResourceEntity", type: MEDIA_TYPE[:VAPP_TEMPLATE], name: name) end
instantiate_vapp_template_link()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 21 def instantiate_vapp_template_link get_nodes(XML_TYPE[:LINK], type: MEDIA_TYPE[:INSTANTIATE_VAPP_TEMPLATE_PARAMS]) .first end
storage_profile(name)
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 70 def storage_profile(name) get_nodes(:VdcStorageProfile, type: MEDIA_TYPE[:VDC_STORAGE_PROFILE], name: name) .first end
storage_profiles()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 66 def storage_profiles get_nodes(:VdcStorageProfile, type: MEDIA_TYPE[:VDC_STORAGE_PROFILE]) end
upload_link()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 27 def upload_link get_nodes(XML_TYPE[:LINK], type: MEDIA_TYPE[:UPLOAD_VAPP_TEMPLATE_PARAMS]) .first end
upload_media_link()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 33 def upload_media_link get_nodes(XML_TYPE[:LINK], type: MEDIA_TYPE[:MEDIA]) .first end
vapps()
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 39 def vapps get_nodes(:ResourceEntity, type: MEDIA_TYPE[:VAPP]) end
Private Instance Methods
get_available_resource(resource_node)
click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb, line 104 def get_available_resource(resource_node) limited_resource = resource_node.get_nodes("Limit").first.content.to_i return -1 if limited_resource == 0 limited_resource - resource_node.get_nodes("Used").first.content.to_i end