Class: Delphix::Environment
- Inherits:
-
Object
- Object
- Delphix::Environment
- Includes:
- Base
- Defined in:
- lib/delphix/environment.rb
Instance Attribute Summary
Attributes included from Base
Class Method Summary collapse
-
.create(name, address, port, toolkit_path, username, password) ⇒ Object
class methods.
- .list ⇒ Object
Instance Method Summary collapse
- #base_endpoint ⇒ Object
- #delete ⇒ Object
- #disable ⇒ Object
-
#enable ⇒ Object
basic operations.
-
#initialize(reference, details = nil) ⇒ Environment
constructor
A new instance of Environment.
-
#refresh_details ⇒ Object
inherited operations.
Methods included from Base
#delphix_delete, #delphix_get, #delphix_post, #name, #reference, #to_s, #type
Constructor Details
#initialize(reference, details = nil) ⇒ Environment
Returns a new instance of Environment.
8 9 10 |
# File 'lib/delphix/environment.rb', line 8 def initialize(reference, details=nil) super(reference, details) end |
Class Method Details
.create(name, address, port, toolkit_path, username, password) ⇒ Object
class methods
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 69 70 71 72 73 74 75 |
# File 'lib/delphix/environment.rb', line 38 def self.create(name, address, port, toolkit_path, username, password) body = { :type => 'HostEnvironmentCreateParameters', :primaryUser => { :type => 'EnvironmentUser', :name => username, :credential => { :type => 'PasswordCredential', :password => password } }, :hostEnvironment => { :type => 'UnixHostEnvironment', :name => name }, :hostParameters => { :type => 'UnixHostCreateParameters', :host => { :type => 'UnixHost', :address => address, :sshPort => port, :toolkitPath => toolkit_path } } } response = Delphix.post('/resources/json/delphix/environment', body.to_json) ref = response['result'] job = response['job'] # create a new skeleton group object env = Delphix::Environment.new ref # refresh the object from the DE env.refresh_details env end |
Instance Method Details
#base_endpoint ⇒ Object
32 33 34 |
# File 'lib/delphix/environment.rb', line 32 def base_endpoint '/resources/json/delphix/environment' end |
#delete ⇒ Object
22 23 24 |
# File 'lib/delphix/environment.rb', line 22 def delete delphix_delete("#{base_endpoint}/#{reference}", nil)['result'] end |
#disable ⇒ Object
18 19 20 |
# File 'lib/delphix/environment.rb', line 18 def disable delphix_post("#{base_endpoint}/#{reference}/disable", nil)['result'] end |
#enable ⇒ Object
basic operations
14 15 16 |
# File 'lib/delphix/environment.rb', line 14 def enable delphix_post("#{base_endpoint}/#{reference}/enable", nil)['result'] end |
#refresh_details ⇒ Object
inherited operations
28 29 30 |
# File 'lib/delphix/environment.rb', line 28 def refresh_details @details = delphix_get("#{base_endpoint}/#{reference}", nil)['result'] end |