Sha256: ec6285307cedaff4999bc815e1e71bbbd6ac76f130cc171a1783f52dfdcbe84f

Contents?: true

Size: 835 Bytes

Versions: 108

Compression:

Stored size: 835 Bytes

Contents

require 'fog/core/model'

module Fog
  module Compute
    class IBM
      class Key < Fog::Model
        identity :name, :aliases => 'keyName'
        attribute :default
        attribute :public_key, :aliases => 'keyMaterial'
        attribute :instance_ids, :aliases => 'instanceIds'
        attribute :modified_at, :aliases => 'lastModifiedTime'

        def save
          requires :name
          data = service.create_key(name, public_key)
          merge_attributes(data.body)
          data.body['keyName'] == name
        end

        def destroy
          data = service.delete_key(identity)
          data.body['success']
        end

        def default?
          default
        end

        def instances
          instance_ids.map { Fog::Compute[:ibm].servers.get(instance_id) }
        end
      end
    end
  end
end

Version data entries

108 entries across 106 versions & 11 rubygems

Version Path
fog-2.3.0 lib/fog/ibm/models/compute/key.rb
fog-ifeel-2.2.0 lib/fog/ibm/models/compute/key.rb
fog-2.2.0 lib/fog/ibm/models/compute/key.rb
fog-2.1.0 lib/fog/ibm/models/compute/key.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/ibm/models/compute/key.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/ibm/models/compute/key.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/ibm/models/compute/key.rb
fog-1.42.1 lib/fog/ibm/models/compute/key.rb
fog-2.0.0 lib/fog/ibm/models/compute/key.rb
fog-1.42.0 lib/fog/ibm/models/compute/key.rb
fog-1.41.0 lib/fog/ibm/models/compute/key.rb
fog-1.40.0 lib/fog/ibm/models/compute/key.rb
fog-1.39.0 lib/fog/ibm/models/compute/key.rb
fog-1.38.0 lib/fog/ibm/models/compute/key.rb
fog-1.37.0 lib/fog/ibm/models/compute/key.rb
fog-1.36.0 lib/fog/ibm/models/compute/key.rb
fog-1.35.0 lib/fog/ibm/models/compute/key.rb
fog-2.0.0.pre.0 lib/fog/ibm/models/compute/key.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/ibm/models/compute/key.rb
fog-1.34.0 lib/fog/ibm/models/compute/key.rb