vas 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/README.md +1 -1
  2. data/lib/vas.rb +44 -1
  3. data/lib/vas/gemfire/agent_instances.rb +4 -3
  4. data/lib/vas/gemfire/agent_live_configurations.rb +3 -3
  5. data/lib/vas/gemfire/agent_node_instances.rb +2 -2
  6. data/lib/vas/gemfire/agent_node_live_configurations.rb +39 -0
  7. data/lib/vas/gemfire/application_code.rb +13 -12
  8. data/lib/vas/gemfire/application_code_images.rb +13 -11
  9. data/lib/vas/gemfire/cache_server_instances.rb +20 -12
  10. data/lib/vas/gemfire/cache_server_live_configurations.rb +3 -3
  11. data/lib/vas/gemfire/cache_server_node_instances.rb +16 -9
  12. data/lib/vas/gemfire/cache_server_node_live_configurations.rb +39 -0
  13. data/lib/vas/gemfire/disk_stores.rb +19 -11
  14. data/lib/vas/gemfire/gemfire.rb +4 -4
  15. data/lib/vas/gemfire/groups.rb +17 -10
  16. data/lib/vas/gemfire/installations.rb +12 -3
  17. data/lib/vas/gemfire/live_application_codes.rb +2 -2
  18. data/lib/vas/gemfire/locator_instances.rb +23 -13
  19. data/lib/vas/gemfire/locator_live_configurations.rb +3 -3
  20. data/lib/vas/gemfire/locator_node_instances.rb +22 -14
  21. data/lib/vas/gemfire/locator_node_live_configurations.rb +39 -0
  22. data/lib/vas/gemfire/nodes.rb +27 -6
  23. data/lib/vas/gemfire/pending_application_codes.rb +7 -2
  24. data/lib/vas/gemfire/statistics.rb +18 -11
  25. data/lib/vas/rabbitmq/groups.rb +6 -4
  26. data/lib/vas/rabbitmq/installations.rb +14 -6
  27. data/lib/vas/rabbitmq/instances.rb +9 -6
  28. data/lib/vas/rabbitmq/live_configurations.rb +3 -3
  29. data/lib/vas/rabbitmq/node_instances.rb +2 -2
  30. data/lib/vas/rabbitmq/node_live_configurations.rb +39 -0
  31. data/lib/vas/rabbitmq/nodes.rb +11 -8
  32. data/lib/vas/rabbitmq/plugin_images.rb +14 -7
  33. data/lib/vas/rabbitmq/plugins.rb +29 -20
  34. data/lib/vas/rabbitmq/rabbitmq.rb +4 -4
  35. data/lib/vas/shared/collection.rb +34 -11
  36. data/lib/vas/shared/configuration.rb +16 -9
  37. data/lib/vas/shared/deletable.rb +34 -0
  38. data/lib/vas/shared/groups.rb +26 -15
  39. data/lib/vas/shared/installation_images.rb +18 -10
  40. data/lib/vas/shared/installations.rb +22 -22
  41. data/lib/vas/shared/instance.rb +40 -19
  42. data/lib/vas/shared/live_configuration.rb +42 -0
  43. data/lib/vas/shared/logs.rb +27 -14
  44. data/lib/vas/shared/mutable_collection.rb +13 -5
  45. data/lib/vas/shared/node_configuration.rb +74 -0
  46. data/lib/vas/shared/node_instances.rb +32 -14
  47. data/lib/vas/shared/nodes.rb +37 -14
  48. data/lib/vas/shared/{pending_configuration.rb → pending_configurations.rb} +4 -2
  49. data/lib/vas/shared/resource.rb +12 -2
  50. data/lib/vas/shared/security.rb +11 -4
  51. data/lib/vas/shared/state_resource.rb +1 -1
  52. data/lib/vas/sqlfire/agent_instances.rb +98 -0
  53. data/lib/vas/sqlfire/agent_live_configurations.rb +39 -0
  54. data/lib/vas/sqlfire/agent_logs.rb +39 -0
  55. data/lib/vas/sqlfire/agent_node_instances.rb +54 -0
  56. data/lib/vas/sqlfire/agent_node_live_configurations.rb +39 -0
  57. data/lib/vas/sqlfire/agent_pending_configurations.rb +39 -0
  58. data/lib/vas/sqlfire/groups.rb +58 -0
  59. data/lib/vas/sqlfire/installation_images.rb +39 -0
  60. data/lib/vas/sqlfire/installations.rb +61 -0
  61. data/lib/vas/sqlfire/locator_instances.rb +210 -0
  62. data/lib/vas/sqlfire/locator_live_configurations.rb +39 -0
  63. data/lib/vas/sqlfire/locator_logs.rb +39 -0
  64. data/lib/vas/sqlfire/locator_node_instances.rb +91 -0
  65. data/lib/vas/sqlfire/locator_node_live_configurations.rb +39 -0
  66. data/lib/vas/sqlfire/locator_pending_configurations.rb +39 -0
  67. data/lib/vas/sqlfire/nodes.rb +73 -0
  68. data/lib/vas/sqlfire/server_instances.rb +192 -0
  69. data/lib/vas/sqlfire/server_live_configurations.rb +39 -0
  70. data/lib/vas/sqlfire/server_logs.rb +39 -0
  71. data/lib/vas/sqlfire/server_node_instances.rb +86 -0
  72. data/lib/vas/sqlfire/server_node_live_configurations.rb +39 -0
  73. data/lib/vas/sqlfire/server_pending_configurations.rb +39 -0
  74. data/lib/vas/sqlfire/sqlfire.rb +44 -0
  75. data/lib/vas/tc_server/applications.rb +32 -21
  76. data/lib/vas/tc_server/configuration.rb +1 -1
  77. data/lib/vas/tc_server/groups.rb +7 -4
  78. data/lib/vas/tc_server/installations.rb +16 -6
  79. data/lib/vas/tc_server/instances.rb +25 -13
  80. data/lib/vas/tc_server/live_configurations.rb +11 -1
  81. data/lib/vas/tc_server/logs.rb +4 -2
  82. data/lib/vas/tc_server/node_applications.rb +21 -17
  83. data/lib/vas/tc_server/node_instances.rb +23 -9
  84. data/lib/vas/tc_server/node_live_configurations.rb +39 -0
  85. data/lib/vas/tc_server/node_revisions.rb +15 -10
  86. data/lib/vas/tc_server/nodes.rb +15 -8
  87. data/lib/vas/tc_server/revision_images.rb +16 -10
  88. data/lib/vas/tc_server/revisions.rb +20 -16
  89. data/lib/vas/tc_server/tc_server.rb +5 -5
  90. data/lib/vas/tc_server/template_images.rb +13 -7
  91. data/lib/vas/tc_server/templates.rb +21 -13
  92. data/lib/vas/util/client.rb +15 -6
  93. data/lib/vas/vfabric/agent_image.rb +1 -1
  94. data/lib/vas/vfabric/nodes.rb +4 -11
  95. data/lib/vas/vfabric/v_fabric.rb +2 -2
  96. data/lib/vas/vfabric_administration_server.rb +37 -6
  97. data/lib/vas/web_server/configuration.rb +29 -0
  98. data/lib/vas/web_server/groups.rb +44 -0
  99. data/lib/vas/web_server/installation_images.rb +54 -0
  100. data/lib/vas/web_server/installations.rb +52 -0
  101. data/lib/vas/web_server/instances.rb +65 -0
  102. data/lib/vas/web_server/live_configurations.rb +39 -0
  103. data/lib/vas/web_server/logs.rb +37 -0
  104. data/lib/vas/web_server/node_instances.rb +39 -0
  105. data/lib/vas/web_server/node_live_configurations.rb +39 -0
  106. data/lib/vas/web_server/nodes.rb +53 -0
  107. data/lib/vas/web_server/pending_configurations.rb +39 -0
  108. data/lib/vas/web_server/web_server.rb +43 -0
  109. metadata +137 -76
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate a locator instance's live configuration
20
+ class LocatorLiveConfigurations < Shared::Collection
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'live-configurations', LocatorLiveConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A live configuration file in a locator instance
30
+ class LocatorLiveConfiguration < Shared::LiveConfiguration
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'locator-group-instance', LocatorInstance, LocatorNodeLiveConfiguration)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate a locator node instance's logs
20
+ class LocatorLogs < Shared::Logs
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, LocatorLog)
25
+ end
26
+
27
+ end
28
+
29
+ # A log file in a locator node instance
30
+ class LocatorLog < Shared::Log
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'locator-node-instance', LocatorNodeInstance)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,91 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate locator instances on an individual node
20
+ class LocatorNodeInstances < Shared::NodeInstances
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'locator-node-instances', LocatorNodeInstance)
25
+ end
26
+
27
+ end
28
+
29
+ # A locator node instance
30
+ class LocatorNodeInstance < Shared::NodeInstance
31
+
32
+ # @return [String] the property in a node's metadata used to determine the address that the locator binds to for
33
+ # peer-to-peer communication. If +nil+, the locator uses the value derived from +peer_discovery_address+
34
+ attr_reader :bind_address
35
+
36
+ # @return [String] the property in a node's metadata used to determine the address that the locator binds to for
37
+ # client communication. If +nil+, the locator uses the node's hostname. Only takes effect if +run_netserver+ is
38
+ # +true+
39
+ attr_reader :client_bind_address
40
+
41
+ # @return [Integer] The port that the locator listens on for client connections. Only takes effect if
42
+ # +run_netserver+ is +true+
43
+ attr_reader :client_port
44
+
45
+ # @return [String] The initial heap size of the locator's JVM. +nil+ if the default is used
46
+ attr_reader :initial_heap
47
+
48
+ # @return [String[]] The JVM options that are passed to the locator's JVM when it is started
49
+ attr_reader :jvm_options
50
+
51
+ # @return [String] The max heap size of the locator's JVM. +nil+ if the default is used
52
+ attr_reader :max_heap
53
+
54
+ # @return [String] the property in a node's metadata used to determine the address that the locator binds to for
55
+ # peer-discovery communication. If +nil+, the locator uses +0.0.0.0+
56
+ attr_reader :peer_discovery_address
57
+
58
+
59
+ # @return [Integer] The port that the locator listens of for peer-discovery connections
60
+ attr_reader :peer_discovery_port
61
+
62
+ # @return [Boolean] +true+ if the locator runs a netserver that can service thin clients, otherwise +false+
63
+ attr_reader :run_netserver
64
+
65
+ # @private
66
+ def initialize(location, client)
67
+ super(location, client, Node, LocatorLogs, LocatorInstance, 'locator-group-instance',
68
+ LocatorNodeLiveConfigurations)
69
+ end
70
+
71
+ def reload
72
+ super
73
+ @bind_address = details['bind-address']
74
+ @client_bind_address = details['client-bind-address']
75
+ @client_port = details['client-port']
76
+ @initial_heap = details['initial-heap']
77
+ @jvm_options = details['jvm-options']
78
+ @max_heap = details['max-heap']
79
+ @peer_discovery_address = details['peer-discovery-address']
80
+ @peer_discovery_port = details['peer-discovery-port']
81
+ @run_netserver = details['run-netserver']
82
+ end
83
+
84
+ # @return [String] a string representation of the instance
85
+ def to_s
86
+ "#<#{self.class} name='#{name}' bind_address='#@bind_address' client_bind_address='#@client_bind_address' client_port='#@client_port' initial_heap='#@initial_heap' jvm_options='#@jvm_options' max_heap='#@max_heap' peer_discovery_address='#@peer_discovery_address' peer_discovery_port='#@peer_discovery_port' run_netserver='#@run_netserver'>"
87
+ end
88
+
89
+ end
90
+
91
+ end
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate a locator node instance's live configuration
20
+ class LocatorNodeLiveConfigurations < Shared::Collection
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'node-live-configurations', LocatorNodeLiveConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A live configuration file in a locator node instance
30
+ class LocatorNodeLiveConfiguration < Shared::NodeConfiguration
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'locator-node-instance', LocatorNodeInstance, LocatorLiveConfiguration)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate a locator instance's pending configuration
20
+ class LocatorPendingConfigurations < Shared::PendingConfigurations
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'pending-configurations', LocatorPendingConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A locator configuration file that is pending
30
+ class LocatorPendingConfiguration < Shared::PendingConfiguration
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'locator-group-instance', LocatorInstance)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,73 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate SqlFire nodes
20
+ class Nodes < Shared::Collection
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'nodes', Node)
25
+ end
26
+
27
+ end
28
+
29
+ # A GemFire node
30
+ class Node < Shared::GroupableNode
31
+
32
+ # @return [String] the Node's Java home
33
+ attr_reader :java_home
34
+
35
+ # @private
36
+ def initialize(location, client)
37
+ super(location, client, Group)
38
+
39
+ @agent_instances_location = Util::LinkUtils.get_link_href(details, 'agent-node-instances')
40
+ @locator_instances_location = Util::LinkUtils.get_link_href(details, 'locator-node-instances')
41
+ @server_instances_location = Util::LinkUtils.get_link_href(details, 'server-node-instances')
42
+ end
43
+
44
+ # Reloads the node's details from the server
45
+ # @return [void]
46
+ def reload
47
+ super
48
+ @java_home = details['java-home']
49
+ end
50
+
51
+ # @return [AgentNodeInstances] the node's agent instances
52
+ def agent_instances
53
+ @agent_instances ||= AgentNodeInstances.new(@agent_instances_location, client)
54
+ end
55
+
56
+ # @return [LocatorNodeInstances] the node's locator instances
57
+ def locator_instances
58
+ @locator_instances ||= LocatorNodeInstances.new(@locator_instances_location, client)
59
+ end
60
+
61
+ # @return [ServerNodeInstances] the node's server instances
62
+ def server_instances
63
+ @server_instances ||= ServerNodeInstances.new(@server_instances_location, client)
64
+ end
65
+
66
+ # @return [String] a string representation of the node
67
+ def to_s
68
+ "#<#{self.class} host_names='#{host_names}' ip_addresses='#{ip_addresses}' ipv4_addresses='#{ipv4_addresses}' ipv6_addresses='#{ipv6_addresses}' operating_system='#{operating_system}' architecture='#{architecture}' agent_home='#{agent_home}' java_home='#@java_home' metadata='#{metadata}'>"
69
+ end
70
+
71
+ end
72
+
73
+ end
@@ -0,0 +1,192 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate, create, and delete server instances.
20
+ class ServerInstances < Shared::MutableCollection
21
+
22
+ private
23
+
24
+ CREATE_PAYLOAD_KEYS = ['bind-address',
25
+ 'client-bind-address',
26
+ 'client-port',
27
+ 'critical-heap-percentage',
28
+ 'initial-heap',
29
+ 'jvm-options',
30
+ 'max-heap',
31
+ 'run-netserver']
32
+
33
+ public
34
+
35
+ # @private
36
+ def initialize(location, client)
37
+ super(location, client, "server-group-instances", ServerInstance)
38
+ end
39
+
40
+ # Creates a new server instance
41
+ #
42
+ # @param installation [Installation] the installation that the instance will use
43
+ # @param name [String] the name of the instance
44
+ # @param options [Hash] optional configuration for the instance
45
+ #
46
+ # @option options 'bind-address' [String] The property in a node's metadata to use to determine the address that the
47
+ # server binds to for peer-to-peer communication. If omitted, or if the property does not exist, the server will
48
+ # use the node's hostname
49
+ # @option options 'client-bind-address' [String] The property in a node's metadata to use to determine the address
50
+ # that the server binds to for client communication. If omitted, or if the property does not exist, the server
51
+ # will use the node's hostname. Only takes effect if +run-netserver+ is +true+
52
+ # @option options 'client-port' [Integer] The port that the server listens on for client connections. Only take
53
+ # effect if +run-netserver+ is +true+
54
+ # @option options 'critical-heap-percentage' [Integer] Critical heap threshold as a percentage of the old generation
55
+ # heap
56
+ # @option options 'initial-heap' [String] The intial heap size to be used by the server's JVM. If not specified,
57
+ # the JVM's default is used
58
+ # @option options 'jvm-options' [String[]] The JVM options that are passed to the server's JVM when it is started
59
+ # @option options 'max-heap' [String] The maximum heap size to be used by the server's JVM. If not specified, the
60
+ # JVM's default is used
61
+ # @option options 'run-netserver' [Boolean] Whether the locator should run a netserver that can service thin
62
+ # clients. Default is +true+.
63
+ #
64
+ # @return [ServerInstance] the new server instance
65
+ def create(installation, name, options = {})
66
+ payload = { :installation => installation.location, :name => name }
67
+
68
+ options.each { |key, value|
69
+ if (CREATE_PAYLOAD_KEYS.include?(key))
70
+ payload[key] = value
71
+ end
72
+ }
73
+
74
+ super(payload, 'server-group-instance')
75
+ end
76
+
77
+ end
78
+
79
+ # A server instance
80
+ class ServerInstance < Shared::Instance
81
+
82
+ private
83
+
84
+ UPDATE_PAYLOAD_KEYS = ['bind-address',
85
+ 'client-bind-address',
86
+ 'client-port',
87
+ 'critical-heap-percentage',
88
+ 'initial-heap',
89
+ 'jvm-options',
90
+ 'max-heap',
91
+ 'run-netserver']
92
+
93
+ public
94
+
95
+ # @return [String] the property in a node's metadata used to determine the address that the server binds to for
96
+ # peer-to-peer communication. If +nil+, the server uses the node's hostname
97
+ attr_reader :bind_address
98
+
99
+ # @return [String] the property in a node's metadata used to determine the address that the server binds to for
100
+ # client communication. If +nil+, the server uses localhost. Only takes effect if +run_netserver+ is +true+
101
+ attr_reader :client_bind_address
102
+
103
+ # @return [Integer] the port that the server listens on for client connections. Only takes effect if +run_netserver+
104
+ # is +true+
105
+ attr_reader :client_port
106
+
107
+ # @return [Integer] critical heap percentage as a percentage of the old generation heap. +nil+ if the server uses
108
+ # the default
109
+ attr_reader :critical_heap_percentage
110
+
111
+ # @return [String] The initial heap size of the server's JVM. +nil+ if the default is used
112
+ attr_reader :initial_heap
113
+
114
+ # @return [String[]] The JVM options that are passed to the server's JVM when it is started
115
+ attr_reader :jvm_options
116
+
117
+ # @return [String] The max heap size of the server's JVM. +nil+ if the default is used
118
+ attr_reader :max_heap
119
+
120
+ # @return [Boolean] +true+ if the server runs a netserver that can service thin clients, otherwise +false+
121
+ attr_reader :run_netserver
122
+
123
+ # @private
124
+ def initialize(location, client)
125
+ super(location, client, Group, Installation, ServerLiveConfigurations, ServerPendingConfigurations, ServerNodeInstance, 'server-node-instance')
126
+ end
127
+
128
+ # Updates the instance using the supplied +options+.
129
+ #
130
+ # @param options [Hash] optional configuration for the instance
131
+ #
132
+ # @option options 'bind-address' [String] The property in a node's metadata to use to determine the address that the
133
+ # server binds to for peer-to-peer communication. If omitted or +nil+, the configuration will not be changed. If
134
+ # set to an empty string the server will use the node's hostname
135
+ # @option options 'client-bind-address' [String] The property in a node's metadata to use to determine the address
136
+ # that the server binds to for client communication. If omitted or +nil+, the configuration will not be changed.
137
+ # If set to an empty string the server will bind to localhost
138
+ # @option options 'client-port' [Integer] The port that the server listens on for client connections. If omitted or
139
+ # +nil+, the configuration will not be changed
140
+ # @option options 'critical-heap-percentage' [Integer] Critical heap threshold as a percentage of the old generation
141
+ # heap. Valid value are 0-100 inclusive. If omitted or +nil+, the configuration will not be changed
142
+ # @option options 'initial-heap' [String] The intial heap size to be used by the server's JVM. If omitted or +nil+,
143
+ # the configuration will not be changed. If set to an empty string the JVM's default is used
144
+ # @option options :installation [String] The installation to be used by the instance. If omitted or +nil+, the
145
+ # configuration will not be changed.
146
+ # @option options 'jvm-options' [String[]] The JVM options that are passed to the server's JVM when it is started.
147
+ # If omitted or +nil+, the configuration will not be chanaged
148
+ # @option options 'max-heap' [String] The maximum heap size to be used by the server's JVM. If omitted or +nil+, the
149
+ # configuration will not be changed. If set to an empty string the JVM's default is used
150
+ # @option options 'run-netserver' [Boolean] Whether the server should run a netserver that can service thin
151
+ # clients. If omitted or +nil+, the configuration will not be changed
152
+ #
153
+ # @return [void]
154
+ def update(options = {})
155
+ payload = {}
156
+
157
+ options.each { |key, value|
158
+ if (UPDATE_PAYLOAD_KEYS.include?(key))
159
+ payload[key] = value
160
+ end
161
+ }
162
+
163
+ if (options.has_key? :installation)
164
+ payload[:installation] = options[:installation].location
165
+ end
166
+
167
+ client.post(location, payload)
168
+ reload
169
+ end
170
+
171
+ # Reloads the instance's details from the server
172
+ # @return [void]
173
+ def reload
174
+ super
175
+ @bind_address = details['bind-address']
176
+ @client_bind_address = details['client-bind-address']
177
+ @client_port = details['client-port']
178
+ @critical_heap_percentage = details['critical-heap-percentage']
179
+ @initial_heap = details['initial-heap']
180
+ @jvm_options = details['jvm-options']
181
+ @max_heap = details['max-heap']
182
+ @run_netserver = details['run-netserver']
183
+ end
184
+
185
+ # @return [String] a string representation of the instance
186
+ def to_s
187
+ "#<#{self.class} name='#{name}' bind_address='#@bind_address' client_bind_address='#@client_bind_address' client_port='#@client_port' critical_heap_percentage='#@critical_heap_percentage' initial_heap='#@initial_heap' jvm_options='#@jvm_options' max_heap='#@max_heap' run_netserver='#@run_netserver'>"
188
+ end
189
+
190
+ end
191
+
192
+ end