Sha256: af3c68cc34bb2eb28254e33af1b1461fa682c975d65043eba72163a3cd751626

Contents?: true

Size: 870 Bytes

Versions: 31

Compression:

Stored size: 870 Bytes

Contents

require 'fog/openstack/models/model'

module Fog
  module SharedFileSystem
    class OpenStack
      class ShareAccessRule < Fog::OpenStack::Model
        attr_accessor :share

        identity :id

        attribute :access_level
        attribute :access_type
        attribute :access_to
        attribute :state

        def save
          requires :share, :access_level, :access_type, :access_to
          raise Fog::Errors::Error, 'Resaving an existing object may create a duplicate' if persisted?
          merge_attributes(service.grant_share_access(@share.id, access_to, access_type, access_level).body['access'])
          true
        end

        def destroy
          requires :id, :share
          service.revoke_share_access(@share.id, id)
          true
        end

        def ready?
          state == 'active'
        end
      end
    end
  end
end

Version data entries

31 entries across 29 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.10 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.1.30 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.1.29 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.9 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.1.28 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.8 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.7 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.6 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.5 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.4 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.3 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.2 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.3.0 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.2.4 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.2.3 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.2.2 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.2.1 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-openstack-0.2.0 lib/fog/shared_file_system/openstack/models/share_access_rule.rb
fog-zj-0.1.28 lib/fog/shared_file_system/openstack/models/share_access_rule.rb