Class: Fog::Compute::VcloudDirector::Collection
- Inherits:
-
Fog::Collection
- Object
- Array
- Fog::Collection
- Fog::Compute::VcloudDirector::Collection
- Defined in:
- lib/fog/vcloud_director/compute.rb
Direct Known Subclasses
CatalogItems, Catalogs, Disks, Medias, Networks, Organizations, Tags, Tasks, Vapps, Vdcs, VmCustomizations, VmNetworks, Vms
Instance Attribute Summary
Attributes inherited from Fog::Collection
Instance Method Summary collapse
- #all(lazy_load = true) ⇒ Object
- #get(item_id) ⇒ Object
- #get_by_name(item_name) ⇒ Object
- #get_everyone ⇒ Object
- #index ⇒ Object
Methods inherited from Fog::Collection
#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Collection
Instance Method Details
#all(lazy_load = true) ⇒ Object
293 294 295 |
# File 'lib/fog/vcloud_director/compute.rb', line 293 def all(lazy_load=true) lazy_load ? index : get_everyone end |
#get(item_id) ⇒ Object
297 298 299 300 301 |
# File 'lib/fog/vcloud_director/compute.rb', line 297 def get(item_id) item = get_by_id(item_id) return nil unless item new(item) end |
#get_by_name(item_name) ⇒ Object
303 304 305 306 307 |
# File 'lib/fog/vcloud_director/compute.rb', line 303 def get_by_name(item_name) item_found = item_list.detect {|item| item[:name] == item_name} return nil unless item_found get(item_found[:id]) end |
#get_everyone ⇒ Object
313 314 315 316 |
# File 'lib/fog/vcloud_director/compute.rb', line 313 def get_everyone items = item_list.map {|item| get_by_id(item[:id])} load(items) end |
#index ⇒ Object
309 310 311 |
# File 'lib/fog/vcloud_director/compute.rb', line 309 def index load(item_list) end |