1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/aws/models/ec2/key_pair.rb
2009-08-19 09:11:26 -07:00

35 lines
787 B
Ruby

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