Sha256: 2994533d569b436d39aef384507f1d33d3766ef257009d9e2edffa0137903a70

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

module Fog
  module OracleCloud
    class Database
      class Real

      	def create_instance(service_name, edition, vmPublicKey, parameters, options={})
          body_data     = {
            'serviceName'             => service_name,
            'version'                 => options[:version],
            'level'										=> options[:level],
            'edition'                 => edition,
            'subscriptionType'				=> options[:subscriptionType],
            'description'							=> options[:description],
            'shape'                   => options[:shape],
            'vmPublicKeyText'         => vmPublicKey,
            'parameters'              => parameters
          }
          body_data = body_data.reject {|key, value| value.nil?}
        
          request(
            :method   => 'POST',
            :expects  => 202,
            :path     => "/paas/service/dbcs/api/v1.1/instances/#{@identity_domain}",
            :body     => Fog::JSON.encode(body_data),
            #:headers  => {
            #	'Content-Type'=>'application/vnd.com.oracle.oracloud.provisioning.Service+json'
            #}
          )
        end

      end

      class Mock
        def create_instance(service_name, edition, vmPublicKey, parameters, options={})
      		response = Excon::Response.new

      		instance = Fog::OracleCloud::Mock.create_database_instance(service_name)
          self.data[:instances][service_name] = instance

      		response.status = 202
          response
      	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/database/create_instance.rb