Class: TcServer::Instance
- Inherits:
-
Shared::Instance
- Object
- Shared::Resource
- Shared::StateResource
- Shared::Instance
- TcServer::Instance
- Defined in:
- lib/vas/tc_server/instances.rb
Overview
A tc Server instance
Instance Attribute Summary collapse
-
#layout ⇒ String
readonly
The instance’s layout.
-
#runtime_version ⇒ String
readonly
The version of runtime used by the instance.
-
#services ⇒ Hash
readonly
The instance’s services.
Attributes inherited from Shared::Instance
Attributes included from Shared::Deletable
Attributes inherited from Shared::Resource
Instance Method Summary collapse
-
#applications ⇒ Applications
The instance’s applications.
-
#initialize(location, client) ⇒ Instance
constructor
A new instance of Instance.
-
#reload ⇒ void
Reloads the instance’s details from the server.
-
#to_s ⇒ String
A string representation of the instance.
-
#update(installation, runtime_version = nil) ⇒ void
Updates the installation and, optionally, the
runtime_version
used by the instance.
Methods inherited from Shared::Instance
#group, #installation, #live_configurations, #node_instances, #pending_configurations, #start, #stop
Methods included from Shared::Deletable
Methods inherited from Shared::StateResource
Constructor Details
#initialize(location, client) ⇒ Instance
Returns a new instance of Instance.
81 82 83 84 85 |
# File 'lib/vas/tc_server/instances.rb', line 81 def initialize(location, client) super(location, client, Group, Installation, LiveConfigurations, PendingConfigurations, NodeInstance, 'node-instance') @layout = details['layout'] end |
Instance Attribute Details
#layout ⇒ String (readonly)
Returns the instance’s layout.
72 73 74 |
# File 'lib/vas/tc_server/instances.rb', line 72 def layout @layout end |
#runtime_version ⇒ String (readonly)
Returns the version of runtime used by the instance.
75 76 77 |
# File 'lib/vas/tc_server/instances.rb', line 75 def runtime_version @runtime_version end |
#services ⇒ Hash (readonly)
Returns the instance’s services.
78 79 80 |
# File 'lib/vas/tc_server/instances.rb', line 78 def services @services end |
Instance Method Details
#applications ⇒ Applications
Returns the instance’s applications.
96 97 98 |
# File 'lib/vas/tc_server/instances.rb', line 96 def applications @applications ||= Applications.new(Util::LinkUtils.get_link_href(details, 'group-applications'), client) end |
#reload ⇒ void
This method returns an undefined value.
Reloads the instance’s details from the server
89 90 91 92 93 |
# File 'lib/vas/tc_server/instances.rb', line 89 def reload super @runtime_version = details['runtime-version'] @services = details['services'] end |
#to_s ⇒ String
Returns a string representation of the instance.
116 117 118 |
# File 'lib/vas/tc_server/instances.rb', line 116 def to_s "#<#{self.class} name='#{name}' layout='#@layout' runtime_version='#@runtime_version' services='#@services'>" end |
#update(installation, runtime_version = nil) ⇒ void
This method returns an undefined value.
Updates the installation and, optionally, the runtime_version
used by the instance
106 107 108 109 110 111 112 113 |
# File 'lib/vas/tc_server/instances.rb', line 106 def update(installation, runtime_version = nil) payload = { :installation => installation.location } if runtime_version payload['runtime-version'] = runtime_version end client.post(location, payload) reload end |