Sha256: 3e25f0011d60d1d89aa9dffce37610db7ab28727f55020bb080b8d4f2e68ceb9

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

module Fog
  module Compute
    class Ecloud
      class SshKey < Fog::Ecloud::Model
        identity :href

        attribute :name, :aliases => :Name
        attribute :type, :aliases => :Type
        attribute :other_links, :aliases => :Links
        attribute :default, :aliases => :Default, :type => :boolean
        attribute :finger_print, :aliases => :FingerPrint
        attribute :private_key, :aliases => :PrivateKey

        def delete
          service.ssh_key_delete(href).body
        end
        alias_method :destroy, :delete

        def edit(options = {})
          # Make sure we only pass what we should
          new_options = {}
          new_options[:uri] = href
          if options[:Name].nil?
            new_options[:Name] = name
          else
            new_options[:Name] = options[:Name]
          end
          if options[:Default].nil?
            new_options[:Default] = default
          else
            new_options[:Default] = options[:Default]
          end

          service.ssh_key_edit(new_options)
        end

        def id
          href.scan(/\d+/)[0]
        end
      end
    end
  end
end

Version data entries

5 entries across 3 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/ssh_key.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/ssh_key.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/ssh_key.rb
fog-ecloud-0.3.0 lib/fog/compute/ecloud/models/ssh_key.rb
fog-ecloud-0.2.0 lib/fog/compute/ecloud/models/ssh_key.rb