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

33 lines
642 B
Ruby
Raw Normal View History

2009-08-13 01:33:35 -04:00
module Fog
module AWS
class EC2
class KeyPair < Fog::Model
identity :name, 'keyName'
attribute :fingerprint, 'keyFingerprint'
attribute :material, 'keyMaterial'
2009-08-13 01:33:35 -04:00
2009-09-20 12:21:03 -04:00
def destroy
requires :name
2009-08-13 01:33:35 -04:00
connection.delete_key_pair(@name)
true
2009-08-13 01:33:35 -04:00
end
def save
requires :name
2009-08-14 12:19:40 -04:00
data = connection.create_key_pair(@name).body
new_attributes = data.reject {|key,value| !['keyFingerprint', 'keyMaterial', 'keyName'].include?(key)}
merge_attributes(new_attributes)
true
2009-08-13 01:33:35 -04:00
end
end
end
end
end