Sha256: 6495e79ea8c3944d5bd8021578513a07c05f446a39353d1362746c7cb8886525

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

module Fog
  module AWS
    class EC2

      class KeyPair < Fog::Model

        attr_accessor :fingerprint,
          :material,
          :name

        def initialize(attributes = {})
          remap_attributes(attributes, {
            'keyFingerprint'  => :fingerprint,
            'keyMaterial'     => :material,
            'keyName'         => :name
          })
          super
        end

        def delete
          connection.delete_key_pair(@name)
        end

        def save
          data = connection.create_key_pair(@name).body
          new_attributes = data.reject {|key,value| !['keyFingerprint', 'keyMaterial', 'keyName'].include?(key)}
          update_attributes(new_attributes)
          data
        end

      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geemus-fog-0.0.1 lib/fog/aws/models/ec2/key_pair.rb
geemus-fog-0.0.3 lib/fog/aws/models/ec2/key_pair.rb