class Delphix::Database

Public Class Methods

create_vdb(name, source_ref, group_ref, environment_ref, mount_base, port, params={}) click to toggle source
# File lib/delphix/database.rb, line 42
def self.create_vdb(name, source_ref, group_ref, environment_ref, mount_base, port, params={})

  body = {
    :type => 'MySQLProvisionParameters',
    :container => {
      :type => 'MySQLDatabaseContainer',
      :name => name,
      :group => group_ref,
      :sourcingPolicy => {
        :type => 'SourcingPolicy'
      }
    },
    :source => {
      :type => 'MySQLVirtualSource',
      :mountBase => mount_base
    },
    :sourceConfig => {
      :type => 'MySQLServerConfig',
      :port => port,
      :repository => environment_ref
    },
    :timeflowPointParameters => {
      :type => 'TimeflowPointSemantic',
      :container => source_ref,
      :location => 'LATEST_SNAPSHOT'
    }
  }

  Delphix::Response.new( Delphix.post('/resources/json/delphix/database/provision', body.to_json))

end
list() click to toggle source

class methods

# File lib/delphix/database.rb, line 33
def self.list
  databases = Delphix::BaseArray.new
  result = Delphix.get('/resources/json/delphix/database')['result']
  result.each do |db|
    databases << Delphix::Database.new(db['reference'],db)
  end
  databases
end
new(reference, details=nil) click to toggle source
Calls superclass method Delphix::Base::new
# File lib/delphix/database.rb, line 5
def initialize(reference, details=nil)
  super(reference, details)
end

Public Instance Methods

base_endpoint() click to toggle source

inherited operations

# File lib/delphix/database.rb, line 27
def base_endpoint
  '/resources/json/delphix/database'
end
delete() click to toggle source

basic operations

# File lib/delphix/database.rb, line 11
def delete
  Delphix::Response.new( Delphix.delete("#{base_endpoint}/#{reference}"))
end
start() click to toggle source

specific operations

# File lib/delphix/database.rb, line 17
def start
  Delphix::Response.new( Delphix.post("/resources/json/delphix/source/#{lookup_source_ref}/start"))
end
stop() click to toggle source
# File lib/delphix/database.rb, line 21
def stop
  Delphix::Response.new( Delphix.post("/resources/json/delphix/source/#{lookup_source_ref}/stop"))
end

Private Instance Methods

lookup_source_ref() click to toggle source
# File lib/delphix/database.rb, line 76
def lookup_source_ref
  sources = Delphix::Source.list
  source = sources.filter_by 'container', reference
  source[0].reference # FIXME assumes there is only one ...
end