Sha256: 4e639368591f5036dc2323ff482d936ea69704a15509fc86f252f5e02b7a6e12

Contents?: true

Size: 684 Bytes

Versions: 23

Compression:

Stored size: 684 Bytes

Contents

module Fog
  module Brightbox
    class Compute
      module ResourceLocking
        def locked?
          if attributes.key?("locked") || attributes.key?(:locked)
            attributes["locked"] || attributes[:locked] || false
          else
            false
          end
        end

        def lock!
          locking_request(:lock)
        end

        def unlock!
          locking_request(:unlock)
        end

        private

        def locking_request(lock_setting)
          requires :identity

          data = service.send(:"#{lock_setting}_resource_#{resource_name}", identity)
          merge_attributes(data)
          true
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fog-brightbox-1.12.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.11.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.10.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.9.1 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.9.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.8.2 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.8.1 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.8.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.7.3 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.7.2 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.7.1 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.7.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.6.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.5.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.5.0.rc1 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.4.2 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.4.1 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.4.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.3.0 lib/fog/brightbox/compute/resource_locking.rb
fog-brightbox-1.2.0 lib/fog/brightbox/compute/resource_locking.rb