Class: Delphix::Database
- Inherits:
-
Object
- Object
- Delphix::Database
- Includes:
- Base
- Defined in:
- lib/delphix/database.rb
Instance Attribute Summary
Attributes included from Base
Class Method Summary collapse
- .create_vdb(name, source_ref, group_ref, environment_ref, mount_base, port, params = {}) ⇒ Object
-
.list ⇒ Object
class methods.
Instance Method Summary collapse
- #base_endpoint ⇒ Object
-
#delete ⇒ Object
basic operations.
-
#initialize(reference, details = nil) ⇒ Database
constructor
A new instance of Database.
-
#refresh_details ⇒ Object
inherited operations.
Methods included from Base
#name, #reference, #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
38 39 40 41 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 |
# File 'lib/delphix/database.rb', line 38 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' } } response = Delphix.post('/resources/json/delphix/database/provision', body.to_json) response end |
.list ⇒ Object
class methods
29 30 31 32 33 34 35 36 |
# File 'lib/delphix/database.rb', line 29 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_endpoint ⇒ Object
23 24 25 |
# File 'lib/delphix/database.rb', line 23 def base_endpoint '/resources/json/delphix/database' end |
#delete ⇒ Object
basic operations
11 12 13 |
# File 'lib/delphix/database.rb', line 11 def delete Delphix.delete("#{base_endpoint}/#{reference}")['result'] end |
#refresh_details ⇒ Object
inherited operations
19 20 21 |
# File 'lib/delphix/database.rb', line 19 def refresh_details @details = Delphix.get("#{base_endpoint}/#{reference}")['result'] end |