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
basic operations.
- #disable ⇒ Object
-
#enable ⇒ Object
specific operations.
-
#initialize(reference, details = nil) ⇒ Environment
constructor
A new instance of Environment.
-
#refresh_details ⇒ Object
inherited operations.
Methods included from Base
#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
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 76 77 |
# File 'lib/delphix/environment.rb', line 40 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 |
.list ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/delphix/environment.rb', line 79 def self.list envs = Delphix::BaseArray.new result = Delphix.get('/resources/json/delphix/environment')['result'] result.each do |env| envs << Delphix::Environment.new(env['reference'],env) end envs end |
Instance Method Details
#base_endpoint ⇒ Object
34 35 36 |
# File 'lib/delphix/environment.rb', line 34 def base_endpoint '/resources/json/delphix/environment' end |
#delete ⇒ Object
basic operations
14 15 16 |
# File 'lib/delphix/environment.rb', line 14 def delete Delphix.delete("#{base_endpoint}/#{reference}")['result'] end |
#disable ⇒ Object
24 25 26 |
# File 'lib/delphix/environment.rb', line 24 def disable Delphix.post("#{base_endpoint}/#{reference}/disable")['result'] end |
#enable ⇒ Object
specific operations
20 21 22 |
# File 'lib/delphix/environment.rb', line 20 def enable Delphix.post("#{base_endpoint}/#{reference}/enable")['result'] end |
#refresh_details ⇒ Object
inherited operations
30 31 32 |
# File 'lib/delphix/environment.rb', line 30 def refresh_details @details = Delphix.get("#{base_endpoint}/#{reference}")['result'] end |