Class: Shared::Instance Abstract
- Inherits:
-
StateResource
- Object
- Resource
- StateResource
- Shared::Instance
- Includes:
- Deletable
- Defined in:
- lib/vas/shared/instance.rb
Overview
A collection of instances
Direct Known Subclasses
Gemfire::AgentInstance, Gemfire::CacheServerInstance, Gemfire::LocatorInstance, RabbitMq::Instance, Sqlfire::AgentInstance, Sqlfire::LocatorInstance, Sqlfire::ServerInstance, TcServer::Instance, WebServer::Instance
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The instance’s name.
Attributes included from Deletable
Attributes inherited from Resource
Instance Method Summary collapse
-
#group ⇒ Group
The group that contains this instance.
-
#initialize(location, client, group_class, installation_class, live_configurations_class, pending_configurations_class, node_instance_class, node_instance_type) ⇒ Instance
constructor
A new instance of Instance.
-
#installation ⇒ Installation
The installation that this instance is using.
-
#live_configurations ⇒ Object
The instance’s live configurations.
-
#node_instances ⇒ NodeInstance[]
The instance’s individual node instances.
-
#pending_configurations ⇒ Object
The instance’s pending configurations.
-
#reload ⇒ void
Reloads the instance’s details from the server.
-
#start(serial = false) ⇒ Object
Starts the instance.
-
#stop(serial = false) ⇒ Object
Stops the instance.
-
#to_s ⇒ String
A string representation of the instance.
Methods included from Deletable
Methods inherited from StateResource
Constructor Details
#initialize(location, client, group_class, installation_class, live_configurations_class, pending_configurations_class, node_instance_class, node_instance_type) ⇒ Instance
Returns a new instance of Instance.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vas/shared/instance.rb', line 28 def initialize(location, client, group_class, installation_class, live_configurations_class, pending_configurations_class, node_instance_class, node_instance_type) super(location, client) @live_configurations_location = Util::LinkUtils.get_link_href(details, 'live-configurations') @pending_configurations_location = Util::LinkUtils.get_link_href(details, 'pending-configurations') @group_location = Util::LinkUtils.get_link_href(details, 'group') @group_class = group_class @installation_class = installation_class @node_instance_class = node_instance_class @live_configurations_class = live_configurations_class @pending_configurations_class = pending_configurations_class @node_instance_type = node_instance_type @name = details['name'] end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns the instance’s name.
25 26 27 |
# File 'lib/vas/shared/instance.rb', line 25 def name @name end |
Instance Method Details
#group ⇒ Group
Returns the group that contains this instance.
73 74 75 |
# File 'lib/vas/shared/instance.rb', line 73 def group @group ||= @group_class.new(@group_location, client) end |
#installation ⇒ Installation
Returns the installation that this instance is using.
63 64 65 |
# File 'lib/vas/shared/instance.rb', line 63 def installation @installation ||= @installation_class.new(@installation_location, client) end |
#live_configurations ⇒ Object
Returns the instance’s live configurations.
78 79 80 |
# File 'lib/vas/shared/instance.rb', line 78 def live_configurations @live_configurations ||= @live_configurations_class.new(@live_configurations_location, client) end |
#node_instances ⇒ NodeInstance[]
Returns the instance’s individual node instances.
68 69 70 |
# File 'lib/vas/shared/instance.rb', line 68 def node_instances @node_instances ||= create_resources_from_links(@node_instance_type, @node_instance_class) end |
#pending_configurations ⇒ Object
Returns the instance’s pending configurations.
83 84 85 |
# File 'lib/vas/shared/instance.rb', line 83 def pending_configurations @pending_configurations ||= @pending_configurations_class.new(@pending_configurations_location, client) end |
#reload ⇒ void
This method returns an undefined value.
Reloads the instance’s details from the server
55 56 57 58 59 60 |
# File 'lib/vas/shared/instance.rb', line 55 def reload super @installation_location = Util::LinkUtils.get_link_href(details, 'installation') @installation = nil @node_instances = nil end |
#start(serial = false) ⇒ Object
Starts the instance
91 92 93 |
# File 'lib/vas/shared/instance.rb', line 91 def start(serial = false) client.post(@state_location, { :status => 'STARTED', :serial => serial }) end |
#stop(serial = false) ⇒ Object
Stops the instance
99 100 101 |
# File 'lib/vas/shared/instance.rb', line 99 def stop(serial = false) client.post(@state_location, { :status => 'STOPPED', :serial => serial }) end |
#to_s ⇒ String
Returns a string representation of the instance.
104 105 106 |
# File 'lib/vas/shared/instance.rb', line 104 def to_s "#<#{self.class} name='#@name'>" end |