Class: Shared::NodeInstance Abstract

Inherits:
StateResource show all
Defined in:
lib/vas/shared/node_instances.rb

Overview

This class is abstract.

A node instance, i.e. an instance on an individual node

Instance Attribute Summary collapse

Attributes inherited from Resource

#location, #security

Instance Method Summary collapse

Methods inherited from StateResource

#start, #state, #stop

Constructor Details

#initialize(location, client, node_class, logs_class, group_instance_class, group_instance_type, node_live_configurations_class) ⇒ NodeInstance

Returns a new instance of NodeInstance.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vas/shared/node_instances.rb', line 37

def initialize(location, client, node_class, logs_class, group_instance_class, group_instance_type,
    node_live_configurations_class)
  super(location, client)

  @name = details['name']

  @node_class = node_class
  @logs_class = logs_class
  @group_instance_class = group_instance_class
  @live_configurations_class = node_live_configurations_class

  @node_location = Util::LinkUtils.get_link_href(details, 'node')
  @logs_location = Util::LinkUtils.get_link_href(details, 'logs')
  @group_instance_location = Util::LinkUtils.get_link_href(details, group_instance_type)
  @live_configurations_location = Util::LinkUtils.get_link_href(details, 'node-live-configurations')
end

Instance Attribute Details

#nameString (readonly)

Returns the instance’s name.

Returns:

  • (String)

    the instance’s name



34
35
36
# File 'lib/vas/shared/node_instances.rb', line 34

def name
  @name
end

Instance Method Details

#group_instanceInstance

Returns the node instance’s group instance.

Returns:

  • (Instance)

    the node instance’s group instance



65
66
67
# File 'lib/vas/shared/node_instances.rb', line 65

def group_instance
  @group_instance ||= @group_instance_class.new(@group_instance_location, client)
end

#live_configurationsObject

Returns the node instance’s live configuration.

Returns:

  • the node instance’s live configuration



70
71
72
# File 'lib/vas/shared/node_instances.rb', line 70

def live_configurations
  @live_configurations ||= @live_configurations_class.new(@live_configurations_location, client)
end

#logsLogs

Returns the instance’s logs.

Returns:

  • (Logs)

    the instance’s logs



60
61
62
# File 'lib/vas/shared/node_instances.rb', line 60

def logs
  @logs ||= @logs_class.new(@logs_location, client)
end

#nodeGroupableNode

Returns the node that contains this instance.

Returns:



55
56
57
# File 'lib/vas/shared/node_instances.rb', line 55

def node
  @node ||= @node_class.new(@node_location, client)
end

#to_sString

Returns a string representation of the node instance.

Returns:

  • (String)

    a string representation of the node instance



75
76
77
# File 'lib/vas/shared/node_instances.rb', line 75

def to_s
  "#<#{self.class} name='#@name'>"
end