Sha256: d927cc78b4adb47941e900c0c0277b23970ea4a727391e46ba4a5c6bd814b7b5
Contents?: true
Size: 1.74 KB
Versions: 3
Compression:
Stored size: 1.74 KB
Contents
module Fog module Compute class OracleCloud class Real def create_instance (name, shape, imagelist, label, sshkeys) # This will create an instance using a Launchplan. Consider using an orchestration plan for more control # Just in case it's already set name.sub! "/Compute-#{@identity_domain}/#{@username}/", '' body_data = { 'instances' => [{ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}", 'shape' => shape, 'imagelist' => imagelist, 'label' => label, 'sshkeys' => sshkeys }] } body_data = body_data.reject {|key, value| value.nil?} request( :method => 'POST', :expects => 201, :path => "/launchplan/", :body => Fog::JSON.encode(body_data), :headers => { 'Content-Type' => 'application/oracle-compute-v3+json' } ) end end class Mock def create_instance (name, shape, imagelist, label, sshkeys) response = Excon::Response.new name.sub! "/Compute-#{@identity_domain}/#{@username}/", '' self.data[:instances][name] = { 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}", 'shape' => shape, 'imagelist' => imagelist, 'label' => label, 'sshkeys' => sshkeys, 'state' => 'running' } response.status = 201 response.body = { 'instances' => [self.data[:instances][name]] } response end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems