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

#access_rulesObject



85
86
87
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 85

def access_rules
  service.share_access_rules(:share => self)
end

#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

#export_locationsObject



89
90
91
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 89

def export_locations
  service.share_export_locations(:share => self)
end

#extend(size) ⇒ Object



61
62
63
64
65
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 61

def extend(size)
  requires :id
  service.extend_share(id, size)
  true
end

#grant_access(access_to, access_type, access_level) ⇒ Object



73
74
75
76
77
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 73

def grant_access(access_to, access_type, access_level)
  requires :id
  service.grant_share_access(id, access_to, access_type, access_level)
  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

#revoke_access(access_id) ⇒ Object



79
80
81
82
83
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 79

def revoke_access(access_id)
  requires :id
  service.revoke_share_access(id, access_id)
  true
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

#shrink(size) ⇒ Object



67
68
69
70
71
# File 'lib/fog/shared_file_system/openstack/models/share.rb', line 67

def shrink(size)
  requires :id
  service.shrink_share(id, size)
  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