Sha256: abb568f277945c96a70b27ad6d8463d5a011c327ea4ad1c11fd7467f0237f84f
Contents?: true
Size: 1.49 KB
Versions: 31
Compression:
Stored size: 1.49 KB
Contents
module Fog module AWS module EC2 class Real # Create a new key pair # # ==== Parameters # * key_name<~String> - Unique name for key pair. # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'keyFingerprint'<~String> - SHA-1 digest of DER encoded private key # * 'keyMaterial'<~String> - Unencrypted encoded PEM private key # * 'keyName'<~String> - Name of key # * 'requestId'<~String> - Id of request def create_key_pair(key_name) request( 'Action' => 'CreateKeyPair', 'KeyName' => key_name, :parser => Fog::Parsers::AWS::EC2::CreateKeyPair.new ) end end class Mock def create_key_pair(key_name) response = Excon::Response.new unless @data[:key_pairs][key_name] response.status = 200 data = { 'keyFingerprint' => Fog::AWS::Mock.key_fingerprint, 'keyMaterial' => Fog::AWS::Mock.key_material, 'keyName' => key_name } @data[:key_pairs][key_name] = data response.body = { 'requestId' => Fog::AWS::Mock.request_id }.merge!(data) else response.status = 400 raise(Excon::Errors.status_error({:expects => 200}, response)) end response end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems