# File lib/fog/rackspace/requests/compute_v2/create_keypair.rb, line 44 def create_keypair(key_name, attributes = nil) # 409 response when already existing raise Fog::Compute::RackspaceV2::ServiceError if not self.data[:keypairs].select { |k| key_name.include? k['keypair']['name'] }.first.nil? if attributes.is_a?(String) Fog::Logger.deprecation "Passing the public key as the 2nd arg is deprecated, please pass a hash of attributes." end k = self.data[:keypair] k['name'] = key_name self.data[:keypairs] << { 'keypair' => k } response( :status => 200, :body => { 'keypair' => k } ) end