Class: Shared::Instance Abstract
- Inherits:
-
StateResource
- Object
- Resource
- StateResource
- Shared::Instance
- Defined in:
- lib/vas/shared/instance.rb
Overview
A collection of instances
Direct Known Subclasses
Gemfire::AgentInstance, Gemfire::CacheServerInstance, Gemfire::LocatorInstance, RabbitMq::Instance, TcServer::Instance
Instance Attribute Summary collapse
-
#group ⇒ Group
readonly
The group that contains this instance.
-
#live_configurations ⇒ Object
readonly
The instance’s live configurations.
-
#name ⇒ String
readonly
The instance’s name.
-
#pending_configurations ⇒ Object
readonly
The instance’s pending configurations.
Attributes inherited from Resource
Instance Method Summary collapse
-
#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.
-
#node_instances ⇒ NodeInstance[]
The instance’s individual node instances.
-
#to_s ⇒ String
A string representation of the instance.
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.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vas/shared/instance.rb', line 35 def initialize(location, client, group_class, installation_class, live_configurations_class, pending_configurations_class, node_instance_class, node_instance_type) #:nodoc: super(location, client) @name = details["name"] @live_configurations = live_configurations_class.new(Util::LinkUtils.get_link_href(details, "live-configurations"), client) @pending_configurations = pending_configurations_class.new(Util::LinkUtils.get_link_href(details, "pending-configurations"), client) @group = group_class.new(Util::LinkUtils.get_link_href(details, "group"), client) @installation_class = installation_class @node_instance_class = node_instance_class @node_instance_type = node_instance_type end |
Instance Attribute Details
#group ⇒ Group (readonly)
Returns the group that contains this instance.
32 33 34 |
# File 'lib/vas/shared/instance.rb', line 32 def group @group end |
#live_configurations ⇒ Object (readonly)
Returns the instance’s live configurations.
26 27 28 |
# File 'lib/vas/shared/instance.rb', line 26 def live_configurations @live_configurations end |
#name ⇒ String (readonly)
Returns the instance’s name.
23 24 25 |
# File 'lib/vas/shared/instance.rb', line 23 def name @name end |
#pending_configurations ⇒ Object (readonly)
Returns the instance’s pending configurations.
29 30 31 |
# File 'lib/vas/shared/instance.rb', line 29 def pending_configurations @pending_configurations end |
Instance Method Details
#installation ⇒ Installation
Returns the installation that this instance is using.
54 55 56 |
# File 'lib/vas/shared/instance.rb', line 54 def installation @installation_class.new(Util::LinkUtils.get_link_href(client.get(location), 'installation'), client) end |
#node_instances ⇒ NodeInstance[]
Returns the instance’s individual node instances.
59 60 61 62 63 64 |
# File 'lib/vas/shared/instance.rb', line 59 def node_instances node_instances = [] Util::LinkUtils.get_link_hrefs(client.get(location), @node_instance_type).each { |node_instance_location| node_instances << @node_instance_class.new(node_instance_location, client)} node_instances end |
#to_s ⇒ String
Returns a string representation of the instance.
67 68 69 |
# File 'lib/vas/shared/instance.rb', line 67 def to_s "#<#{self.class} name='#@name'>" end |