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-12 22:48:17 -07:00

34 lines
761 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)
true
end
def save
data = connection.create_key_pair(@name)
new_attributes = data['Body'].reject {|key,value| !['keyFingerprint', 'keyMaterial', 'keyName'].include?(key)}
update_attributes(new_attributes)
true
end
end
end
end
end