vas 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/README.md +25 -5
  2. data/lib/vas.rb +2 -7
  3. data/lib/vas/gemfire/agent_instances.rb +16 -6
  4. data/lib/vas/gemfire/agent_live_configurations.rb +14 -4
  5. data/lib/vas/gemfire/agent_logs.rb +5 -4
  6. data/lib/vas/gemfire/agent_node_instances.rb +5 -4
  7. data/lib/vas/gemfire/agent_pending_configurations.rb +5 -4
  8. data/lib/vas/gemfire/application_code.rb +7 -6
  9. data/lib/vas/gemfire/application_code_images.rb +19 -11
  10. data/lib/vas/gemfire/cache_server_instances.rb +18 -8
  11. data/lib/vas/gemfire/cache_server_live_configurations.rb +14 -4
  12. data/lib/vas/gemfire/cache_server_logs.rb +5 -4
  13. data/lib/vas/gemfire/cache_server_node_instances.rb +7 -6
  14. data/lib/vas/gemfire/cache_server_pending_configurations.rb +6 -5
  15. data/lib/vas/gemfire/disk_stores.rb +23 -13
  16. data/lib/vas/gemfire/gemfire.rb +8 -7
  17. data/lib/vas/gemfire/groups.rb +9 -8
  18. data/lib/vas/gemfire/installation_images.rb +5 -4
  19. data/lib/vas/gemfire/installations.rb +11 -10
  20. data/lib/vas/gemfire/live_application_codes.rb +3 -3
  21. data/lib/vas/gemfire/locator_instances.rb +25 -20
  22. data/lib/vas/gemfire/locator_live_configurations.rb +14 -4
  23. data/lib/vas/gemfire/locator_logs.rb +5 -4
  24. data/lib/vas/gemfire/locator_node_instances.rb +7 -6
  25. data/lib/vas/gemfire/locator_pending_configurations.rb +6 -5
  26. data/lib/vas/gemfire/nodes.rb +20 -21
  27. data/lib/vas/gemfire/pending_application_codes.rb +8 -4
  28. data/lib/vas/gemfire/statistics.rb +21 -13
  29. data/lib/vas/rabbitmq/groups.rb +8 -7
  30. data/lib/vas/rabbitmq/installation_images.rb +7 -6
  31. data/lib/vas/rabbitmq/installations.rb +8 -7
  32. data/lib/vas/rabbitmq/instances.rb +20 -10
  33. data/lib/vas/rabbitmq/live_configurations.rb +15 -5
  34. data/lib/vas/rabbitmq/logs.rb +7 -6
  35. data/lib/vas/rabbitmq/node_instances.rb +7 -6
  36. data/lib/vas/rabbitmq/nodes.rb +13 -15
  37. data/lib/vas/rabbitmq/pending_configurations.rb +7 -6
  38. data/lib/vas/rabbitmq/plugin_images.rb +14 -8
  39. data/lib/vas/rabbitmq/plugins.rb +24 -23
  40. data/lib/vas/rabbitmq/rabbitmq.rb +10 -7
  41. data/lib/vas/shared/collection.rb +12 -6
  42. data/lib/vas/shared/configuration.rb +16 -8
  43. data/lib/vas/shared/groups.rb +28 -10
  44. data/lib/vas/shared/installation_images.rb +20 -8
  45. data/lib/vas/shared/installations.rb +23 -12
  46. data/lib/vas/shared/{instances.rb → instance.rb} +11 -12
  47. data/lib/vas/shared/logs.rb +30 -21
  48. data/lib/vas/shared/mutable_collection.rb +5 -3
  49. data/lib/vas/shared/node_instances.rb +12 -7
  50. data/lib/vas/shared/nodes.rb +14 -12
  51. data/lib/vas/shared/pending_configuration.rb +12 -5
  52. data/lib/vas/shared/resource.rb +10 -6
  53. data/lib/vas/shared/security.rb +15 -11
  54. data/lib/vas/shared/state_resource.rb +12 -6
  55. data/lib/vas/tc_server/applications.rb +24 -21
  56. data/lib/vas/tc_server/configuration.rb +3 -3
  57. data/lib/vas/tc_server/groups.rb +7 -6
  58. data/lib/vas/tc_server/installation_images.rb +5 -4
  59. data/lib/vas/tc_server/installations.rb +11 -12
  60. data/lib/vas/tc_server/instances.rb +28 -20
  61. data/lib/vas/tc_server/live_configurations.rb +3 -3
  62. data/lib/vas/tc_server/logs.rb +1 -2
  63. data/lib/vas/tc_server/node_applications.rb +19 -19
  64. data/lib/vas/tc_server/node_instances.rb +9 -8
  65. data/lib/vas/tc_server/node_revisions.rb +12 -10
  66. data/lib/vas/tc_server/nodes.rb +11 -9
  67. data/lib/vas/tc_server/pending_configurations.rb +5 -4
  68. data/lib/vas/tc_server/revision_images.rb +19 -11
  69. data/lib/vas/tc_server/revisions.rb +22 -18
  70. data/lib/vas/tc_server/tc_server.rb +9 -8
  71. data/lib/vas/tc_server/template_images.rb +19 -11
  72. data/lib/vas/tc_server/templates.rb +19 -17
  73. data/lib/vas/util/client.rb +4 -3
  74. data/lib/vas/util/link_utils.rb +4 -3
  75. data/lib/vas/vas_exception.rb +6 -6
  76. data/lib/vas/vfabric/agent_image.rb +14 -3
  77. data/lib/vas/vfabric/nodes.rb +16 -10
  78. data/lib/vas/vfabric/v_fabric.rb +6 -3
  79. data/lib/vas/vfabric_administration_server.rb +11 -11
  80. metadata +13 -17
  81. data/lib/vas/gemfire/agent_configuration.rb +0 -28
  82. data/lib/vas/gemfire/cache_server_configuration.rb +0 -28
  83. data/lib/vas/gemfire/locator_configuration.rb +0 -28
  84. 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,18 +12,24 @@
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 RabbitMq
19
18
 
20
- # Used to enumerate, create, and delete Rabbit instances.
19
+ # Used to enumerate, create, and delete RabbitMQ instances
21
20
  class Instances < Shared::MutableCollection
22
21
 
23
- def initialize(location, client) #:nodoc:
22
+ # @private
23
+ def initialize(location, client)
24
24
  super(location, client, "group-instances", Instance)
25
25
  end
26
26
 
27
- # Creates a new instance named +name+, using the installation +installation+.
27
+ # Creates a new instance
28
+ #
29
+ # @param installation [Installation] the installation to be used by the instance
30
+ # @param name [String] the name of the instance
31
+ #
32
+ # @return [Instance] the new instance
28
33
  def create(installation, name)
29
34
  payload = { :installation => installation.location, :name => name }
30
35
  Instance.new(client.post(location, payload, "group-instance"), client)
@@ -32,19 +37,24 @@ module RabbitMq
32
37
 
33
38
  end
34
39
 
35
- # A Rabbit instance
40
+ # A RabbitMQ instance
36
41
  class Instance < Shared::Instance
37
42
 
38
- # The instance's plugins
43
+ # @return [Plugins] the instance's plugins
39
44
  attr_reader :plugins
40
45
 
41
- def initialize(location, client) #:nodoc:
46
+ # @private
47
+ def initialize(location, client)
42
48
  super(location, client, Group, Installation, LiveConfigurations, PendingConfigurations, NodeInstance, 'node-instance')
43
49
  @plugins = Plugins.new(Util::LinkUtils.get_link_href(details, "plugins"), client)
44
50
  end
45
51
 
46
- # Updates the instance to use the given +installation+
47
- def update(installation, runtime_version = nil)
52
+ # Updates the instance to use a different installation
53
+ #
54
+ # @param installation [Installation] the installation that the instance should use
55
+ #
56
+ # @return [void]
57
+ def update(installation)
48
58
  client.post(location, { :installation => installation.location });
49
59
  end
50
60
 
@@ -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,15 +12,26 @@
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 RabbitMq
19
18
 
20
- # Used to enumerate an instance's live configuration
19
+ # Used to enumerate a RabbitMQ instance's live configuration
21
20
  class LiveConfigurations < Shared::Collection
22
21
 
23
- def initialize(location, client) #:nodoc:
24
- super(location, client, "live-configurations", Configuration)
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, "live-configurations", LiveConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A live configuration file in a RabbitMQ instance
30
+ class LiveConfiguration < Shared::Configuration
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, "group-instance", Instance)
25
35
  end
26
36
 
27
37
  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,23 +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 RabbitMq
19
18
 
20
- # Used to enumerate a tRabbit instance's logs
19
+ # Used to enumerate a RabbitMQ node instance's logs
21
20
  class Logs < Shared::Logs
22
21
 
23
- def initialize(location, client) #:nodoc:
22
+ # @private
23
+ def initialize(location, client)
24
24
  super(location, client, Log)
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- # A log file in a Rabbit node instance
29
+ # A log file in a RabbitMQ node instance
30
30
  class Log < Shared::Log
31
31
 
32
- def initialize(location, client) #:nodoc:
32
+ # @private
33
+ def initialize(location, client)
33
34
  super(location, client, 'node-instance', NodeInstance)
34
35
  end
35
36
 
@@ -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,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 RabbitMq
19
18
 
20
- # Used to enumerate Rabbit instances on an individual node
19
+ # Used to enumerate RabbitMQ instances on an individual node
21
20
  class NodeInstances < Shared::NodeInstances
22
21
 
23
- def initialize(location, client) #:nodoc:
22
+ # @private
23
+ def initialize(location, client)
24
24
  super(location, client, "node-instances", NodeInstance)
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- # A Rabbit node instance
29
+ # A RabbitMQ node instance
30
30
  class NodeInstance < Shared::NodeInstance
31
31
 
32
- def initialize(location, client) #:nodoc:
32
+ # @private
33
+ def initialize(location, client)
33
34
  super(location, client, Node, Logs, Instance, 'group-instance')
34
35
  end
35
36
 
@@ -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,35 +12,34 @@
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 RabbitMq
19
18
 
20
- # Used to enumerate Rabbit nodes
19
+ # Used to enumerate RabbitMQ nodes
21
20
  class Nodes < Shared::Collection
22
21
 
23
- def initialize(location, client) #:nodoc:
22
+ # @private
23
+ def initialize(location, client)
24
24
  super(location, client, "nodes", Node)
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- # A Rabbit node
29
+ # A RabbitMQ node
30
30
  class Node < Shared::GroupableNode
31
+
32
+ # @return [NodeInstances] the node's instances
33
+ attr_reader :instances
31
34
 
32
- # The Node's Java home
33
- attr_reader :java_home
34
-
35
- def initialize(location, client) #:nodoc:
35
+ # @private
36
+ def initialize(location, client)
36
37
  super(location, client, Group)
37
- @java_home = details["java-home"]
38
- end
39
-
40
- def instances
41
38
  @instances = NodeInstances.new(Util::LinkUtils.get_link_href(details, "node-instances"), client)
42
39
  end
43
-
44
- def to_s #:nodoc:
40
+
41
+ # @return [String] a string representation of the node
42
+ def to_s
45
43
  "#<#{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
44
  end
47
45
 
@@ -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,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 RabbitMq
19
18
 
20
- # Used to enumerate an instance's pending configuration
19
+ # Used to enumerate a RabbitMQ instance's pending configuration
21
20
  class PendingConfigurations < Shared::PendingConfigurations
22
21
 
23
- def initialize(location, client) #:nodoc:
22
+ # @private
23
+ def initialize(location, client)
24
24
  super(location, client, 'pending-configurations', PendingConfiguration)
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- # A configuration file that is pending
29
+ # A RabbitMQ instance's configuration file that is pending
30
30
  class PendingConfiguration < Shared::PendingConfiguration
31
31
 
32
- def initialize(location, client) #:nodoc:
32
+ # @private
33
+ def initialize(location, client)
33
34
  super(location, client, 'group-instance', Instance)
34
35
  end
35
36
 
@@ -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,18 +12,23 @@
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 RabbitMq
19
18
 
20
- # Used to enumerate, create, and delete Rabbit plugin images
19
+ # Used to enumerate, create, and delete RabbitMQ plugin images
21
20
  class PluginImages < Shared::MutableCollection
22
21
 
23
- def initialize(location, client) #:nodoc:
22
+ # @private
23
+ def initialize(location, client)
24
24
  super(location, client, "plugin-images", PluginImage)
25
25
  end
26
26
 
27
- # Creates a plugin image by uploading the file at the given +path+
27
+ # Creates a new plugin image by uploading a file
28
+ #
29
+ # @param path [String] the path of the plugin +.ez+ file to upload
30
+ #
31
+ # @return [PluginImage] the new plugin image
28
32
  def create(path)
29
33
  PluginImage.new(client.post_image(location, path), client)
30
34
  end
@@ -43,7 +47,8 @@ module RabbitMq
43
47
  # The plugin image's size
44
48
  attr_reader :size
45
49
 
46
- def initialize(location, client) #:nodoc:
50
+ # @private
51
+ def initialize(location, client)
47
52
  super(location, client)
48
53
 
49
54
  @name = details["name"]
@@ -51,14 +56,15 @@ module RabbitMq
51
56
  @size = details['size']
52
57
  end
53
58
 
54
- # The plugins that have been created from this plugin image
59
+ # @return [Plugin[]] the plugins that have been created from this plugin image
55
60
  def plugins
56
61
  plugins = []
57
62
  Util::LinkUtils.get_link_hrefs(client.get(location), "plugin").each { |plugin_location| plugins << Plugin.new(plugin_location, client)}
58
63
  plugins
59
64
  end
60
65
 
61
- def to_s #:nodoc:
66
+ # @return [String] a string representation of the plugin image
67
+ def to_s
62
68
  "#<#{self.class} name='#@name' version='#@version'>"
63
69
  end
64
70
 
@@ -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,11 +12,11 @@
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 RabbitMq
19
18
 
20
- # Used to enumerate, create, and delete plugins.
19
+ # Used to enumerate, create, and delete plugins
21
20
  class Plugins < Shared::MutableCollection
22
21
 
23
22
  def initialize(location, client) #:nodoc:
@@ -31,53 +30,55 @@ module RabbitMq
31
30
 
32
31
  end
33
32
 
34
- # A plugin in a Rabbit instance
33
+ # A plugin in a RabbitMQ instance
35
34
  class Plugin < Shared::Resource
36
35
 
37
- # The plugin's version
36
+ # @return [String] the plugin's version
38
37
  attr_reader :version
39
38
 
40
- # The plugin's name
39
+ # @return [String] the plugin's name
41
40
  attr_reader :name
42
41
 
43
- def initialize(location, client) #:nodoc:
42
+ # @return [Instance] the instance that contains the plugin
43
+ attr_reader :instance
44
+
45
+ # @return [PluginImage] the plugin image, if any, that was used to create the plugin
46
+ attr_reader :plugin_image
47
+
48
+ # @private
49
+ def initialize(location, client)
44
50
  super(location, client)
45
51
 
46
52
  @name = details['name']
47
53
  @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')
54
+ @instance = Instance.new(Util::LinkUtils.get_link_href(details, 'group-instance'), client)
50
55
  @state_location = Util::LinkUtils.get_link_href(details, 'state')
56
+
57
+ plugin_image_location = Util::LinkUtils.get_link_href(details, 'plugin-image')
58
+ @plugin_image = PluginImage.new(plugin_image_location, client) unless plugin_image_location.nil?
51
59
  end
52
60
 
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
61
+ # @return [String] the state of the plugin
66
62
  def state
67
63
  client.get(@state_location)['status']
68
64
  end
69
65
 
70
66
  # Enables the plugin
67
+ #
68
+ # @return [void]
71
69
  def enable
72
70
  client.post(@state_location, { :status => 'ENABLED' })
73
71
  end
74
72
 
75
73
  # Disables the plugin
74
+ #
75
+ # @return [void]
76
76
  def disable
77
77
  client.post(@state_location, { :status => 'DISABLED' })
78
78
  end
79
79
 
80
- def to_s #:nodoc:
80
+ # @return [String] a string representation of the plugin
81
+ def to_s
81
82
  "#<#{self.class} name='#@name' version='#@version'>"
82
83
  end
83
84
  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,24 +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
- #++
17
15
 
16
+
17
+ # API for administering RabbitMQ
18
18
  module RabbitMq
19
19
 
20
+ # The entry point to the API for administering RabbitMQ
20
21
  class RabbitMq
21
- # The Rabbit groups
22
+
23
+ # @return [Groups] the RabbitMQ groups
22
24
  attr_reader :groups
23
25
 
24
- # The Rabbit installation images
26
+ # @return [InstallationImages] the RabbitMQ installation images
25
27
  attr_reader :installation_images
26
28
 
27
- # The Rabbit plugin images
29
+ # @return [PluginImages] the RabbitMQ plugin images
28
30
  attr_reader :plugin_images
29
31
 
30
- # The Rabbit nodes
32
+ # @return [Nodes] the RabbitMQ nodes
31
33
  attr_reader :nodes
32
34
 
33
- def initialize(location, client) #:nodoc:
35
+ # @private
36
+ def initialize(location, client)
34
37
 
35
38
  json = client.get(location)
36
39