Module: Fog::Volume

Defined in:
lib/fog/volume.rb,
lib/fog/openstack/volume.rb,
lib/fog/openstack/models/volume/volume.rb,
lib/fog/openstack/models/volume/volumes.rb,
lib/fog/openstack/requests/volume/set_tenant.rb,
lib/fog/openstack/requests/volume/list_volumes.rb,
lib/fog/openstack/requests/volume/create_volume.rb,
lib/fog/openstack/requests/volume/delete_volume.rb,
lib/fog/openstack/requests/volume/list_snapshots.rb,
lib/fog/openstack/requests/volume/delete_snapshot.rb,
lib/fog/openstack/requests/volume/get_volume_details.rb,
lib/fog/openstack/requests/volume/get_snapshot_details.rb,
lib/fog/openstack/requests/volume/create_volume_snapshot.rb

Defined Under Namespace

Classes: OpenStack

Class Method Summary collapse

Class Method Details

.[](provider) ⇒ Object



4
5
6
# File 'lib/fog/volume.rb', line 4

def self.[](provider)
  self.new(:provider => provider)
end

.new(attributes) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/volume.rb', line 8

def self.new(attributes)
  attributes = attributes.dup # Prevent delete from having side effects
  provider = attributes.delete(:provider).to_s.downcase.to_sym
  if self.providers.include?(provider)
    require "fog/#{provider}/volume"
    return Fog::Volume.const_get(Fog.providers[provider]).new(attributes)
  end

  raise ArgumentError.new("#{provider} has no identity service")
end

.providersObject



19
20
21
# File 'lib/fog/volume.rb', line 19

def self.providers
  Fog.services[:volume]
end