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,53 @@
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 RabbitMq
19
+
20
+ # Used to enumerate, create, and delete Rabbit instances.
21
+ class Instances < Shared::MutableCollection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "group-instances", Instance)
25
+ end
26
+
27
+ # Creates a new instance named +name+, using the installation +installation+.
28
+ def create(installation, name)
29
+ payload = { :installation => installation.location, :name => name }
30
+ Instance.new(client.post(location, payload, "group-instance"), client)
31
+ end
32
+
33
+ end
34
+
35
+ # A Rabbit instance
36
+ class Instance < Shared::Instance
37
+
38
+ # The instance's plugins
39
+ attr_reader :plugins
40
+
41
+ def initialize(location, client) #:nodoc:
42
+ super(location, client, Group, Installation, LiveConfigurations, PendingConfigurations, NodeInstance, 'node-instance')
43
+ @plugins = Plugins.new(Util::LinkUtils.get_link_href(details, "plugins"), client)
44
+ end
45
+
46
+ # Updates the instance to use the given +installation+
47
+ def update(installation, runtime_version = nil)
48
+ client.post(location, { :installation => installation.location });
49
+ end
50
+
51
+ end
52
+
53
+ 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 RabbitMq
19
+
20
+ # Used to enumerate an instance's live configuration
21
+ class LiveConfigurations < Shared::Collection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "live-configurations", Configuration)
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,38 @@
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 RabbitMq
19
+
20
+ # Used to enumerate a tRabbit instance's logs
21
+ class Logs < Shared::Logs
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, Log)
25
+ end
26
+
27
+ end
28
+
29
+ # A log file in a Rabbit node instance
30
+ class Log < Shared::Log
31
+
32
+ def initialize(location, client) #:nodoc:
33
+ super(location, client, 'node-instance', NodeInstance)
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,38 @@
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 RabbitMq
19
+
20
+ # Used to enumerate Rabbit instances on an individual node
21
+ class NodeInstances < Shared::NodeInstances
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "node-instances", NodeInstance)
25
+ end
26
+
27
+ end
28
+
29
+ # A Rabbit node instance
30
+ class NodeInstance < Shared::NodeInstance
31
+
32
+ def initialize(location, client) #:nodoc:
33
+ super(location, client, Node, Logs, Instance, 'group-instance')
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,50 @@
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 RabbitMq
19
+
20
+ # Used to enumerate Rabbit nodes
21
+ class Nodes < Shared::Collection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "nodes", Node)
25
+ end
26
+
27
+ end
28
+
29
+ # A Rabbit node
30
+ class Node < Shared::GroupableNode
31
+
32
+ # The Node's Java home
33
+ attr_reader :java_home
34
+
35
+ def initialize(location, client) #:nodoc:
36
+ super(location, client, Group)
37
+ @java_home = details["java-home"]
38
+ end
39
+
40
+ def instances
41
+ @instances = NodeInstances.new(Util::LinkUtils.get_link_href(details, "node-instances"), client)
42
+ end
43
+
44
+ def to_s #:nodoc:
45
+ "#<#{self.class} host_names='#{host_names}' ip_addresses='#{ip_addresses}' operating_system='#{operating_system}' architecture='#{architecture}' agent_home='#{agent_home}' java_home='#{java_home}' metadata='#{metadata}'>"
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,38 @@
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 RabbitMq
19
+
20
+ # Used to enumerate an instance's pending configuration
21
+ class PendingConfigurations < Shared::PendingConfigurations
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, 'pending-configurations', PendingConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A configuration file that is pending
30
+ class PendingConfiguration < Shared::PendingConfiguration
31
+
32
+ def initialize(location, client) #:nodoc:
33
+ super(location, client, 'group-instance', Instance)
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,67 @@
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 RabbitMq
19
+
20
+ # Used to enumerate, create, and delete Rabbit plugin images
21
+ class PluginImages < Shared::MutableCollection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "plugin-images", PluginImage)
25
+ end
26
+
27
+ # Creates a plugin image by uploading the file at the given +path+
28
+ def create(path)
29
+ PluginImage.new(client.post_image(location, path), client)
30
+ end
31
+
32
+ end
33
+
34
+ # A plugin image
35
+ class PluginImage < Shared::Resource
36
+
37
+ # The plugin image's name
38
+ attr_reader :name
39
+
40
+ # The plugin image's version
41
+ attr_reader :version
42
+
43
+ # The plugin image's size
44
+ attr_reader :size
45
+
46
+ def initialize(location, client) #:nodoc:
47
+ super(location, client)
48
+
49
+ @name = details["name"]
50
+ @version = details["version"]
51
+ @size = details['size']
52
+ end
53
+
54
+ # The plugins that have been created from this plugin image
55
+ def plugins
56
+ plugins = []
57
+ Util::LinkUtils.get_link_hrefs(client.get(location), "plugin").each { |plugin_location| plugins << Plugin.new(plugin_location, client)}
58
+ plugins
59
+ end
60
+
61
+ def to_s #:nodoc:
62
+ "#<#{self.class} name='#@name' version='#@version'>"
63
+ end
64
+
65
+ end
66
+
67
+ end
@@ -0,0 +1,85 @@
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 RabbitMq
19
+
20
+ # Used to enumerate, create, and delete plugins.
21
+ class Plugins < Shared::MutableCollection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "plugins", Plugin)
25
+ end
26
+
27
+ # Creates a plugin from the +plugin_image+
28
+ def create(plugin_image)
29
+ Plugin.new(client.post(location, { :image => plugin_image.location}, 'plugin'), client)
30
+ end
31
+
32
+ end
33
+
34
+ # A plugin in a Rabbit instance
35
+ class Plugin < Shared::Resource
36
+
37
+ # The plugin's version
38
+ attr_reader :version
39
+
40
+ # The plugin's name
41
+ attr_reader :name
42
+
43
+ def initialize(location, client) #:nodoc:
44
+ super(location, client)
45
+
46
+ @name = details['name']
47
+ @version = details['version']
48
+ @plugin_image_location = Util::LinkUtils.get_link_href(details, 'plugin-image')
49
+ @instance_location = Util::LinkUtils.get_link_href(details, 'group-instance')
50
+ @state_location = Util::LinkUtils.get_link_href(details, 'state')
51
+ end
52
+
53
+ # The plugin image, if any, that was used to create the plugin
54
+ def plugin_image
55
+ if (!@plugin_image_location.nil?)
56
+ PluginImage.new(@plugin_image_location, client)
57
+ end
58
+ end
59
+
60
+ # The instance that contains the plugin
61
+ def instance
62
+ Instance.new(@instance_location, client)
63
+ end
64
+
65
+ # The state of the plugin
66
+ def state
67
+ client.get(@state_location)['status']
68
+ end
69
+
70
+ # Enables the plugin
71
+ def enable
72
+ client.post(@state_location, { :status => 'ENABLED' })
73
+ end
74
+
75
+ # Disables the plugin
76
+ def disable
77
+ client.post(@state_location, { :status => 'DISABLED' })
78
+ end
79
+
80
+ def to_s #:nodoc:
81
+ "#<#{self.class} name='#@name' version='#@version'>"
82
+ end
83
+ end
84
+
85
+ end
@@ -0,0 +1,45 @@
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 RabbitMq
19
+
20
+ class RabbitMq
21
+ # The Rabbit groups
22
+ attr_reader :groups
23
+
24
+ # The Rabbit installation images
25
+ attr_reader :installation_images
26
+
27
+ # The Rabbit plugin images
28
+ attr_reader :plugin_images
29
+
30
+ # The Rabbit nodes
31
+ attr_reader :nodes
32
+
33
+ def initialize(location, client) #:nodoc:
34
+
35
+ json = client.get(location)
36
+
37
+ @groups = Groups.new(Util::LinkUtils.get_link_href(json, "groups"), client)
38
+ @installation_images = InstallationImages.new(Util::LinkUtils.get_link_href(json, "installation-images"), client)
39
+ @plugin_images = PluginImages.new(Util::LinkUtils.get_link_href(json, "plugin-images"), client)
40
+ @nodes = Nodes.new(Util::LinkUtils.get_link_href(json, "nodes"), client)
41
+ end
42
+
43
+ end
44
+
45
+ end