Class: Fog::Compute::Vsphere::Volumes
- Inherits:
-
Fog::Collection
- Object
- Array
- Fog::Collection
- Fog::Compute::Vsphere::Volumes
- Defined in:
- lib/fog/vsphere/models/compute/volumes.rb
Instance Attribute Summary
Attributes inherited from Fog::Collection
Instance Method Summary collapse
Methods inherited from Fog::Collection
#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #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(filters = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/vsphere/models/compute/volumes.rb', line 14 def all(filters = {}) requires :server case server when Fog::Compute::Vsphere::Server load service.list_vm_volumes(server.id) when Fog::Compute::Vsphere::Template load service.list_template_volumes(server.id) else raise 'volumes should have vm or template' end self.each { |volume| volume.server_id = server.id } self end |
#get(id) ⇒ Object
30 31 32 |
# File 'lib/fog/vsphere/models/compute/volumes.rb', line 30 def get(id) new service.get_volume(id) end |
#new(attributes = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/vsphere/models/compute/volumes.rb', line 34 def new(attributes = {}) if server # Default to the root volume datastore if one is not configured. datastore = ! attributes.has_key?(:datastore) && self.any? ? self.first.datastore : nil super({ :server_id => server.id, :datastore => datastore }.merge!(attributes)) else super end end |