Class: Delphix::Database

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/delphix/database.rb

Instance Attribute Summary

Attributes included from Base

#details

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#name, #reference, #refresh_details, #to_s, #type

Constructor Details

#initialize(reference, details = nil) ⇒ Database

Returns a new instance of Database.



5
6
7
# File 'lib/delphix/database.rb', line 5

def initialize(reference, details=nil)
  super(reference, details)
end

Class Method Details

.create_vdb(name, source_ref, group_ref, environment_ref, mount_base, port, params = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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

.listObject

class methods



33
34
35
36
37
38
39
40
# 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

Instance Method Details

#base_endpointObject

inherited operations



27
28
29
# File 'lib/delphix/database.rb', line 27

def base_endpoint
  '/resources/json/delphix/database'
end

#deleteObject

basic operations



11
12
13
# File 'lib/delphix/database.rb', line 11

def delete
  Delphix::Response.new( Delphix.delete("#{base_endpoint}/#{reference}"))
end

#startObject

specific operations



17
18
19
# File 'lib/delphix/database.rb', line 17

def start
  Delphix::Response.new( Delphix.post("/resources/json/delphix/source/#{lookup_source_ref}/start"))
end

#stopObject



21
22
23
# File 'lib/delphix/database.rb', line 21

def stop
  Delphix::Response.new( Delphix.post("/resources/json/delphix/source/#{lookup_source_ref}/stop"))
end