Sha256: edd44c38f64c5b5e10e902bcd742f0ed3b134f9012a057d9b0d2c355912984af

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.1 lib/fog/oraclecloud/requests/compute/create_instance.rb