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



302
303
304
# File 'lib/fog/vcloud_director/compute.rb', line 302

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

#get(item_id) ⇒ Object



306
307
308
309
310
# File 'lib/fog/vcloud_director/compute.rb', line 306

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

#get_by_name(item_name) ⇒ Object



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

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



322
323
324
325
# File 'lib/fog/vcloud_director/compute.rb', line 322

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

#indexObject



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

def index
  load(item_list)
end