Class: Fog::Compute::VcloudDirector::Collection

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/vcloud_director/compute.rb

Instance Method Summary collapse

Instance Method Details

#all(lazy_load = true) ⇒ Object



314
315
316
# File 'lib/fog/vcloud_director/compute.rb', line 314

def all(lazy_load=true)
  lazy_load ? index : get_everyone
end

#get(item_id) ⇒ Object



318
319
320
321
322
# File 'lib/fog/vcloud_director/compute.rb', line 318

def get(item_id)
  item = get_by_id(item_id)
  return nil unless item
  new(item)
end

#get_by_name(item_name) ⇒ Object



324
325
326
327
328
# File 'lib/fog/vcloud_director/compute.rb', line 324

def get_by_name(item_name)
  item_found = item_list.find {|item| item[:name] == item_name}
  return nil unless item_found
  get(item_found[:id])
end

#get_everyoneObject



334
335
336
337
# File 'lib/fog/vcloud_director/compute.rb', line 334

def get_everyone
  items = item_list.map {|item| get_by_id(item[:id])}
  load(items)
end

#indexObject



330
331
332
# File 'lib/fog/vcloud_director/compute.rb', line 330

def index
  load(item_list)
end