class Vcloud::Core::Vdc

Attributes

id[R]

Public Class Methods

get_by_name(name) click to toggle source

Get the ID of a named vDC

@param name [String] The name of the vDC @return [String] The ID of the vDC

# File lib/vcloud/core/vdc.rb, line 22
def self.get_by_name(name)
  q = Vcloud::Core::QueryRunner.new
  query_results = q.run('orgVdc', :filter => "name==#{name}")
  raise "Error finding vDC by name #{name}" unless query_results
  raise "vDc #{name} not found" unless query_results.size == 1
  return self.new(query_results.first[:href].split('/').last)
end
new(id) click to toggle source

Initialize a Vcloud::Core::Vdc

@param id [String] the vDC ID @return [Vcloud::Core::Vdc]

# File lib/vcloud/core/vdc.rb, line 11
def initialize(id)
  unless id =~ /^[-0-9a-f]+$/
    raise "vdc id : #{id} is not in correct format"
  end
  @id = id
end

Public Instance Methods

href() click to toggle source

Return the href of vDC

@return [String] the href of instance

# File lib/vcloud/core/vdc.rb, line 47
def href
  vcloud_attributes[:href]
end
name() click to toggle source

Return the name of vDC

@return [String] the name of instance

# File lib/vcloud/core/vdc.rb, line 40
def name
  vcloud_attributes[:name]
end
vcloud_attributes() click to toggle source

Return the vCloud data associated with vDC

@return [Hash] the complete vCloud data for vDC

# File lib/vcloud/core/vdc.rb, line 33
def vcloud_attributes
  Vcloud::Core::Fog::ServiceInterface.new.get_vdc(id)
end