Sha256: 1a13762eecb14c58f49210d67350d22eed069dc7ca42fcf6252491921e5c02d7

Contents?: true

Size: 876 Bytes

Versions: 4

Compression:

Stored size: 876 Bytes

Contents

require 'fog/huaweicloud/models/model'

module Fog
  module SharedFileSystem
    class HuaweiCloud
      class ShareAccessRule < Fog::HuaweiCloud::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

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/shared_file_system/huaweicloud/models/share_access_rule.rb
fog-huaweicloud-0.0.2 lib/fog/shared_file_system/huaweicloud/models/share_access_rule.rb
fog-huaweicloud-0.1.3 lib/fog/shared_file_system/huaweicloud/models/share_access_rule.rb
fog-huaweicloud-0.1.2 lib/fog/shared_file_system/huaweicloud/models/share_access_rule.rb