2013-07-17 03:18:27 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class RackspaceV2
|
|
|
|
class Keypair < Fog::Model
|
|
|
|
attribute :public_key
|
|
|
|
attribute :private_key
|
|
|
|
attribute :user_id
|
|
|
|
identity :name
|
|
|
|
attribute :fingerprint
|
|
|
|
|
|
|
|
def save
|
|
|
|
requires :name
|
|
|
|
data = service.create_keypair(name, public_key)
|
|
|
|
merge_attributes(data.body['keypair'])
|
|
|
|
data.body['keypair']['name'] == name
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2013-07-26 09:00:45 -04:00
|
|
|
requires :identity
|
|
|
|
service.delete_keypair(identity)
|
2013-07-25 16:58:05 -04:00
|
|
|
true
|
2013-07-17 03:18:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|