vas 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/vas.rb +44 -1
- data/lib/vas/gemfire/agent_instances.rb +4 -3
- data/lib/vas/gemfire/agent_live_configurations.rb +3 -3
- data/lib/vas/gemfire/agent_node_instances.rb +2 -2
- data/lib/vas/gemfire/agent_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/application_code.rb +13 -12
- data/lib/vas/gemfire/application_code_images.rb +13 -11
- data/lib/vas/gemfire/cache_server_instances.rb +20 -12
- data/lib/vas/gemfire/cache_server_live_configurations.rb +3 -3
- data/lib/vas/gemfire/cache_server_node_instances.rb +16 -9
- data/lib/vas/gemfire/cache_server_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/disk_stores.rb +19 -11
- data/lib/vas/gemfire/gemfire.rb +4 -4
- data/lib/vas/gemfire/groups.rb +17 -10
- data/lib/vas/gemfire/installations.rb +12 -3
- data/lib/vas/gemfire/live_application_codes.rb +2 -2
- data/lib/vas/gemfire/locator_instances.rb +23 -13
- data/lib/vas/gemfire/locator_live_configurations.rb +3 -3
- data/lib/vas/gemfire/locator_node_instances.rb +22 -14
- data/lib/vas/gemfire/locator_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/nodes.rb +27 -6
- data/lib/vas/gemfire/pending_application_codes.rb +7 -2
- data/lib/vas/gemfire/statistics.rb +18 -11
- data/lib/vas/rabbitmq/groups.rb +6 -4
- data/lib/vas/rabbitmq/installations.rb +14 -6
- data/lib/vas/rabbitmq/instances.rb +9 -6
- data/lib/vas/rabbitmq/live_configurations.rb +3 -3
- data/lib/vas/rabbitmq/node_instances.rb +2 -2
- data/lib/vas/rabbitmq/node_live_configurations.rb +39 -0
- data/lib/vas/rabbitmq/nodes.rb +11 -8
- data/lib/vas/rabbitmq/plugin_images.rb +14 -7
- data/lib/vas/rabbitmq/plugins.rb +29 -20
- data/lib/vas/rabbitmq/rabbitmq.rb +4 -4
- data/lib/vas/shared/collection.rb +34 -11
- data/lib/vas/shared/configuration.rb +16 -9
- data/lib/vas/shared/deletable.rb +34 -0
- data/lib/vas/shared/groups.rb +26 -15
- data/lib/vas/shared/installation_images.rb +18 -10
- data/lib/vas/shared/installations.rb +22 -22
- data/lib/vas/shared/instance.rb +40 -19
- data/lib/vas/shared/live_configuration.rb +42 -0
- data/lib/vas/shared/logs.rb +27 -14
- data/lib/vas/shared/mutable_collection.rb +13 -5
- data/lib/vas/shared/node_configuration.rb +74 -0
- data/lib/vas/shared/node_instances.rb +32 -14
- data/lib/vas/shared/nodes.rb +37 -14
- data/lib/vas/shared/{pending_configuration.rb → pending_configurations.rb} +4 -2
- data/lib/vas/shared/resource.rb +12 -2
- data/lib/vas/shared/security.rb +11 -4
- data/lib/vas/shared/state_resource.rb +1 -1
- data/lib/vas/sqlfire/agent_instances.rb +98 -0
- data/lib/vas/sqlfire/agent_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/agent_logs.rb +39 -0
- data/lib/vas/sqlfire/agent_node_instances.rb +54 -0
- data/lib/vas/sqlfire/agent_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/agent_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/groups.rb +58 -0
- data/lib/vas/sqlfire/installation_images.rb +39 -0
- data/lib/vas/sqlfire/installations.rb +61 -0
- data/lib/vas/sqlfire/locator_instances.rb +210 -0
- data/lib/vas/sqlfire/locator_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/locator_logs.rb +39 -0
- data/lib/vas/sqlfire/locator_node_instances.rb +91 -0
- data/lib/vas/sqlfire/locator_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/locator_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/nodes.rb +73 -0
- data/lib/vas/sqlfire/server_instances.rb +192 -0
- data/lib/vas/sqlfire/server_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/server_logs.rb +39 -0
- data/lib/vas/sqlfire/server_node_instances.rb +86 -0
- data/lib/vas/sqlfire/server_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/server_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/sqlfire.rb +44 -0
- data/lib/vas/tc_server/applications.rb +32 -21
- data/lib/vas/tc_server/configuration.rb +1 -1
- data/lib/vas/tc_server/groups.rb +7 -4
- data/lib/vas/tc_server/installations.rb +16 -6
- data/lib/vas/tc_server/instances.rb +25 -13
- data/lib/vas/tc_server/live_configurations.rb +11 -1
- data/lib/vas/tc_server/logs.rb +4 -2
- data/lib/vas/tc_server/node_applications.rb +21 -17
- data/lib/vas/tc_server/node_instances.rb +23 -9
- data/lib/vas/tc_server/node_live_configurations.rb +39 -0
- data/lib/vas/tc_server/node_revisions.rb +15 -10
- data/lib/vas/tc_server/nodes.rb +15 -8
- data/lib/vas/tc_server/revision_images.rb +16 -10
- data/lib/vas/tc_server/revisions.rb +20 -16
- data/lib/vas/tc_server/tc_server.rb +5 -5
- data/lib/vas/tc_server/template_images.rb +13 -7
- data/lib/vas/tc_server/templates.rb +21 -13
- data/lib/vas/util/client.rb +15 -6
- data/lib/vas/vfabric/agent_image.rb +1 -1
- data/lib/vas/vfabric/nodes.rb +4 -11
- data/lib/vas/vfabric/v_fabric.rb +2 -2
- data/lib/vas/vfabric_administration_server.rb +37 -6
- data/lib/vas/web_server/configuration.rb +29 -0
- data/lib/vas/web_server/groups.rb +44 -0
- data/lib/vas/web_server/installation_images.rb +54 -0
- data/lib/vas/web_server/installations.rb +52 -0
- data/lib/vas/web_server/instances.rb +65 -0
- data/lib/vas/web_server/live_configurations.rb +39 -0
- data/lib/vas/web_server/logs.rb +37 -0
- data/lib/vas/web_server/node_instances.rb +39 -0
- data/lib/vas/web_server/node_live_configurations.rb +39 -0
- data/lib/vas/web_server/nodes.rb +53 -0
- data/lib/vas/web_server/pending_configurations.rb +39 -0
- data/lib/vas/web_server/web_server.rb +43 -0
- metadata +137 -76
data/lib/vas/shared/logs.rb
CHANGED
|
@@ -28,23 +28,41 @@ module Shared
|
|
|
28
28
|
|
|
29
29
|
# abstract A log file in a node instance
|
|
30
30
|
class Log < Shared::Resource
|
|
31
|
+
|
|
32
|
+
include Deletable
|
|
31
33
|
|
|
32
34
|
# @return [String] the name of the log
|
|
33
35
|
attr_reader :name
|
|
34
36
|
|
|
35
|
-
# @return [
|
|
36
|
-
attr_reader :
|
|
37
|
+
# @return [Integer] the size of the log
|
|
38
|
+
attr_reader :size
|
|
39
|
+
|
|
40
|
+
# @return [Integer] the last modified stamp of the log
|
|
41
|
+
attr_reader :last_modified
|
|
37
42
|
|
|
38
43
|
# @private
|
|
39
44
|
def initialize(location, client, instance_type, instance_class)
|
|
40
45
|
super(location, client)
|
|
41
46
|
|
|
42
|
-
@name = details['name']
|
|
43
47
|
@content_location = Util::LinkUtils.get_link_href(details, 'content')
|
|
44
|
-
@
|
|
48
|
+
@instance_location = Util::LinkUtils.get_link_href(details, instance_type)
|
|
49
|
+
|
|
50
|
+
@instance_class = instance_class
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Reloads the log's details from the server
|
|
54
|
+
#
|
|
55
|
+
# @return [void]
|
|
56
|
+
def reload
|
|
57
|
+
super
|
|
58
|
+
@name = details['name']
|
|
59
|
+
@size = details['size']
|
|
60
|
+
@last_modified = details['last-modified']
|
|
61
|
+
@instance = nil
|
|
45
62
|
end
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
|
|
65
|
+
# Retrieves the content of the log from the server
|
|
48
66
|
#
|
|
49
67
|
# @param [Hash] options the options that control the content that is returned
|
|
50
68
|
#
|
|
@@ -80,19 +98,14 @@ module Shared
|
|
|
80
98
|
end
|
|
81
99
|
end
|
|
82
100
|
|
|
83
|
-
# @return [
|
|
84
|
-
def
|
|
85
|
-
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
# @return [Integer] the last modified stamp of the log
|
|
89
|
-
def last_modified
|
|
90
|
-
client.get(location)['last-modified']
|
|
101
|
+
# @return [NodeInstance] the node instance that the log belongs to
|
|
102
|
+
def instance
|
|
103
|
+
@instance ||= @instance_class.new(@instance_location, client)
|
|
91
104
|
end
|
|
92
105
|
|
|
93
106
|
# @return [String] a string representation of the log
|
|
94
107
|
def to_s
|
|
95
|
-
"#<#{self.class} name='#@name'>"
|
|
108
|
+
"#<#{self.class} name='#@name' size='#@size' last_modified='#@last_modified'>"
|
|
96
109
|
end
|
|
97
110
|
end
|
|
98
111
|
end
|
|
@@ -16,13 +16,21 @@
|
|
|
16
16
|
|
|
17
17
|
module Shared
|
|
18
18
|
|
|
19
|
-
# @abstract A collection that allows items to be
|
|
19
|
+
# @abstract A collection that allows items to be created
|
|
20
20
|
class MutableCollection < Collection
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
# @private
|
|
23
|
+
def create(payload, rel=nil)
|
|
24
|
+
created = create_entry(client.post(location, payload, rel))
|
|
25
|
+
reload
|
|
26
|
+
created
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# @private
|
|
30
|
+
def create_image(path, payload=nil)
|
|
31
|
+
created = create_entry(client.post_image(location, path, payload))
|
|
32
|
+
reload
|
|
33
|
+
created
|
|
26
34
|
end
|
|
27
35
|
|
|
28
36
|
end
|
|
@@ -0,0 +1,74 @@
|
|
|
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 Shared
|
|
18
|
+
|
|
19
|
+
# @abstract A configuration file in a node instance
|
|
20
|
+
class NodeConfiguration < Shared::Resource
|
|
21
|
+
|
|
22
|
+
# @return [String] the configuration's path
|
|
23
|
+
attr_reader :path
|
|
24
|
+
|
|
25
|
+
# @return [Integer] the configuration's size
|
|
26
|
+
attr_reader :size
|
|
27
|
+
|
|
28
|
+
# @private
|
|
29
|
+
def initialize(location, client, instance_type, instance_class, group_configuration_class)
|
|
30
|
+
super(location, client)
|
|
31
|
+
|
|
32
|
+
@instance_class = instance_class
|
|
33
|
+
@group_configuration_class = group_configuration_class
|
|
34
|
+
|
|
35
|
+
@instance_location = Util::LinkUtils.get_link_href(details, instance_type)
|
|
36
|
+
@group_configuration_location = Util::LinkUtils.get_link_href(details, 'group-live-configuration')
|
|
37
|
+
@content_location = Util::LinkUtils.get_link_href(details, 'content')
|
|
38
|
+
|
|
39
|
+
@path = details['path']
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Reloads the configuration's details from the server
|
|
43
|
+
# @return [void]
|
|
44
|
+
def reload
|
|
45
|
+
super
|
|
46
|
+
@size = details['size']
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Retrieves the configuration's content and passes it to the block
|
|
50
|
+
#
|
|
51
|
+
# @yield [chunk] a chunk of the configuration's content
|
|
52
|
+
#
|
|
53
|
+
# @return [void]
|
|
54
|
+
def content(&block)
|
|
55
|
+
client.get_stream(@content_location, &block)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# @return [LiveConfiguration] the node configuration's group configuration
|
|
59
|
+
def group_configuration
|
|
60
|
+
@group_configuration ||= @group_configuration_class.new(@group_configuration_location, client)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# @return [NodeInstance] the node instance that owns the configuration
|
|
64
|
+
def instance
|
|
65
|
+
@instance ||= @instance_class.new(@instance_location, client)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# @return [String] a string representation of the configuration
|
|
69
|
+
def to_s
|
|
70
|
+
"#<#{self.class} name='#@path' size=#@size>"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -33,28 +33,46 @@ module Shared
|
|
|
33
33
|
# @return [String] the instance's name
|
|
34
34
|
attr_reader :name
|
|
35
35
|
|
|
36
|
-
# @
|
|
37
|
-
|
|
36
|
+
# @private
|
|
37
|
+
def initialize(location, client, node_class, logs_class, group_instance_class, group_instance_type,
|
|
38
|
+
node_live_configurations_class)
|
|
39
|
+
super(location, client)
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
attr_reader :logs
|
|
41
|
+
@name = details['name']
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
@node_class = node_class
|
|
44
|
+
@logs_class = logs_class
|
|
45
|
+
@group_instance_class = group_instance_class
|
|
46
|
+
@live_configurations_class = node_live_configurations_class
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
@node_location = Util::LinkUtils.get_link_href(details, 'node')
|
|
49
|
+
@logs_location = Util::LinkUtils.get_link_href(details, 'logs')
|
|
50
|
+
@group_instance_location = Util::LinkUtils.get_link_href(details, group_instance_type)
|
|
51
|
+
@live_configurations_location = Util::LinkUtils.get_link_href(details, 'node-live-configurations')
|
|
52
|
+
end
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+
# @return [GroupableNode] the node that contains this instance
|
|
55
|
+
def node
|
|
56
|
+
@node ||= @node_class.new(@node_location, client)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @return [Logs] the instance's logs
|
|
60
|
+
def logs
|
|
61
|
+
@logs ||= @logs_class.new(@logs_location, client)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @return [Instance] the node instance's group instance
|
|
65
|
+
def group_instance
|
|
66
|
+
@group_instance ||= @group_instance_class.new(@group_instance_location, client)
|
|
67
|
+
end
|
|
50
68
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@
|
|
69
|
+
# @return the node instance's live configuration
|
|
70
|
+
def live_configurations
|
|
71
|
+
@live_configurations ||= @live_configurations_class.new(@live_configurations_location, client)
|
|
54
72
|
end
|
|
55
73
|
|
|
56
74
|
# @return [String] a string representation of the node instance
|
|
57
|
-
def to_s
|
|
75
|
+
def to_s
|
|
58
76
|
"#<#{self.class} name='#@name'>"
|
|
59
77
|
end
|
|
60
78
|
|
data/lib/vas/shared/nodes.rb
CHANGED
|
@@ -30,23 +30,44 @@ module Shared
|
|
|
30
30
|
|
|
31
31
|
# @return [String[]] the node's IP addresses
|
|
32
32
|
attr_reader :ip_addresses
|
|
33
|
-
|
|
34
|
-
# @return [
|
|
35
|
-
attr_reader :
|
|
33
|
+
|
|
34
|
+
# @return [String[], nil] the node's IPv4 addresses. +nil+ if the server is not version 1.1.0 or later
|
|
35
|
+
attr_reader :ipv4_addresses
|
|
36
|
+
|
|
37
|
+
# @return [String[], nil] the node's IPv6 addresses. +nil+ if the server is not version 1.1.0 or later
|
|
38
|
+
attr_reader :ipv6_addresses
|
|
36
39
|
|
|
37
40
|
# @return [String] the node's operating system
|
|
38
41
|
attr_reader :operating_system
|
|
39
42
|
|
|
43
|
+
# @return [Hash] the node's metadata
|
|
44
|
+
attr_reader :metadata
|
|
45
|
+
|
|
40
46
|
# @private
|
|
41
47
|
def initialize(location, client)
|
|
42
48
|
super(location, client)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Reloads the node's details from the server
|
|
52
|
+
#
|
|
53
|
+
# @return [void]
|
|
54
|
+
def reload
|
|
55
|
+
super
|
|
56
|
+
@agent_home = details['agent-home']
|
|
57
|
+
@architecture = details['architecture']
|
|
58
|
+
@host_names = details['host-names']
|
|
59
|
+
@ip_addresses = details['ip-addresses']
|
|
60
|
+
@ipv4_addresses = details['ipv4-addresses']
|
|
61
|
+
@ipv6_addresses = details['ipv6-addresses']
|
|
62
|
+
@metadata = details['metadata']
|
|
63
|
+
@operating_system = details['operating-system']
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Updates the node's metadata
|
|
67
|
+
# @return [void]
|
|
68
|
+
def update(metadata)
|
|
69
|
+
client.post(location, {:metadata => metadata})
|
|
70
|
+
reload
|
|
50
71
|
end
|
|
51
72
|
|
|
52
73
|
end
|
|
@@ -60,12 +81,14 @@ module Shared
|
|
|
60
81
|
@group_class = group_class
|
|
61
82
|
end
|
|
62
83
|
|
|
84
|
+
def reload
|
|
85
|
+
super
|
|
86
|
+
@groups = nil
|
|
87
|
+
end
|
|
88
|
+
|
|
63
89
|
# @return [Group[]] the groups that contain this node
|
|
64
90
|
def groups
|
|
65
|
-
groups
|
|
66
|
-
Util::LinkUtils.get_link_hrefs(client.get(location), 'group').each {
|
|
67
|
-
|group_location| groups << @group_class.new(group_location, client)}
|
|
68
|
-
groups
|
|
91
|
+
@groups ||= create_resources_from_links('group', @group_class)
|
|
69
92
|
end
|
|
70
93
|
end
|
|
71
94
|
|
|
@@ -26,20 +26,22 @@ module Shared
|
|
|
26
26
|
#
|
|
27
27
|
# @return [PendingConfiguration] the new configuration
|
|
28
28
|
def create(path, content)
|
|
29
|
-
|
|
29
|
+
create_image(content, { :path => path })
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# @abstract A configuration file that is pending and will be made live the next time its instance is started
|
|
35
35
|
class PendingConfiguration < Configuration
|
|
36
|
+
|
|
37
|
+
include Deletable
|
|
36
38
|
|
|
37
39
|
# Updates the contents of the configuration
|
|
38
40
|
#
|
|
39
41
|
# @param new_content [String] the new content
|
|
40
42
|
def content=(new_content)
|
|
41
43
|
client.post(content_location, new_content)
|
|
42
|
-
|
|
44
|
+
reload
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
end
|
data/lib/vas/shared/resource.rb
CHANGED
|
@@ -37,10 +37,20 @@ module Shared
|
|
|
37
37
|
@location = location
|
|
38
38
|
@client = client
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
reload
|
|
41
41
|
|
|
42
|
-
@security = Security.new(Util::LinkUtils.get_link_href(@details, 'security'), client)
|
|
42
|
+
@security = Security.new(Util::LinkUtils.get_link_href(@details, 'security'), @client)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Reloads the resource's details from the server
|
|
46
|
+
# @return [void]
|
|
47
|
+
def reload
|
|
48
|
+
@details = client.get(@location)
|
|
49
|
+
end
|
|
43
50
|
|
|
51
|
+
private
|
|
52
|
+
def create_resources_from_links(link_rel, resource_class)
|
|
53
|
+
Util::LinkUtils.get_link_hrefs(details, link_rel).collect {|location| resource_class.new(location, client)}
|
|
44
54
|
end
|
|
45
55
|
|
|
46
56
|
end
|
data/lib/vas/shared/security.rb
CHANGED
|
@@ -36,14 +36,21 @@ module Shared
|
|
|
36
36
|
|
|
37
37
|
# @private
|
|
38
38
|
def initialize(location, client)
|
|
39
|
-
|
|
40
|
-
@
|
|
39
|
+
@location = location
|
|
40
|
+
@client = client
|
|
41
|
+
|
|
42
|
+
reload
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
public
|
|
46
|
+
|
|
47
|
+
# Reloads the security configuration from server
|
|
48
|
+
def reload
|
|
49
|
+
json = @client.get(location)
|
|
41
50
|
@owner = json["owner"]
|
|
42
51
|
@group = json["group"]
|
|
43
52
|
@permissions = json["permissions"]
|
|
44
53
|
end
|
|
45
|
-
|
|
46
|
-
public
|
|
47
54
|
|
|
48
55
|
# @return [String] a string representation of this security object
|
|
49
56
|
def to_s
|
|
@@ -40,7 +40,7 @@ module Shared
|
|
|
40
40
|
client.post(@state_location, { :status => 'STOPPED' })
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
# @return [String] the state of the resource
|
|
43
|
+
# @return [String] Retrieves the state of the resource from the server
|
|
44
44
|
def state
|
|
45
45
|
client.get(@state_location)['status']
|
|
46
46
|
end
|
|
@@ -0,0 +1,98 @@
|
|
|
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 agent instances.
|
|
20
|
+
class AgentInstances < Shared::MutableCollection
|
|
21
|
+
|
|
22
|
+
# @private
|
|
23
|
+
def initialize(location, client)
|
|
24
|
+
super(location, client, 'agent-group-instances', AgentInstance)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Creates a new agent instance
|
|
28
|
+
#
|
|
29
|
+
# @param installation [Installation] the installation to be used by the instance
|
|
30
|
+
# @param name [String] the name of the instance
|
|
31
|
+
# @param options [Hash] optional configuration for the instance
|
|
32
|
+
#
|
|
33
|
+
# @option options 'jvm-options' [String[]] The JVM options that are passed to the agents's JVM when it is started
|
|
34
|
+
|
|
35
|
+
# @return [AgentInstance] the new agent instance
|
|
36
|
+
def create(installation, name, options = {})
|
|
37
|
+
payload = { :installation => installation.location, :name => name }
|
|
38
|
+
|
|
39
|
+
if options.has_key? 'jvm-options'
|
|
40
|
+
payload['jvm-options'] = options['jvm-options']
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
super(payload, 'agent-group-instance')
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# An agent instance
|
|
49
|
+
class AgentInstance < Shared::Instance
|
|
50
|
+
|
|
51
|
+
# @return [String[]] The JVM options that are passed to the agent's JVM when it is started
|
|
52
|
+
attr_reader :jvm_options
|
|
53
|
+
|
|
54
|
+
# @private
|
|
55
|
+
def initialize(location, client)
|
|
56
|
+
super(location, client, Group, Installation, AgentLiveConfigurations, AgentPendingConfigurations, AgentNodeInstance, 'agent-node-instance')
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Reloads the agent instance's details from the server
|
|
60
|
+
# @return [void]
|
|
61
|
+
def reload
|
|
62
|
+
super
|
|
63
|
+
@jvm_options = details['jvm-options']
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Updates the instance using the supplied +options+
|
|
67
|
+
#
|
|
68
|
+
# @param options [Hash] optional configuration for the instance
|
|
69
|
+
#
|
|
70
|
+
# @option options :installation [String] The installation to be used by the instance. If omitted or +nil+, the
|
|
71
|
+
# configuration will not be changed.
|
|
72
|
+
# @option options 'jvm-options' [String[]] The JVM options that are passed to the agent's JVM when it is started.
|
|
73
|
+
# If omitted or +nil+, the configuration will not be changed
|
|
74
|
+
#
|
|
75
|
+
# @return [void]
|
|
76
|
+
def update(options = {})
|
|
77
|
+
payload = {}
|
|
78
|
+
|
|
79
|
+
if options.has_key? 'jvm-options'
|
|
80
|
+
payload['jvm-options'] = options['jvm-options']
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
if options.has_key? :installation
|
|
84
|
+
payload[:installation] = options[:installation].location
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
client.post(location, payload)
|
|
88
|
+
reload
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# @return [String] a string representation of the instance
|
|
92
|
+
def to_s
|
|
93
|
+
"#<#{self.class} name='#{name}' jvm_options='#@jvm_options'>"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
end
|