Class: Sqlfire::AgentInstance

Inherits:
Shared::Instance show all
Defined in:
lib/vas/sqlfire/agent_instances.rb

Overview

An agent instance

Instance Attribute Summary collapse

Attributes inherited from Shared::Instance

#name

Attributes included from Shared::Deletable

#collection

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Methods inherited from Shared::Instance

#group, #installation, #live_configurations, #node_instances, #pending_configurations, #start, #stop

Methods included from Shared::Deletable

#delete

Methods inherited from Shared::StateResource

#start, #state, #stop

Constructor Details

#initialize(location, client) ⇒ AgentInstance

Returns a new instance of AgentInstance.



55
56
57
# File 'lib/vas/sqlfire/agent_instances.rb', line 55

def initialize(location, client)
  super(location, client, Group, Installation, AgentLiveConfigurations, AgentPendingConfigurations, AgentNodeInstance, 'agent-node-instance')
end

Instance Attribute Details

#jvm_optionsString[] (readonly)

Returns The JVM options that are passed to the agent’s JVM when it is started.

Returns:

  • (String[])

    The JVM options that are passed to the agent’s JVM when it is started



52
53
54
# File 'lib/vas/sqlfire/agent_instances.rb', line 52

def jvm_options
  @jvm_options
end

Instance Method Details

#reloadvoid

This method returns an undefined value.

Reloads the agent instance’s details from the server



61
62
63
64
# File 'lib/vas/sqlfire/agent_instances.rb', line 61

def reload
  super
  @jvm_options = details['jvm-options']
end

#to_sString

Returns a string representation of the instance.

Returns:

  • (String)

    a string representation of the instance



92
93
94
# File 'lib/vas/sqlfire/agent_instances.rb', line 92

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

#update(options = {}) ⇒ void

This method returns an undefined value.

Updates the instance using the supplied options

Parameters:

  • options (Hash) (defaults to: {})

    optional configuration for the instance

Options Hash (options):

  • :installation (String)

    The installation to be used by the instance. If omitted or nil, the configuration will not be changed.

  • The ('jvm-options'String[])

    JVM options that are passed to the agent’s JVM when it is started. If omitted or nil, the configuration will not be changed



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/vas/sqlfire/agent_instances.rb', line 76

def update(options = {})
  payload = {}

  if options.has_key? 'jvm-options'
    payload['jvm-options'] = options['jvm-options']
  end

  if options.has_key? :installation
    payload[:installation] = options[:installation].location
  end

  client.post(location, payload)
  reload
end