Method: Fog::Compute::IBM::Mock#create_key
- Defined in:
- lib/fog/ibm/requests/compute/create_key.rb
#create_key(name, public_key = nil) ⇒ Object
SmartCloud returns the private key when create_key is called We need to store both the private and public key for later use
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fog/ibm/requests/compute/create_key.rb', line 37 def create_key(name, public_key=nil) response = Excon::Response.new response.status = 200 attributes = { "keyName" => name, "lastModifiedTime" => Fog::IBM::Mock.launch_time, "default" => false, "instanceIds" => [], } if public_key.nil? private_key = Fog::IBM::Mock.key_material public_key = private_key.public_key response.body = attributes.merge("keyMaterial" => private_key.to_s) else response.body = { 'success' => true } end self.data[:keys][name] = attributes.merge("keyMaterial" => public_key.to_s) self.data[:private_keys][name] = attributes.merge("keyMaterial" => private_key.to_s) response end |