Class: Fog::Volume::OpenStack::Volume

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/openstack/models/volume/volume.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Volume

Returns a new instance of Volume.



21
22
23
24
25
# File 'lib/fog/openstack/models/volume/volume.rb', line 21

def initialize(attributes)
  # Old 'connection' is renamed as service and should be used instead
  prepare_service_value(attributes)
  super
end

Instance Method Details

#destroyObject



34
35
36
37
38
# File 'lib/fog/openstack/models/volume/volume.rb', line 34

def destroy
  requires :id
  service.delete_volume(id)
  true
end

#ready?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/fog/openstack/models/volume/volume.rb', line 40

def ready?
  status == 'available'
end

#saveObject



27
28
29
30
31
32
# File 'lib/fog/openstack/models/volume/volume.rb', line 27

def save
  requires :display_name, :size
  data = service.create_volume(display_name, display_description, size, attributes)
  merge_attributes(data.body['volume'])
  true
end