Sha256: b5acc711bb4686264053f0d688f6e10723d8c9028d4c94900b0e32eab469007e
Contents?: true
Size: 1.42 KB
Versions: 11
Compression:
Stored size: 1.42 KB
Contents
module Fog module Compute class OracleCloud class Real def create_ssh_key (name, enabled, key) # Just in case it's already set name.sub! "/Compute-#{@identity_domain}/#{@username}/", '' body_data = { 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}", 'enabled' => enabled, 'key' => key } body_data = body_data.reject {|key, value| value.nil?} request( :method => 'POST', :expects => 201, :path => "/sshkey/", :body => Fog::JSON.encode(body_data), :headers => { 'Content-Type' => 'application/oracle-compute-v3+json' } ) end end class Mock def create_ssh_key (name, enabled, key) response = Excon::Response.new name.sub! "/Compute-#{@identity_domain}/#{@username}/", '' data = { 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}", 'enabled' => enabled, 'key' => key, 'uri' => "#{@api_endpoint}sshkey/#{name}" } self.data[:sshkeys][name] = data response.status = 201 response.body = self.data[:sshkeys][name] response end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems