vas 0.3.0 → 0.4.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 (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,25 +12,32 @@
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
+ # Shared code to be extended by component-specific APIs
18
17
  module Shared
19
18
 
19
+ # @abstract A dynamic collection of items
20
20
  class Collection < Shared::Resource
21
21
 
22
22
  private
23
+
23
24
  attr_reader :entry_class
25
+
26
+ public
24
27
 
25
- def initialize(location, client, type, entry_class) #:nodoc:
28
+ # @private
29
+ def initialize(location, client, type, entry_class)
26
30
  super(location, client)
27
31
  @type = type
28
32
  @entry_class = entry_class
29
33
  end
30
34
 
31
- public
32
-
33
35
  # Gets the items in the collection from the server. Calls the block once for each item.
34
- def each # :yields: item
36
+ #
37
+ # @yieldparam item an item in the collection
38
+ #
39
+ # @return [void]
40
+ def each
35
41
  items = client.get(location)[@type]
36
42
 
37
43
  if (!items.nil?)
@@ -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,22 +12,27 @@
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 configuration file in an instance
20
20
  class Configuration < Shared::Resource
21
21
 
22
- # The path of the configuration
22
+ # @return [String] the configuration's path
23
23
  attr_reader :path
24
24
 
25
- # The size of the configuration
25
+ # @return [Integer] the configuration's size
26
26
  attr_reader :size
27
27
 
28
28
  private
29
+
29
30
  attr_reader :content_location
31
+
32
+ public
30
33
 
31
- def initialize(location, client, instance_type, instance_class) #:nodoc:
34
+ # @private
35
+ def initialize(location, client, instance_type, instance_class)
32
36
  super(location, client)
33
37
 
34
38
  @path = details["path"]
@@ -40,18 +44,22 @@ module Shared
40
44
  @instance_class = instance_class
41
45
  end
42
46
 
43
- public
44
47
  # Retrieves the configuration's content and passes it to the block
48
+ #
49
+ # @yield [chunk] a chunk of the configuration's content
50
+ #
51
+ # @return [void]
45
52
  def content(&block)
46
53
  client.get_stream(@content_location, &block)
47
54
  end
48
55
 
49
- # The instance that owns the configuration
56
+ # @return [Instance] the instance that owns the configuration
50
57
  def instance
51
58
  @instance_class.new(@instance_location, client)
52
59
  end
53
60
 
54
- def to_s #:nodoc:
61
+ # @return [String] a string representation of the configuration
62
+ def to_s
55
63
  "#<#{self.class} name='#@path' size=#@size>"
56
64
  end
57
65
 
@@ -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,17 +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 Shared
19
18
 
19
+ # @abstract A collection of groups
20
20
  class Groups < MutableCollection
21
21
 
22
- def initialize(location, client, group_class) #:nodoc:
22
+ # @private
23
+ def initialize(location, client, group_class)
23
24
  super(location, client, "groups", group_class)
24
25
  end
25
26
 
26
- # Creates a Group named +name+ from the given +nodes+.
27
+ public
28
+
29
+ # Creates a new group
30
+ #
31
+ # @param name [String] the group's name
32
+ # @param nodes [GroupableNode[]] the group's nodes
33
+ #
34
+ # @return [Group] the new group
27
35
  def create(name, nodes)
28
36
  node_locations = []
29
37
  nodes.each { |node| node_locations << node.location }
@@ -32,37 +40,47 @@ module Shared
32
40
 
33
41
  end
34
42
 
43
+ # @abstract A collection of one or more nodes
35
44
  class Group < Shared::Resource
36
45
 
37
- # The group's installations
46
+ # @return [Installations] the group's installations
38
47
  attr_reader :installations
39
48
 
40
- # The name of the group
49
+ # @return [String] the group's name
41
50
  attr_reader :name
42
51
 
43
- def initialize(location, client, nodes_class, installations_class) #:nodoc:#
52
+ # @private
53
+ def initialize(location, client, nodes_class, installations_class)
44
54
  super(location, client)
45
55
  @name = details["name"]
46
56
  @installations = installations_class.new(Util::LinkUtils.get_link_href(details, "installations"), client)
47
57
  @nodes_class = nodes_class
48
58
  end
59
+
60
+ public
49
61
 
50
- # An array of the group's nodes
62
+ # @return [GroupableNode[]] the group's nodes
51
63
  def nodes
52
64
  nodes = []
53
65
  Util::LinkUtils.get_link_hrefs(client.get(location), "node").each { |node_location| nodes << @nodes_class.new(node_location, client)}
54
66
  nodes
55
67
  end
56
68
 
57
- def to_s #:nodoc:
69
+ # @return [String] a string representation of the group
70
+ def to_s
58
71
  "#<#{self.class} name='#@name'>"
59
72
  end
60
73
 
61
74
  end
62
75
 
76
+ # @abstract A group that supports changes to it membership
63
77
  class MutableGroup < Group
64
78
 
65
- # Updates the group to contain the given +nodes+.
79
+ # Updates the group to contain the given nodes
80
+ #
81
+ # @param nodes [GroupableNode[]] the group's nodes
82
+ #
83
+ # @return [void]
66
84
  def update(nodes)
67
85
  node_locations = []
68
86
  nodes.each { |node| node_locations << node.location }
@@ -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,31 +12,42 @@
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 installation images
20
20
  class InstallationImages < MutableCollection
21
-
22
- def initialize(location, client, installation_image_class) #:nodoc:
21
+
22
+ # @private
23
+ def initialize(location, client, installation_image_class)
23
24
  super(location, client, "installation-images", installation_image_class)
24
25
  end
25
26
 
26
- # Creates an installation image with the version +version+ by uploading the file at the given +path+.
27
+ # Creates an installation image by uploading a file to the server and assigning it a version
28
+ #
29
+ # @param path the path of the file to upload
30
+ # @param version [String] the installation image's version
31
+ #
32
+ # @return [InstallationImage] the new installation image
27
33
  def create(path, version)
28
34
  entry_class.new(client.post_image(location, path, { :version => version }), client)
29
35
  end
30
36
 
31
37
  end
32
38
 
39
+ # @abstract A product binary, typically are .zip or .tar.gz file, that has been uploaded to the
40
+ # server. Once created, an installation image can then be used to create an installation on a
41
+ # group.
33
42
  class InstallationImage < Resource
34
43
 
35
- # The installation image's version
44
+ # @return [String] the installation image's version
36
45
  attr_reader :version
37
46
 
38
- # The installation image's size
47
+ # @return [Integer] the installation image's size
39
48
  attr_reader :size
40
49
 
50
+ # @private
41
51
  def initialize(location, client, installation_class) #:nodoc:
42
52
  super(location, client)
43
53
  @version = details["version"]
@@ -45,6 +55,7 @@ module Shared
45
55
  @installation_class = installation_class
46
56
  end
47
57
 
58
+ # @return [Installation[]] the installations that have been created from the installation image
48
59
  def installations
49
60
  installations = []
50
61
  Util::LinkUtils.get_link_hrefs(client.get(location), "installation").each { |installation_location|
@@ -53,7 +64,8 @@ module Shared
53
64
  installations
54
65
  end
55
66
 
56
- def to_s #:nodoc:
67
+ # @return [String] a string representation of the installation image
68
+ def to_s
57
69
  "#<#{self.class} version='#@version'>"
58
70
  end
59
71
 
@@ -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,34 +12,44 @@
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 installations
20
20
  class Installations < Shared::MutableCollection
21
-
22
- def initialize(location, client, installation_class) #:nodoc:
21
+
22
+ # @private
23
+ def initialize(location, client, installation_class)
23
24
  super(location, client, "installations", installation_class)
24
25
  end
25
-
26
- # Creates an installation from the +installation_image+
26
+
27
+ # Creates a new installation
28
+ #
29
+ # @param installation_image [InstallationImage] the installation image to use to create the installation
30
+ #
31
+ # @return [Installation] the new installation
27
32
  def create(installation_image)
28
33
  entry_class.new(client.post(location, { :image => installation_image.location }, "installation"), client)
29
34
  end
30
35
 
31
36
  end
32
37
 
38
+ # @abstract An installation of a middleware component. Created from an installation image. Once created, an
39
+ # installation is used when creating a new instance and provides the binaries that the instance uses at
40
+ # runtime
33
41
  class Installation < Shared::Resource
34
42
 
35
- # The installation's version
43
+ # @return [String] the installation's version
36
44
  attr_reader :version
37
45
 
38
- # The installation image that was used to create the installation
46
+ # @return [InstallationImage] the installation image that was used to create the installation
39
47
  attr_reader :installation_image
40
48
 
41
- # The group that contains the installation
49
+ # @return [Group] the group that contains the installation
42
50
  attr_reader :group
43
-
51
+
52
+ # @private
44
53
  def initialize(location, client, installation_image_class, group_class) #:nodoc:
45
54
  super(location, client)
46
55
 
@@ -48,12 +57,14 @@ module Shared
48
57
  @installation_image = installation_image_class.new(Util::LinkUtils.get_link_href(details, "installation-image"), client)
49
58
  @group = group_class.new(Util::LinkUtils.get_link_href(details, "group"), client)
50
59
  end
51
-
60
+
61
+ # @return [String] a string representation of the installation
52
62
  def to_s #:nodoc:
53
63
  "#<#{self.class} version='#@version'>"
54
64
  end
55
-
65
+
56
66
  private
67
+
57
68
  def retrieve_instances(instance_rel, instance_class)
58
69
  instances = []
59
70
  Util::LinkUtils.get_link_hrefs(client.get(location), instance_rel).each { |instance_location|
@@ -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,27 +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 Shared
19
18
 
19
+ # @abstract A collection of instances
20
20
  class Instance < Shared::StateResource
21
21
 
22
- # The instance's name
22
+ # @return [String] the instance's name
23
23
  attr_reader :name
24
24
 
25
- # The instance's live configurations
25
+ # @return the instance's live configurations
26
26
  attr_reader :live_configurations
27
27
 
28
- # The instance's pending configurations
28
+ # @return the instance's pending configurations
29
29
  attr_reader :pending_configurations
30
30
 
31
- # The group that contains this instance
31
+ # @return [Group] the group that contains this instance
32
32
  attr_reader :group
33
33
 
34
- # An array of the instance's individual node instances
35
- attr_reader :node_instances
36
-
34
+ # @private
37
35
  def initialize(location, client,
38
36
  group_class,
39
37
  installation_class,
@@ -52,12 +50,12 @@ module Shared
52
50
  @node_instance_type = node_instance_type
53
51
  end
54
52
 
55
- # The installation that this instance is using
53
+ # @return [Installation] the installation that this instance is using
56
54
  def installation
57
55
  @installation_class.new(Util::LinkUtils.get_link_href(client.get(location), 'installation'), client)
58
56
  end
59
57
 
60
- # An array of the instance's individual node instances
58
+ # @return [NodeInstance[]] the instance's individual node instances
61
59
  def node_instances
62
60
  node_instances = []
63
61
  Util::LinkUtils.get_link_hrefs(client.get(location), @node_instance_type).each {
@@ -65,7 +63,8 @@ module Shared
65
63
  node_instances
66
64
  end
67
65
 
68
- def to_s #:nodoc:
66
+ # @return [String] a string representation of the instance
67
+ def to_s
69
68
  "#<#{self.class} name='#@name'>"
70
69
  end
71
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,29 +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
 
20
- # Used to enumerate a node instance's logs
19
+ # @abstract A node instance's logs
21
20
  class Logs < Shared::MutableCollection
22
21
 
23
- def initialize(location, client, log_class) #:nodoc:
22
+ # @private
23
+ def initialize(location, client, log_class)
24
24
  super(location, client, 'logs', log_class)
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- # A log file in a node instance
29
+ # abstract A log file in a node instance
30
30
  class Log < Shared::Resource
31
31
 
32
- # The name of the log
32
+ # @return [String] the name of the log
33
33
  attr_reader :name
34
34
 
35
- # The node instance that the log belongs to
35
+ # @return [NodeInstance] the node instance that the log belongs to
36
36
  attr_reader :instance
37
-
38
- def initialize(location, client, instance_type, instance_class) #:nodoc:
37
+
38
+ # @private
39
+ def initialize(location, client, instance_type, instance_class)
39
40
  super(location, client)
40
41
 
41
42
  @name = details['name']
@@ -43,16 +44,23 @@ module Shared
43
44
  @instance = instance_class.new(Util::LinkUtils.get_link_href(details, instance_type), client)
44
45
  end
45
46
 
46
- # The Log's content. The content that is passed to the block can be controlled using +options+.
47
+ # Retrieve the content of the log
48
+ #
49
+ # @param [Hash] options the options that control the content that is returned
50
+ #
51
+ # @option options [Integer] :start_line the start point, in lines, of the content to pass to
52
+ # the block. Omitting the parameter will result in content from the start of the file being
53
+ # passed. If the provided value is greater than the number of lines in the file, no content
54
+ # will be passed.
55
+ #
56
+ # @option options [Integer] :end_line the end point, in lines, of the content to pass to the
57
+ # block. Omitting the parameter will result in content up to the end of the file being
58
+ # passed. If the provided value is greater than the number of lines in the file, content up
59
+ # to and including the last line in the file will be passed.
47
60
  #
48
- # Recognized options are:
61
+ # @yield [chunk] a chunk of the log's content
49
62
  #
50
- # start_line:: The start point, in lines, of the content to pass to the block. Omitting the parameter will result
51
- # in content from the start of the file being passed. If the provided value is greater than the
52
- # number of lines in the file, no content will be passed.
53
- # end_line:: The end point, in lines, of the content to pass to the block. Omitting the parameter will result in
54
- # content up to the end of the file being passed. If the provided value is greater than the number of
55
- # lines in the file, content up to and including the last line in the file will be passed.
63
+ # @return [void]
56
64
  def content(options = {}, &block)
57
65
  query=""
58
66
  if (!options[:start_line].nil?)
@@ -72,18 +80,19 @@ module Shared
72
80
  end
73
81
  end
74
82
 
75
- # The size of the log
83
+ # @return [Integer] the size of the log
76
84
  def size
77
85
  client.get(location)['size']
78
86
  end
79
87
 
80
- # The last_modified stamp of the log
88
+ # @return [Integer] the last modified stamp of the log
81
89
  def last_modified
82
90
  client.get(location)['last-modified']
83
91
  end
84
92
 
85
- def to_s #:nodoc:
86
- "#<#{self.class} name='#@name' size'#@size' services='#@last_modified'>"
93
+ # @return [String] a string representation of the log
94
+ def to_s
95
+ "#<#{self.class} name='#@name'>"
87
96
  end
88
97
  end
89
98
  end