vas 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +25 -5
- data/lib/vas.rb +2 -7
- data/lib/vas/gemfire/agent_instances.rb +16 -6
- data/lib/vas/gemfire/agent_live_configurations.rb +14 -4
- data/lib/vas/gemfire/agent_logs.rb +5 -4
- data/lib/vas/gemfire/agent_node_instances.rb +5 -4
- data/lib/vas/gemfire/agent_pending_configurations.rb +5 -4
- data/lib/vas/gemfire/application_code.rb +7 -6
- data/lib/vas/gemfire/application_code_images.rb +19 -11
- data/lib/vas/gemfire/cache_server_instances.rb +18 -8
- data/lib/vas/gemfire/cache_server_live_configurations.rb +14 -4
- data/lib/vas/gemfire/cache_server_logs.rb +5 -4
- data/lib/vas/gemfire/cache_server_node_instances.rb +7 -6
- data/lib/vas/gemfire/cache_server_pending_configurations.rb +6 -5
- data/lib/vas/gemfire/disk_stores.rb +23 -13
- data/lib/vas/gemfire/gemfire.rb +8 -7
- data/lib/vas/gemfire/groups.rb +9 -8
- data/lib/vas/gemfire/installation_images.rb +5 -4
- data/lib/vas/gemfire/installations.rb +11 -10
- data/lib/vas/gemfire/live_application_codes.rb +3 -3
- data/lib/vas/gemfire/locator_instances.rb +25 -20
- data/lib/vas/gemfire/locator_live_configurations.rb +14 -4
- data/lib/vas/gemfire/locator_logs.rb +5 -4
- data/lib/vas/gemfire/locator_node_instances.rb +7 -6
- data/lib/vas/gemfire/locator_pending_configurations.rb +6 -5
- data/lib/vas/gemfire/nodes.rb +20 -21
- data/lib/vas/gemfire/pending_application_codes.rb +8 -4
- data/lib/vas/gemfire/statistics.rb +21 -13
- data/lib/vas/rabbitmq/groups.rb +8 -7
- data/lib/vas/rabbitmq/installation_images.rb +7 -6
- data/lib/vas/rabbitmq/installations.rb +8 -7
- data/lib/vas/rabbitmq/instances.rb +20 -10
- data/lib/vas/rabbitmq/live_configurations.rb +15 -5
- data/lib/vas/rabbitmq/logs.rb +7 -6
- data/lib/vas/rabbitmq/node_instances.rb +7 -6
- data/lib/vas/rabbitmq/nodes.rb +13 -15
- data/lib/vas/rabbitmq/pending_configurations.rb +7 -6
- data/lib/vas/rabbitmq/plugin_images.rb +14 -8
- data/lib/vas/rabbitmq/plugins.rb +24 -23
- data/lib/vas/rabbitmq/rabbitmq.rb +10 -7
- data/lib/vas/shared/collection.rb +12 -6
- data/lib/vas/shared/configuration.rb +16 -8
- data/lib/vas/shared/groups.rb +28 -10
- data/lib/vas/shared/installation_images.rb +20 -8
- data/lib/vas/shared/installations.rb +23 -12
- data/lib/vas/shared/{instances.rb → instance.rb} +11 -12
- data/lib/vas/shared/logs.rb +30 -21
- data/lib/vas/shared/mutable_collection.rb +5 -3
- data/lib/vas/shared/node_instances.rb +12 -7
- data/lib/vas/shared/nodes.rb +14 -12
- data/lib/vas/shared/pending_configuration.rb +12 -5
- data/lib/vas/shared/resource.rb +10 -6
- data/lib/vas/shared/security.rb +15 -11
- data/lib/vas/shared/state_resource.rb +12 -6
- data/lib/vas/tc_server/applications.rb +24 -21
- data/lib/vas/tc_server/configuration.rb +3 -3
- data/lib/vas/tc_server/groups.rb +7 -6
- data/lib/vas/tc_server/installation_images.rb +5 -4
- data/lib/vas/tc_server/installations.rb +11 -12
- data/lib/vas/tc_server/instances.rb +28 -20
- data/lib/vas/tc_server/live_configurations.rb +3 -3
- data/lib/vas/tc_server/logs.rb +1 -2
- data/lib/vas/tc_server/node_applications.rb +19 -19
- data/lib/vas/tc_server/node_instances.rb +9 -8
- data/lib/vas/tc_server/node_revisions.rb +12 -10
- data/lib/vas/tc_server/nodes.rb +11 -9
- data/lib/vas/tc_server/pending_configurations.rb +5 -4
- data/lib/vas/tc_server/revision_images.rb +19 -11
- data/lib/vas/tc_server/revisions.rb +22 -18
- data/lib/vas/tc_server/tc_server.rb +9 -8
- data/lib/vas/tc_server/template_images.rb +19 -11
- data/lib/vas/tc_server/templates.rb +19 -17
- data/lib/vas/util/client.rb +4 -3
- data/lib/vas/util/link_utils.rb +4 -3
- data/lib/vas/vas_exception.rb +6 -6
- data/lib/vas/vfabric/agent_image.rb +14 -3
- data/lib/vas/vfabric/nodes.rb +16 -10
- data/lib/vas/vfabric/v_fabric.rb +6 -3
- data/lib/vas/vfabric_administration_server.rb +11 -11
- metadata +13 -17
- data/lib/vas/gemfire/agent_configuration.rb +0 -28
- data/lib/vas/gemfire/cache_server_configuration.rb +0 -28
- data/lib/vas/gemfire/locator_configuration.rb +0 -28
- data/lib/vas/rabbitmq/configuration.rb +0 -28
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,12 +12,15 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module Shared
|
18
|
+
|
19
|
+
# @abstract A collection that allows items to be deleted from it
|
19
20
|
class MutableCollection < Collection
|
20
21
|
|
21
|
-
# Deletes the item
|
22
|
+
# Deletes the item from the collection
|
23
|
+
# @return [void]
|
22
24
|
def delete(entry)
|
23
25
|
client.delete(entry.location)
|
24
26
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,32 +12,37 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module Shared
|
19
18
|
|
19
|
+
# @abstract A collection of node instances
|
20
20
|
class NodeInstances < Shared::Collection
|
21
21
|
|
22
|
-
|
22
|
+
private
|
23
|
+
|
24
|
+
def initialize(location, client, type, entry_class)
|
23
25
|
super(location, client, type, entry_class)
|
24
26
|
end
|
25
27
|
|
26
28
|
end
|
27
29
|
|
30
|
+
# @abstract A node instance, i.e. an instance on an individual node
|
28
31
|
class NodeInstance < Shared::StateResource
|
29
32
|
|
30
|
-
#
|
33
|
+
# @return [String] the instance's name
|
31
34
|
attr_reader :name
|
32
35
|
|
33
|
-
#
|
36
|
+
# @return [GroupableNode] the node that contains this instance
|
34
37
|
attr_reader :node
|
35
38
|
|
36
|
-
#
|
39
|
+
# @return [Logs] the instance's Logs
|
37
40
|
attr_reader :logs
|
38
41
|
|
39
|
-
#
|
42
|
+
# @return [Instance] the node instance's group instance
|
40
43
|
attr_reader :group_instance
|
41
44
|
|
45
|
+
# @private
|
42
46
|
def initialize(location, client, node_class, logs_class, group_instance_class, group_instance_type) #:nodoc:
|
43
47
|
super(location, client)
|
44
48
|
|
@@ -49,6 +53,7 @@ module Shared
|
|
49
53
|
@group_instance = group_instance_class.new(Util::LinkUtils.get_link_href(details, group_instance_type), client)
|
50
54
|
end
|
51
55
|
|
56
|
+
# @return [String] a string representation of the node instance
|
52
57
|
def to_s #:nodoc:
|
53
58
|
"#<#{self.class} name='#@name'>"
|
54
59
|
end
|
data/lib/vas/shared/nodes.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,32 +12,33 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module Shared
|
19
18
|
|
20
|
-
# A node
|
19
|
+
# @abstract A node, i.e. a machine with the vFabric Administration agent installed on it
|
21
20
|
class Node < Shared::Resource
|
22
21
|
|
23
|
-
#
|
22
|
+
# @return [String] the location of the vFabric Administration agent
|
24
23
|
attr_reader :agent_home
|
25
24
|
|
26
|
-
#
|
25
|
+
# @return [String] the architecture of the node's operating system
|
27
26
|
attr_reader :architecture
|
28
27
|
|
29
|
-
#
|
28
|
+
# @return [String] the node's host names
|
30
29
|
attr_reader :host_names
|
31
30
|
|
32
|
-
#
|
31
|
+
# @return [String[]] the node's IP addresses
|
33
32
|
attr_reader :ip_addresses
|
34
33
|
|
35
|
-
#
|
34
|
+
# @return [Hash] the node's metadata
|
36
35
|
attr_reader :metadata
|
37
36
|
|
38
|
-
#
|
37
|
+
# @return [String] the node's operating system
|
39
38
|
attr_reader :operating_system
|
40
39
|
|
41
|
-
|
40
|
+
# @private
|
41
|
+
def initialize(location, client)
|
42
42
|
super(location, client)
|
43
43
|
|
44
44
|
@agent_home = details["agent-home"]
|
@@ -51,14 +51,16 @@ module Shared
|
|
51
51
|
|
52
52
|
end
|
53
53
|
|
54
|
+
# @abstract A node that can be grouped
|
54
55
|
class GroupableNode < Node
|
55
|
-
|
56
|
+
|
57
|
+
# @private
|
56
58
|
def initialize(location, client, group_class)
|
57
59
|
super(location, client)
|
58
60
|
@group_class = group_class
|
59
61
|
end
|
60
62
|
|
61
|
-
#
|
63
|
+
# @return [Group[]] the groups that contain this node
|
62
64
|
def groups
|
63
65
|
groups = []
|
64
66
|
Util::LinkUtils.get_link_hrefs(client.get(location), 'group').each {
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,23 +12,31 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module Shared
|
19
18
|
|
19
|
+
# @abstract A collection of an instance's pending configurations
|
20
20
|
class PendingConfigurations < MutableCollection
|
21
21
|
|
22
|
-
# Creates a configuration
|
22
|
+
# Creates a new configuration. The configuration will be pending until its instance is started at which point the configuration will become live
|
23
|
+
#
|
24
|
+
# @param path [String] the configuration's path
|
25
|
+
# @param content [String] the configuration's content
|
26
|
+
#
|
27
|
+
# @return [PendingConfiguration] the new configuration
|
23
28
|
def create(path, content)
|
24
29
|
entry_class.new(client.post_image(location, content, { :path => path }), client)
|
25
30
|
end
|
26
31
|
|
27
32
|
end
|
28
33
|
|
29
|
-
# A configuration file that is pending and will be made live the next time its instance is started
|
34
|
+
# @abstract A configuration file that is pending and will be made live the next time its instance is started
|
30
35
|
class PendingConfiguration < Configuration
|
31
36
|
|
32
|
-
# Updates the
|
37
|
+
# Updates the contents of the configuration
|
38
|
+
#
|
39
|
+
# @param new_content [String] the new content
|
33
40
|
def content=(new_content)
|
34
41
|
client.post(content_location, new_content)
|
35
42
|
@size = client.get(location)['size']
|
data/lib/vas/shared/resource.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,23 +12,28 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module Shared
|
19
18
|
|
19
|
+
# @abstract The base of all types that interact with the REST API. A resource should map to a
|
20
|
+
# specific URI in the REST API
|
20
21
|
class Resource
|
21
22
|
|
22
|
-
|
23
|
+
# @private
|
24
|
+
attr_reader :location
|
23
25
|
|
24
|
-
#
|
26
|
+
# @return [Security] the resource's security
|
25
27
|
attr_reader :security
|
26
|
-
|
28
|
+
|
27
29
|
private
|
30
|
+
|
28
31
|
attr_reader :client
|
29
32
|
|
30
33
|
attr_reader :details
|
31
34
|
|
32
|
-
|
35
|
+
# @private
|
36
|
+
def initialize(location, client)
|
33
37
|
@location = location
|
34
38
|
@client = client
|
35
39
|
|
data/lib/vas/shared/security.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,36 +12,41 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module Shared
|
19
18
|
|
20
19
|
# The security configuration for a resource
|
21
20
|
class Security
|
22
21
|
|
23
|
-
# The permissions of the resource
|
22
|
+
# @return [Hash] The permissions of the resource
|
24
23
|
attr_reader :permissions
|
25
24
|
|
26
|
-
#
|
25
|
+
# @return [String] the owner of the resource
|
27
26
|
attr_reader :owner
|
28
27
|
|
29
|
-
#
|
28
|
+
# @return [String] the group of the resource
|
30
29
|
attr_reader :group
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
|
31
|
+
# @private
|
32
|
+
attr_reader :location
|
33
|
+
|
34
34
|
private
|
35
35
|
attr_reader :client
|
36
36
|
|
37
|
-
|
37
|
+
# @private
|
38
|
+
def initialize(location, client)
|
38
39
|
json = client.get(location)
|
39
40
|
@location = location;
|
40
41
|
@owner = json["owner"]
|
41
42
|
@group = json["group"]
|
42
43
|
@permissions = json["permissions"]
|
43
44
|
end
|
44
|
-
|
45
|
-
|
45
|
+
|
46
|
+
public
|
47
|
+
|
48
|
+
# @return [String] a string representation of this security object
|
49
|
+
def to_s
|
46
50
|
"#<#{self.class} owner='#@owner' group='#@group' permissions='#@permissions'>"
|
47
51
|
end
|
48
52
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,28 +12,35 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module Shared
|
19
18
|
|
19
|
+
# @abstract A resource that has state, i.e. it can be started and stopped and its state can
|
20
|
+
# be queried
|
20
21
|
class StateResource < Resource
|
21
|
-
|
22
|
-
|
22
|
+
|
23
|
+
# @private
|
24
|
+
def initialize(location, client)
|
23
25
|
super(location, client)
|
24
26
|
@state_location = Util::LinkUtils.get_link_href(details, 'state')
|
25
27
|
end
|
26
28
|
|
27
29
|
# Starts the resource
|
30
|
+
#
|
31
|
+
# @return [void]
|
28
32
|
def start
|
29
33
|
client.post(@state_location, { :status => 'STARTED' })
|
30
34
|
end
|
31
|
-
|
35
|
+
|
32
36
|
# Stops the resource
|
37
|
+
#
|
38
|
+
# @return [void]
|
33
39
|
def stop
|
34
40
|
client.post(@state_location, { :status => 'STOPPED' })
|
35
41
|
end
|
36
42
|
|
37
|
-
#
|
43
|
+
# @return [String] the state of the resource
|
38
44
|
def state
|
39
45
|
client.get(@state_location)['status']
|
40
46
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,19 +12,25 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module TcServer
|
19
18
|
|
20
|
-
# Used to enumerate, create, and delete applications
|
19
|
+
# Used to enumerate, create, and delete applications
|
21
20
|
class Applications < Shared::MutableCollection
|
22
21
|
|
23
22
|
def initialize(location, client) #:nodoc:
|
24
23
|
super(location, client, "applications", Application)
|
25
24
|
end
|
26
25
|
|
27
|
-
# Creates an
|
28
|
-
#
|
26
|
+
# Creates an new application
|
27
|
+
#
|
28
|
+
# @param name [String] the name of the application
|
29
|
+
# @param context_path [String] the context path of the application
|
30
|
+
# @param service [String] the service that the application will deploy its revisions to
|
31
|
+
# @param host [String] the host that the application will deploy its revisions to
|
32
|
+
#
|
33
|
+
# @return [Application] the new application
|
29
34
|
def create(name, context_path, service, host)
|
30
35
|
Application.new(client.post(location, {"context-path" => context_path, :name => name, :host => host, :service => service}, "group-application"), client)
|
31
36
|
end
|
@@ -39,40 +44,37 @@ module TcServer
|
|
39
44
|
# An application
|
40
45
|
class Application < Shared::Resource
|
41
46
|
|
42
|
-
#
|
47
|
+
# @return [String] the application's context path
|
43
48
|
attr_reader :context_path
|
44
49
|
|
45
|
-
#
|
50
|
+
# @return [String] the application's name
|
46
51
|
attr_reader :name
|
47
52
|
|
48
|
-
#
|
53
|
+
# @return [String] the service the application will deploy its revisions to
|
49
54
|
attr_reader :service
|
50
55
|
|
51
|
-
#
|
56
|
+
# @return [String] the host the application will deploy its revisions to
|
52
57
|
attr_reader :host
|
53
58
|
|
54
|
-
#
|
59
|
+
# @return [Revisions] the application's revisions
|
55
60
|
attr_reader :revisions
|
61
|
+
|
62
|
+
# @return [Instance] the instance that contains the application
|
63
|
+
attr_reader :instance
|
56
64
|
|
57
|
-
|
65
|
+
# @private
|
66
|
+
def initialize(location, client)
|
58
67
|
super(location, client)
|
59
68
|
|
60
69
|
@revisions = Revisions.new(Util::LinkUtils.get_link_href(details, "group-revisions"), client)
|
61
|
-
|
62
70
|
@context_path = details["context-path"]
|
63
71
|
@name = details["name"]
|
64
72
|
@service = details["service"]
|
65
73
|
@host = details["host"]
|
66
|
-
|
67
|
-
@instance_location = Util::LinkUtils.get_link_href(details, "group-instance")
|
68
|
-
end
|
69
|
-
|
70
|
-
# The instance that contains the application
|
71
|
-
def instance
|
72
|
-
Instance.new(@instance_location, client)
|
74
|
+
@instance = Instance.new(Util::LinkUtils.get_link_href(details, "group-instance"), client)
|
73
75
|
end
|
74
76
|
|
75
|
-
#
|
77
|
+
# @return [NodeApplication[]] the application's individual node applications
|
76
78
|
def node_applications
|
77
79
|
node_applications = []
|
78
80
|
Util::LinkUtils.get_link_hrefs(client.get(location), 'node-application').each {
|
@@ -80,7 +82,8 @@ module TcServer
|
|
80
82
|
node_applications
|
81
83
|
end
|
82
84
|
|
83
|
-
|
85
|
+
# @return [String] a string representation of the application
|
86
|
+
def to_s
|
84
87
|
"#<#{self.class} name='#@name' context_path='#@context_path' service='#@service' host='#@host'>"
|
85
88
|
end
|
86
89
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# vFabric Administration Server Ruby API
|
3
2
|
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
4
3
|
#
|
@@ -13,14 +12,15 @@
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
13
|
# See the License for the specific language governing permissions and
|
15
14
|
# limitations under the License.
|
16
|
-
|
15
|
+
|
17
16
|
|
18
17
|
module TcServer
|
19
18
|
|
20
19
|
# A configuration file in a tc Server instance
|
21
20
|
class Configuration < Shared::Configuration
|
22
21
|
|
23
|
-
|
22
|
+
# @private
|
23
|
+
def initialize(location, client)
|
24
24
|
super(location, client, "group-instance", Instance)
|
25
25
|
end
|
26
26
|
|