vas 0.3.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.
Files changed (87) hide show
  1. data/LICENSE +174 -0
  2. data/NOTICE +5 -0
  3. data/README.md +26 -0
  4. data/Rakefile +20 -0
  5. data/lib/vas.rb +103 -0
  6. data/lib/vas/gemfire/agent_configuration.rb +28 -0
  7. data/lib/vas/gemfire/agent_instances.rb +49 -0
  8. data/lib/vas/gemfire/agent_live_configurations.rb +29 -0
  9. data/lib/vas/gemfire/agent_logs.rb +38 -0
  10. data/lib/vas/gemfire/agent_node_instances.rb +38 -0
  11. data/lib/vas/gemfire/agent_pending_configurations.rb +38 -0
  12. data/lib/vas/gemfire/application_code.rb +54 -0
  13. data/lib/vas/gemfire/application_code_images.rb +76 -0
  14. data/lib/vas/gemfire/cache_server_configuration.rb +28 -0
  15. data/lib/vas/gemfire/cache_server_instances.rb +57 -0
  16. data/lib/vas/gemfire/cache_server_live_configurations.rb +29 -0
  17. data/lib/vas/gemfire/cache_server_logs.rb +38 -0
  18. data/lib/vas/gemfire/cache_server_node_instances.rb +46 -0
  19. data/lib/vas/gemfire/cache_server_pending_configurations.rb +38 -0
  20. data/lib/vas/gemfire/disk_stores.rb +63 -0
  21. data/lib/vas/gemfire/gemfire.rb +47 -0
  22. data/lib/vas/gemfire/groups.rb +50 -0
  23. data/lib/vas/gemfire/installation_images.rb +38 -0
  24. data/lib/vas/gemfire/installations.rb +53 -0
  25. data/lib/vas/gemfire/live_application_codes.rb +29 -0
  26. data/lib/vas/gemfire/locator_configuration.rb +28 -0
  27. data/lib/vas/gemfire/locator_instances.rb +109 -0
  28. data/lib/vas/gemfire/locator_live_configurations.rb +29 -0
  29. data/lib/vas/gemfire/locator_logs.rb +38 -0
  30. data/lib/vas/gemfire/locator_node_instances.rb +53 -0
  31. data/lib/vas/gemfire/locator_pending_configurations.rb +38 -0
  32. data/lib/vas/gemfire/nodes.rb +61 -0
  33. data/lib/vas/gemfire/pending_application_codes.rb +34 -0
  34. data/lib/vas/gemfire/statistics.rb +66 -0
  35. data/lib/vas/rabbitmq/configuration.rb +28 -0
  36. data/lib/vas/rabbitmq/groups.rb +42 -0
  37. data/lib/vas/rabbitmq/installation_images.rb +38 -0
  38. data/lib/vas/rabbitmq/installations.rb +43 -0
  39. data/lib/vas/rabbitmq/instances.rb +53 -0
  40. data/lib/vas/rabbitmq/live_configurations.rb +29 -0
  41. data/lib/vas/rabbitmq/logs.rb +38 -0
  42. data/lib/vas/rabbitmq/node_instances.rb +38 -0
  43. data/lib/vas/rabbitmq/nodes.rb +50 -0
  44. data/lib/vas/rabbitmq/pending_configurations.rb +38 -0
  45. data/lib/vas/rabbitmq/plugin_images.rb +67 -0
  46. data/lib/vas/rabbitmq/plugins.rb +85 -0
  47. data/lib/vas/rabbitmq/rabbitmq.rb +45 -0
  48. data/lib/vas/shared/collection.rb +46 -0
  49. data/lib/vas/shared/configuration.rb +59 -0
  50. data/lib/vas/shared/groups.rb +74 -0
  51. data/lib/vas/shared/installation_images.rb +62 -0
  52. data/lib/vas/shared/installations.rb +67 -0
  53. data/lib/vas/shared/instances.rb +74 -0
  54. data/lib/vas/shared/logs.rb +89 -0
  55. data/lib/vas/shared/mutable_collection.rb +27 -0
  56. data/lib/vas/shared/node_instances.rb +58 -0
  57. data/lib/vas/shared/nodes.rb +70 -0
  58. data/lib/vas/shared/pending_configuration.rb +40 -0
  59. data/lib/vas/shared/resource.rb +44 -0
  60. data/lib/vas/shared/security.rb +51 -0
  61. data/lib/vas/shared/state_resource.rb +44 -0
  62. data/lib/vas/tc_server/applications.rb +89 -0
  63. data/lib/vas/tc_server/configuration.rb +29 -0
  64. data/lib/vas/tc_server/groups.rb +42 -0
  65. data/lib/vas/tc_server/installation_images.rb +38 -0
  66. data/lib/vas/tc_server/installations.rb +54 -0
  67. data/lib/vas/tc_server/instances.rb +102 -0
  68. data/lib/vas/tc_server/live_configurations.rb +29 -0
  69. data/lib/vas/tc_server/logs.rb +38 -0
  70. data/lib/vas/tc_server/node_applications.rb +76 -0
  71. data/lib/vas/tc_server/node_instances.rb +55 -0
  72. data/lib/vas/tc_server/node_revisions.rb +55 -0
  73. data/lib/vas/tc_server/nodes.rb +50 -0
  74. data/lib/vas/tc_server/pending_configurations.rb +38 -0
  75. data/lib/vas/tc_server/revision_images.rb +67 -0
  76. data/lib/vas/tc_server/revisions.rb +71 -0
  77. data/lib/vas/tc_server/tc_server.rb +50 -0
  78. data/lib/vas/tc_server/template_images.rb +67 -0
  79. data/lib/vas/tc_server/templates.rb +70 -0
  80. data/lib/vas/util/client.rb +159 -0
  81. data/lib/vas/util/link_utils.rb +43 -0
  82. data/lib/vas/vas_exception.rb +32 -0
  83. data/lib/vas/vfabric/agent_image.rb +50 -0
  84. data/lib/vas/vfabric/nodes.rb +47 -0
  85. data/lib/vas/vfabric/v_fabric.rb +34 -0
  86. data/lib/vas/vfabric_administration_server.rb +50 -0
  87. metadata +213 -0
@@ -0,0 +1,27 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module Shared
19
+ class MutableCollection < Collection
20
+
21
+ # Deletes the item
22
+ def delete(entry)
23
+ client.delete(entry.location)
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,58 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module Shared
19
+
20
+ class NodeInstances < Shared::Collection
21
+
22
+ def initialize(location, client, type, entry_class) #:nodoc:
23
+ super(location, client, type, entry_class)
24
+ end
25
+
26
+ end
27
+
28
+ class NodeInstance < Shared::StateResource
29
+
30
+ # The instance's name
31
+ attr_reader :name
32
+
33
+ # The node that contains this instance
34
+ attr_reader :node
35
+
36
+ # The instance's Logs
37
+ attr_reader :logs
38
+
39
+ # The node instance's group instance
40
+ attr_reader :group_instance
41
+
42
+ def initialize(location, client, node_class, logs_class, group_instance_class, group_instance_type) #:nodoc:
43
+ super(location, client)
44
+
45
+ @name = details["name"]
46
+
47
+ @node = node_class.new(Util::LinkUtils.get_link_href(details, "node"), client)
48
+ @logs = logs_class.new(Util::LinkUtils.get_link_href(details, "logs"), client)
49
+ @group_instance = group_instance_class.new(Util::LinkUtils.get_link_href(details, group_instance_type), client)
50
+ end
51
+
52
+ def to_s #:nodoc:
53
+ "#<#{self.class} name='#@name'>"
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -0,0 +1,70 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module Shared
19
+
20
+ # A node
21
+ class Node < Shared::Resource
22
+
23
+ # The location of the vFabric Administration agent
24
+ attr_reader :agent_home
25
+
26
+ # The architecture of the node's operating system
27
+ attr_reader :architecture
28
+
29
+ # The node's host names
30
+ attr_reader :host_names
31
+
32
+ # The node's IP addresses
33
+ attr_reader :ip_addresses
34
+
35
+ # The node's metadata
36
+ attr_reader :metadata
37
+
38
+ # The node's operating system
39
+ attr_reader :operating_system
40
+
41
+ def initialize(location, client) #:nodoc:
42
+ super(location, client)
43
+
44
+ @agent_home = details["agent-home"]
45
+ @architecture = details["architecture"]
46
+ @host_names = details["host-names"]
47
+ @ip_addresses = details["ip-addresses"]
48
+ @metadata = details["metadata"]
49
+ @operating_system = details["operating-system"]
50
+ end
51
+
52
+ end
53
+
54
+ class GroupableNode < Node
55
+
56
+ def initialize(location, client, group_class)
57
+ super(location, client)
58
+ @group_class = group_class
59
+ end
60
+
61
+ # An array of the groups which contain this node
62
+ def groups
63
+ groups = []
64
+ Util::LinkUtils.get_link_hrefs(client.get(location), 'group').each {
65
+ |group_location| groups << @group_class.new(group_location, client)}
66
+ groups
67
+ end
68
+ end
69
+
70
+ end
@@ -0,0 +1,40 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module Shared
19
+
20
+ class PendingConfigurations < MutableCollection
21
+
22
+ # Creates a configuration with the given +path+ in the instance and the given +content+
23
+ def create(path, content)
24
+ entry_class.new(client.post_image(location, content, { :path => path }), client)
25
+ end
26
+
27
+ end
28
+
29
+ # A configuration file that is pending and will be made live the next time its instance is started
30
+ class PendingConfiguration < Configuration
31
+
32
+ # Updates the configuration to contain +new_content+
33
+ def content=(new_content)
34
+ client.post(content_location, new_content)
35
+ @size = client.get(location)['size']
36
+ end
37
+
38
+ end
39
+
40
+ end
@@ -0,0 +1,44 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module Shared
19
+
20
+ class Resource
21
+
22
+ attr_reader :location #:nodoc:
23
+
24
+ # The Resource's Security
25
+ attr_reader :security
26
+
27
+ private
28
+ attr_reader :client
29
+
30
+ attr_reader :details
31
+
32
+ def initialize(location, client) #:nodoc:
33
+ @location = location
34
+ @client = client
35
+
36
+ @details = client.get(location)
37
+
38
+ @security = Security.new(Util::LinkUtils.get_link_href(@details, 'security'), client)
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,51 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module Shared
19
+
20
+ # The security configuration for a resource
21
+ class Security
22
+
23
+ # The permissions of the resource
24
+ attr_reader :permissions
25
+
26
+ # The owner of the resource
27
+ attr_reader :owner
28
+
29
+ # The group of the resource
30
+ attr_reader :group
31
+
32
+ attr_reader :location #:nodoc:
33
+
34
+ private
35
+ attr_reader :client
36
+
37
+ def initialize(location, client) #:nodoc:
38
+ json = client.get(location)
39
+ @location = location;
40
+ @owner = json["owner"]
41
+ @group = json["group"]
42
+ @permissions = json["permissions"]
43
+ end
44
+
45
+ def to_s #:nodoc:
46
+ "#<#{self.class} owner='#@owner' group='#@group' permissions='#@permissions'>"
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,44 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module Shared
19
+
20
+ class StateResource < Resource
21
+
22
+ def initialize(location, client) #:nodoc:
23
+ super(location, client)
24
+ @state_location = Util::LinkUtils.get_link_href(details, 'state')
25
+ end
26
+
27
+ # Starts the resource
28
+ def start
29
+ client.post(@state_location, { :status => 'STARTED' })
30
+ end
31
+
32
+ # Stops the resource
33
+ def stop
34
+ client.post(@state_location, { :status => 'STOPPED' })
35
+ end
36
+
37
+ # The state of the resource
38
+ def state
39
+ client.get(@state_location)['status']
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,89 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module TcServer
19
+
20
+ # Used to enumerate, create, and delete applications.
21
+ class Applications < Shared::MutableCollection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "applications", Application)
25
+ end
26
+
27
+ # Creates an Application named +name+ with the given +context_path+. The application will deploy its revisions to the given
28
+ # +service+ and +host+.
29
+ def create(name, context_path, service, host)
30
+ Application.new(client.post(location, {"context-path" => context_path, :name => name, :host => host, :service => service}, "group-application"), client)
31
+ end
32
+
33
+ private
34
+ def create_entry(json)
35
+ Application.new(Util::LinkUtils.get_self_link_href(json), client)
36
+ end
37
+ end
38
+
39
+ # An application
40
+ class Application < Shared::Resource
41
+
42
+ # The application's context path
43
+ attr_reader :context_path
44
+
45
+ # The application's name
46
+ attr_reader :name
47
+
48
+ # The service the application will deploy its revisions to
49
+ attr_reader :service
50
+
51
+ # The host the application will deploy its revisions to
52
+ attr_reader :host
53
+
54
+ # The application's Revisions
55
+ attr_reader :revisions
56
+
57
+ def initialize(location, client) #:nodoc:
58
+ super(location, client)
59
+
60
+ @revisions = Revisions.new(Util::LinkUtils.get_link_href(details, "group-revisions"), client)
61
+
62
+ @context_path = details["context-path"]
63
+ @name = details["name"]
64
+ @service = details["service"]
65
+ @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)
73
+ end
74
+
75
+ # An array of the application's individual node applications
76
+ def node_applications
77
+ node_applications = []
78
+ Util::LinkUtils.get_link_hrefs(client.get(location), 'node-application').each {
79
+ |node_application_location| node_applications << NodeApplication.new(node_application_location, client)}
80
+ node_applications
81
+ end
82
+
83
+ def to_s #:nodoc:
84
+ "#<#{self.class} name='#@name' context_path='#@context_path' service='#@service' host='#@host'>"
85
+ end
86
+
87
+ end
88
+
89
+ end
@@ -0,0 +1,29 @@
1
+ #--
2
+ # vFabric Administration Server Ruby API
3
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ module TcServer
19
+
20
+ # A configuration file in a tc Server instance
21
+ class Configuration < Shared::Configuration
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "group-instance", Instance)
25
+ end
26
+
27
+ end
28
+
29
+ end