Class: TcServer::Instance

Inherits:
Shared::Instance show all
Defined in:
lib/vas/tc_server/instances.rb

Overview

A tc Server instance

Instance Attribute Summary collapse

Attributes inherited from Shared::Instance

#group, #live_configurations, #name, #node_instances, #pending_configurations

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Methods inherited from Shared::Instance

#installation, #to_s

Methods inherited from Shared::StateResource

#start, #state, #stop

Constructor Details

#initialize(location, client) ⇒ Instance

:nodoc:



81
82
83
84
85
86
87
88
89
# File 'lib/vas/tc_server/instances.rb', line 81

def initialize(location, client) #:nodoc:
  super(location, client, Group, Installation, LiveConfigurations, PendingConfigurations, NodeInstance, 'node-instance')

  @layout = details["layout"]
  @runtime_version = details["runtime-version"]
  @services = details["services"]
  @applications = Applications.new(Util::LinkUtils.get_link_href(details, "group-applications"), client)

end

Instance Attribute Details

#applicationsObject (readonly)

The instance’s Applications



79
80
81
# File 'lib/vas/tc_server/instances.rb', line 79

def applications
  @applications
end

#layoutObject (readonly)

The instance’s layout



70
71
72
# File 'lib/vas/tc_server/instances.rb', line 70

def layout
  @layout
end

#runtime_versionObject (readonly)

The version of runtime used by the instance



73
74
75
# File 'lib/vas/tc_server/instances.rb', line 73

def runtime_version
  @runtime_version
end

#servicesObject (readonly)

The instance’s services



76
77
78
# File 'lib/vas/tc_server/instances.rb', line 76

def services
  @services
end

Instance Method Details

#update(installation, runtime_version = nil) ⇒ Object

Updates the instance to use the given installation and, optionally, to use the given runtime_version



92
93
94
95
96
97
98
# File 'lib/vas/tc_server/instances.rb', line 92

def update(installation, runtime_version = nil)
  payload = { :installation => installation.location }
  if (!runtime_version.nil?)
    payload['runtime-version'] = runtime_version
  end
  client.post(location, payload);
end