vas 0.4.0 → 1.0.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 (109) hide show
  1. data/README.md +1 -1
  2. data/lib/vas.rb +44 -1
  3. data/lib/vas/gemfire/agent_instances.rb +4 -3
  4. data/lib/vas/gemfire/agent_live_configurations.rb +3 -3
  5. data/lib/vas/gemfire/agent_node_instances.rb +2 -2
  6. data/lib/vas/gemfire/agent_node_live_configurations.rb +39 -0
  7. data/lib/vas/gemfire/application_code.rb +13 -12
  8. data/lib/vas/gemfire/application_code_images.rb +13 -11
  9. data/lib/vas/gemfire/cache_server_instances.rb +20 -12
  10. data/lib/vas/gemfire/cache_server_live_configurations.rb +3 -3
  11. data/lib/vas/gemfire/cache_server_node_instances.rb +16 -9
  12. data/lib/vas/gemfire/cache_server_node_live_configurations.rb +39 -0
  13. data/lib/vas/gemfire/disk_stores.rb +19 -11
  14. data/lib/vas/gemfire/gemfire.rb +4 -4
  15. data/lib/vas/gemfire/groups.rb +17 -10
  16. data/lib/vas/gemfire/installations.rb +12 -3
  17. data/lib/vas/gemfire/live_application_codes.rb +2 -2
  18. data/lib/vas/gemfire/locator_instances.rb +23 -13
  19. data/lib/vas/gemfire/locator_live_configurations.rb +3 -3
  20. data/lib/vas/gemfire/locator_node_instances.rb +22 -14
  21. data/lib/vas/gemfire/locator_node_live_configurations.rb +39 -0
  22. data/lib/vas/gemfire/nodes.rb +27 -6
  23. data/lib/vas/gemfire/pending_application_codes.rb +7 -2
  24. data/lib/vas/gemfire/statistics.rb +18 -11
  25. data/lib/vas/rabbitmq/groups.rb +6 -4
  26. data/lib/vas/rabbitmq/installations.rb +14 -6
  27. data/lib/vas/rabbitmq/instances.rb +9 -6
  28. data/lib/vas/rabbitmq/live_configurations.rb +3 -3
  29. data/lib/vas/rabbitmq/node_instances.rb +2 -2
  30. data/lib/vas/rabbitmq/node_live_configurations.rb +39 -0
  31. data/lib/vas/rabbitmq/nodes.rb +11 -8
  32. data/lib/vas/rabbitmq/plugin_images.rb +14 -7
  33. data/lib/vas/rabbitmq/plugins.rb +29 -20
  34. data/lib/vas/rabbitmq/rabbitmq.rb +4 -4
  35. data/lib/vas/shared/collection.rb +34 -11
  36. data/lib/vas/shared/configuration.rb +16 -9
  37. data/lib/vas/shared/deletable.rb +34 -0
  38. data/lib/vas/shared/groups.rb +26 -15
  39. data/lib/vas/shared/installation_images.rb +18 -10
  40. data/lib/vas/shared/installations.rb +22 -22
  41. data/lib/vas/shared/instance.rb +40 -19
  42. data/lib/vas/shared/live_configuration.rb +42 -0
  43. data/lib/vas/shared/logs.rb +27 -14
  44. data/lib/vas/shared/mutable_collection.rb +13 -5
  45. data/lib/vas/shared/node_configuration.rb +74 -0
  46. data/lib/vas/shared/node_instances.rb +32 -14
  47. data/lib/vas/shared/nodes.rb +37 -14
  48. data/lib/vas/shared/{pending_configuration.rb → pending_configurations.rb} +4 -2
  49. data/lib/vas/shared/resource.rb +12 -2
  50. data/lib/vas/shared/security.rb +11 -4
  51. data/lib/vas/shared/state_resource.rb +1 -1
  52. data/lib/vas/sqlfire/agent_instances.rb +98 -0
  53. data/lib/vas/sqlfire/agent_live_configurations.rb +39 -0
  54. data/lib/vas/sqlfire/agent_logs.rb +39 -0
  55. data/lib/vas/sqlfire/agent_node_instances.rb +54 -0
  56. data/lib/vas/sqlfire/agent_node_live_configurations.rb +39 -0
  57. data/lib/vas/sqlfire/agent_pending_configurations.rb +39 -0
  58. data/lib/vas/sqlfire/groups.rb +58 -0
  59. data/lib/vas/sqlfire/installation_images.rb +39 -0
  60. data/lib/vas/sqlfire/installations.rb +61 -0
  61. data/lib/vas/sqlfire/locator_instances.rb +210 -0
  62. data/lib/vas/sqlfire/locator_live_configurations.rb +39 -0
  63. data/lib/vas/sqlfire/locator_logs.rb +39 -0
  64. data/lib/vas/sqlfire/locator_node_instances.rb +91 -0
  65. data/lib/vas/sqlfire/locator_node_live_configurations.rb +39 -0
  66. data/lib/vas/sqlfire/locator_pending_configurations.rb +39 -0
  67. data/lib/vas/sqlfire/nodes.rb +73 -0
  68. data/lib/vas/sqlfire/server_instances.rb +192 -0
  69. data/lib/vas/sqlfire/server_live_configurations.rb +39 -0
  70. data/lib/vas/sqlfire/server_logs.rb +39 -0
  71. data/lib/vas/sqlfire/server_node_instances.rb +86 -0
  72. data/lib/vas/sqlfire/server_node_live_configurations.rb +39 -0
  73. data/lib/vas/sqlfire/server_pending_configurations.rb +39 -0
  74. data/lib/vas/sqlfire/sqlfire.rb +44 -0
  75. data/lib/vas/tc_server/applications.rb +32 -21
  76. data/lib/vas/tc_server/configuration.rb +1 -1
  77. data/lib/vas/tc_server/groups.rb +7 -4
  78. data/lib/vas/tc_server/installations.rb +16 -6
  79. data/lib/vas/tc_server/instances.rb +25 -13
  80. data/lib/vas/tc_server/live_configurations.rb +11 -1
  81. data/lib/vas/tc_server/logs.rb +4 -2
  82. data/lib/vas/tc_server/node_applications.rb +21 -17
  83. data/lib/vas/tc_server/node_instances.rb +23 -9
  84. data/lib/vas/tc_server/node_live_configurations.rb +39 -0
  85. data/lib/vas/tc_server/node_revisions.rb +15 -10
  86. data/lib/vas/tc_server/nodes.rb +15 -8
  87. data/lib/vas/tc_server/revision_images.rb +16 -10
  88. data/lib/vas/tc_server/revisions.rb +20 -16
  89. data/lib/vas/tc_server/tc_server.rb +5 -5
  90. data/lib/vas/tc_server/template_images.rb +13 -7
  91. data/lib/vas/tc_server/templates.rb +21 -13
  92. data/lib/vas/util/client.rb +15 -6
  93. data/lib/vas/vfabric/agent_image.rb +1 -1
  94. data/lib/vas/vfabric/nodes.rb +4 -11
  95. data/lib/vas/vfabric/v_fabric.rb +2 -2
  96. data/lib/vas/vfabric_administration_server.rb +37 -6
  97. data/lib/vas/web_server/configuration.rb +29 -0
  98. data/lib/vas/web_server/groups.rb +44 -0
  99. data/lib/vas/web_server/installation_images.rb +54 -0
  100. data/lib/vas/web_server/installations.rb +52 -0
  101. data/lib/vas/web_server/instances.rb +65 -0
  102. data/lib/vas/web_server/live_configurations.rb +39 -0
  103. data/lib/vas/web_server/logs.rb +37 -0
  104. data/lib/vas/web_server/node_instances.rb +39 -0
  105. data/lib/vas/web_server/node_live_configurations.rb +39 -0
  106. data/lib/vas/web_server/nodes.rb +53 -0
  107. data/lib/vas/web_server/pending_configurations.rb +39 -0
  108. data/lib/vas/web_server/web_server.rb +43 -0
  109. metadata +137 -76
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate a server instance's live configuration
20
+ class ServerLiveConfigurations < Shared::Collection
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'live-configurations', ServerLiveConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A live configuration file in a server instance
30
+ class ServerLiveConfiguration < Shared::LiveConfiguration
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'server-group-instance', ServerInstance, ServerNodeLiveConfiguration)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate a server node instance's logs
20
+ class ServerLogs < Shared::Logs
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, ServerLog)
25
+ end
26
+
27
+ end
28
+
29
+ # A log file in a server node instance
30
+ class ServerLog < Shared::Log
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'server-node-instance', ServerNodeInstance)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,86 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate server instances on an individual node
20
+ class ServerNodeInstances < Shared::NodeInstances
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'server-node-instances', ServerNodeInstance)
25
+ end
26
+
27
+ end
28
+
29
+ # A server node instance
30
+ class ServerNodeInstance < Shared::NodeInstance
31
+
32
+ # @return [String] the property in a node's metadata used to determine the address that the server binds to for
33
+ # peer-to-peer communication. If +nil+, the server uses the node's hostname
34
+ attr_reader :bind_address
35
+
36
+ # @return [String] the property in a node's metadata used to determine the address that the server binds to for
37
+ # client communication. If +nil+, the server uses localhost. Only takes effect if +run_netserver+ is +true+
38
+ attr_reader :client_bind_address
39
+
40
+ # @return [Integer] the port that the server listens on for client connections. Only takes effect if +run_netserver+
41
+ # is +true+
42
+ attr_reader :client_port
43
+
44
+ # @return [Integer] critical heap percentage as a percentage of the old generation heap. +nil+ if the server uses
45
+ # the default
46
+ attr_reader :critical_heap_percentage
47
+
48
+ # @return [String] The initial heap size of the server's JVM. +nil+ if the default is used
49
+ attr_reader :initial_heap
50
+
51
+ # @return [String[]] The JVM options that are passed to the server's JVM when it is started
52
+ attr_reader :jvm_options
53
+
54
+ # @return [String] The max heap size of the server's JVM. +nil+ if the default is used
55
+ attr_reader :max_heap
56
+
57
+ # @return [Boolean] +true+ if the server runs a netserver that can service thin clients, otherwise +false+
58
+ attr_reader :run_netserver
59
+
60
+ # @private
61
+ def initialize(location, client)
62
+ super(location, client, Node, ServerLogs, ServerInstance, 'server-group-instance', ServerNodeLiveConfigurations)
63
+ end
64
+
65
+ # Reloads the instance's details from the server
66
+ # @return [void]
67
+ def reload
68
+ super
69
+ @bind_address = details['bind-address']
70
+ @client_bind_address = details['client-bind-address']
71
+ @client_port = details['client-port']
72
+ @critical_heap_percentage = details['critical-heap-percentage']
73
+ @initial_heap = details['initial-heap']
74
+ @jvm_options = details['jvm-options']
75
+ @max_heap = details['max-heap']
76
+ @run_netserver = details['run-netserver']
77
+ end
78
+
79
+ # @return [String] a string representation of the instance
80
+ def to_s
81
+ "#<#{self.class} name='#{name}' bind_address='#@bind_address' client_bind_address='#@client_bind_address' client_port='#@client_port' critical_heap_percentage='#@critical_heap_percentage' initial_heap='#@initial_heap' jvm_options='#@jvm_options' max_heap='#@max_heap' run_netserver='#@run_netserver'>"
82
+ end
83
+
84
+ end
85
+
86
+ end
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate a server node instance's live configuration
20
+ class ServerNodeLiveConfigurations < Shared::Collection
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'node-live-configurations', ServerNodeLiveConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A live configuration file in a server node instance
30
+ class ServerNodeLiveConfiguration < Shared::NodeConfiguration
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'server-node-instance', ServerNodeInstance, ServerLiveConfiguration)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Sqlfire
18
+
19
+ # Used to enumerate a server instance's pending configuration
20
+ class ServerPendingConfigurations < Shared::PendingConfigurations
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'pending-configurations', ServerPendingConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A server configuration file that is pending
30
+ class ServerPendingConfiguration < Shared::PendingConfiguration
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'server-group-instance', ServerInstance)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,44 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ # API for administering SQLFire
18
+ module Sqlfire
19
+
20
+ # The entry point to the API for administering SQLFire
21
+ class Sqlfire
22
+
23
+ # @return [Groups] the SQLFire groups
24
+ attr_reader :groups
25
+
26
+ # @return [InstallationImages] the SQLFire installation images
27
+ attr_reader :installation_images
28
+
29
+ # @return [Nodes] the SQLFire nodes
30
+ attr_reader :nodes
31
+
32
+ # @private
33
+ def initialize(location, client)
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
+ @nodes = Nodes.new(Util::LinkUtils.get_link_href(json, 'nodes'), client)
40
+
41
+ end
42
+
43
+ end
44
+ end
@@ -32,18 +32,20 @@ module TcServer
32
32
  #
33
33
  # @return [Application] the new application
34
34
  def create(name, context_path, service, host)
35
- Application.new(client.post(location, {"context-path" => context_path, :name => name, :host => host, :service => service}, "group-application"), client)
35
+ payload = {'context-path' => context_path,
36
+ :name => name,
37
+ :host => host,
38
+ :service => service}
39
+ super(payload, 'group-application')
36
40
  end
37
41
 
38
- private
39
- def create_entry(json)
40
- Application.new(Util::LinkUtils.get_self_link_href(json), client)
41
- end
42
42
  end
43
43
 
44
44
  # An application
45
45
  class Application < Shared::Resource
46
46
 
47
+ include Shared::Deletable
48
+
47
49
  # @return [String] the application's context path
48
50
  attr_reader :context_path
49
51
 
@@ -56,30 +58,39 @@ module TcServer
56
58
  # @return [String] the host the application will deploy its revisions to
57
59
  attr_reader :host
58
60
 
59
- # @return [Revisions] the application's revisions
60
- attr_reader :revisions
61
-
62
- # @return [Instance] the instance that contains the application
63
- attr_reader :instance
64
-
65
61
  # @private
66
62
  def initialize(location, client)
67
63
  super(location, client)
68
64
 
69
- @revisions = Revisions.new(Util::LinkUtils.get_link_href(details, "group-revisions"), client)
70
- @context_path = details["context-path"]
71
- @name = details["name"]
72
- @service = details["service"]
73
- @host = details["host"]
74
- @instance = Instance.new(Util::LinkUtils.get_link_href(details, "group-instance"), client)
65
+ @revisions_location = Util::LinkUtils.get_link_href(details, 'group-revisions')
66
+ @instance_location = Util::LinkUtils.get_link_href(details, 'group-instance')
67
+
68
+ @context_path = details['context-path']
69
+ @name = details['name']
70
+ @service = details['service']
71
+ @host = details['host']
72
+ end
73
+
74
+ # Reloads the application's details from the server
75
+ # @return [void]
76
+ def reload
77
+ super
78
+ @node_applications = nil
75
79
  end
76
80
 
77
81
  # @return [NodeApplication[]] the application's individual node applications
78
82
  def node_applications
79
- node_applications = []
80
- Util::LinkUtils.get_link_hrefs(client.get(location), 'node-application').each {
81
- |node_application_location| node_applications << NodeApplication.new(node_application_location, client)}
82
- node_applications
83
+ @node_applications ||= create_resources_from_links('node-application', NodeApplication)
84
+ end
85
+
86
+ # @return [Instance] the instance that contains the application
87
+ def instance
88
+ @instance ||= Instance.new(@instance_location, client)
89
+ end
90
+
91
+ # @return [Revisions] the application's revisions
92
+ def revisions
93
+ @revisions ||= Revisions.new(@revisions_location, client)
83
94
  end
84
95
 
85
96
  # @return [String] a string representation of the application
@@ -21,7 +21,7 @@ module TcServer
21
21
 
22
22
  # @private
23
23
  def initialize(location, client)
24
- super(location, client, "group-instance", Instance)
24
+ super(location, client, 'group-instance', Instance)
25
25
  end
26
26
 
27
27
  end
@@ -29,13 +29,16 @@ module TcServer
29
29
  # A tc Server group
30
30
  class Group < Shared::MutableGroup
31
31
 
32
- # The group's instances
33
- attr_reader :instances
34
-
35
32
  # @private
36
33
  def initialize(location, client)
37
34
  super(location, client, Node, Installations)
38
- @instances = Instances.new(Util::LinkUtils.get_link_href(details, "group-instances"), client)
35
+
36
+ @instances_location = Util::LinkUtils.get_link_href(details, 'group-instances')
37
+ end
38
+
39
+ # @return [Instances] the group's instances
40
+ def instances
41
+ @instances ||= Instances.new(@instances_location, client)
39
42
  end
40
43
 
41
44
  end
@@ -31,21 +31,31 @@ module TcServer
31
31
 
32
32
  # @return [String[]] the versions of the tc Server runtime that are supported by the installation
33
33
  attr_reader :runtime_versions
34
-
35
- # @return [Templates] the installation's templates
36
- attr_reader :templates
37
34
 
38
35
  # @private
39
36
  def initialize(location, client)
40
37
  super(location, client, InstallationImage, Group)
41
38
 
42
- @runtime_versions = details["runtime-versions"]
43
- @templates = Templates.new(Util::LinkUtils.get_link_href(details, "templates"), client)
39
+ @runtime_versions = details['runtime-versions']
40
+ @templates_location = Util::LinkUtils.get_link_href(details, 'templates')
41
+ end
42
+
43
+ # Reloads the installation's details from the server
44
+ #
45
+ # @return [void]
46
+ def reload
47
+ super
48
+ @instances = nil
44
49
  end
45
50
 
46
51
  # @return [Instance[]] the instances that are using the installation
47
52
  def instances
48
- retrieve_instances("group-instance", Instance);
53
+ @instances ||= create_resources_from_links('group-instance', Instance)
54
+ end
55
+
56
+ # @return [Templates] the installation's templates
57
+ def templates
58
+ @templates ||= Templates.new(@templates_location, client)
49
59
  end
50
60
 
51
61
  end