Class: Fog::SharedFileSystem::OpenStack::Share

Inherits:
OpenStack::Model show all
Defined in:
lib/fog/shared_file_system/openstack/models/share.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::Model

#create, #initialize

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#destroyObject



51
52
53
54
55
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 51

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

#ready?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 57

def ready?
  status == 'available'
end

#saveObject

Raises:

  • (Fog::Errors::Error)


38
39
40
41
42
43
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 38

def save
  raise Fog::Errors::Error, 'Resaving an existing object may create a duplicate' if persisted?
  requires :size, :share_proto
  merge_attributes(service.create_share(share_proto, size, attributes).body['share'])
  true
end

#update(options = nil) ⇒ Object



45
46
47
48
49
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 45

def update(options = nil)
  requires :id
  merge_attributes(service.update_share(id, options || attributes).body['share'])
  self
end