Sha256: 1fa83d3c602e481ba2e1cca9ec2525e101d5bd4841f81102539d4f4309c8bd8b

Contents?: true

Size: 1.92 KB

Versions: 1

Compression:

Stored size: 1.92 KB

Contents

module Fog
  module OracleCloud
    class Database
      class Real

      	def create_instance(service_name, edition, vmPublicKey, shape, version, 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'              => {
              'shape'                   => shape,
              'version'                 => version
            }
          }
          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, shape, version, options={})
      		response = Excon::Response.new

          data = {
            'service_name' => service_name,
            'shape' => shape,
            'edition' => edition,
            'version' => version,
            'status' => 'In Progress'
          }.merge(options.select {|key, value| ["description"].include?(key) })

          self.data[:instances][service_name] = data
          self.data[:created_at][service_name] = Time.now
          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.2 lib/fog/oraclecloud/requests/database/create_instance.rb