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,63 @@
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 Gemfire
19
+
20
+ class DiskStores < Shared::MutableCollection
21
+
22
+ def initialize(location, client)
23
+ super(location, client, 'disk-stores', DiskStore)
24
+ end
25
+
26
+ end
27
+
28
+ class DiskStore < Shared::Resource
29
+
30
+ # The last modified time of the disk store
31
+ attr_reader :last_modified
32
+
33
+ # The name of the disk store
34
+ attr_reader :name
35
+
36
+ # The size of the disk store
37
+ attr_reader :size
38
+
39
+ # The disk store's cache server node instance
40
+ attr_reader :instance
41
+
42
+ def initialize(location, client)
43
+ super(location, client)
44
+
45
+ @last_modified = details['last-modified']
46
+ @name = details['name']
47
+ @size = details['size']
48
+ @instance = CacheServerNodeInstance.new(Util::LinkUtils.get_link_href(details, 'cache-server-node-instance'), client)
49
+ @content_location = Util::LinkUtils.get_link_href(details, 'content')
50
+ end
51
+
52
+ # Retrieves the disk store's content and passes it to the +block+
53
+ def content(&block)
54
+ client.get_stream(@content_location, &block)
55
+ end
56
+
57
+ def to_s
58
+ "#<#{self.class} name='#@name'>"
59
+ end
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,47 @@
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 Gemfire
19
+
20
+ # The entry point to the API for administering GemFire
21
+ class Gemfire
22
+
23
+ # The GemFire groups
24
+ attr_reader :groups
25
+
26
+ # The GemFire installation images
27
+ attr_reader :installation_images
28
+
29
+ # The GemFire nodes
30
+ attr_reader :nodes
31
+
32
+ # The GemFire application code images
33
+ attr_reader :application_code_images
34
+
35
+ def initialize(location, client) #:nodoc:
36
+
37
+ json = client.get(location)
38
+
39
+ @groups = Groups.new(Util::LinkUtils.get_link_href(json, "groups"), client)
40
+ @installation_images = InstallationImages.new(Util::LinkUtils.get_link_href(json, "installation-images"), client)
41
+ @nodes = Nodes.new(Util::LinkUtils.get_link_href(json, "nodes"), client)
42
+ @application_code_images = ApplicationCodeImages.new(Util::LinkUtils.get_link_href(json, "application-code-images"), client)
43
+
44
+ end
45
+
46
+ end
47
+ 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 Gemfire
19
+
20
+ # Used to enumerate, create, and delete GemFire groups.
21
+ class Groups < Shared::Groups
22
+
23
+ def initialize(location, client) #:nodoc:#
24
+ super(location, client, Group)
25
+ end
26
+
27
+ end
28
+
29
+ # A tc Server group
30
+ class Group < Shared::MutableGroup
31
+
32
+ # The group's agent instances
33
+ attr_reader :agent_instances
34
+
35
+ # The group's cache server instances
36
+ attr_reader :cache_server_instances
37
+
38
+ # The group's locator instances
39
+ attr_reader :locator_instances
40
+
41
+ def initialize(location, client) #:nodoc:#
42
+ super(location, client, Node, Installations)
43
+ @agent_instances = AgentInstances.new(Util::LinkUtils.get_link_href(details, "agent-group-instances"), client)
44
+ @cache_server_instances = CacheServerInstances.new(Util::LinkUtils.get_link_href(details, "cache-server-group-instances"), client)
45
+ @locator_instances = LocatorInstances.new(Util::LinkUtils.get_link_href(details, "locator-group-instances"), client)
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 Gemfire
19
+
20
+ # Used to enumerate, create, and delete GemFire installation images.
21
+ class InstallationImages < Shared::InstallationImages
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, InstallationImage)
25
+ end
26
+
27
+ end
28
+
29
+ # A GemFire installation image
30
+ class InstallationImage < Shared::InstallationImage
31
+
32
+ def initialize(location, client) #:nodoc:
33
+ super(location, client, Installation)
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -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 Gemfire
19
+
20
+ # Used to enumerate, create, and delete GemFire installations.
21
+ class Installations < Shared::Installations
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, Installation)
25
+ end
26
+
27
+ end
28
+
29
+ # A GemFire installation
30
+ class Installation < Shared::Installation
31
+
32
+ def initialize(location, client) #:nodoc:
33
+ super(location, client, InstallationImage, Group)
34
+ end
35
+
36
+ # An array of the agent instances that are using the installation
37
+ def agent_instances
38
+ retrieve_instances("agent-group-instance", AgentInstance);
39
+ end
40
+
41
+ # An array of the agent instances that are using the installation
42
+ def cache_server_instances
43
+ retrieve_instances("cache-server-group-instance", CacheServerInstance);
44
+ end
45
+
46
+ # An array of the locator instances that are using the installation
47
+ def locator_instances
48
+ retrieve_instances("locator-group-instance", LocatorInstance);
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 Gemfire
19
+
20
+ # Used to enumerate a cache server's live application code.
21
+ class LiveApplicationCodes < Shared::Collection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "live-application-code", ApplicationCode)
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,28 @@
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 Gemfire
19
+
20
+ # A configuration file in a locator instance
21
+ class LocatorConfiguration < Shared::Configuration
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "locator-group-instance", LocatorInstance)
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,109 @@
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 Gemfire
19
+
20
+ # Used to enumerate, create, and delete locator instances.
21
+ class LocatorInstances < Shared::MutableCollection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "locator-group-instances", LocatorInstance)
25
+ end
26
+
27
+ # Creates a new instance named +name+, using the given +installation+.
28
+ # Creation can be customized using +options+.
29
+ #
30
+ # Recognized options are:
31
+ #
32
+ # peer:: +true+ if the locator should act as a peer, otherwise +false+. Defaults to +true+
33
+ # port:: The port on which the locator should listen. If omitted the locator will listen on the default port (10334)
34
+ # server:: +true+ if the locator should act as a server, otherwise +false+. Defaults to +true+
35
+ def create(installation, name, options = {})
36
+ payload = { :installation => installation.location, :name => name }
37
+
38
+ if options.has_key?(:peer)
39
+ payload[:peer] = options[:peer]
40
+ end
41
+
42
+ if options.has_key?(:port)
43
+ payload[:port] = options[:port]
44
+ end
45
+
46
+ if options.has_key?(:server)
47
+ payload[:server] = options[:server]
48
+ end
49
+
50
+ LocatorInstance.new(client.post(location, payload, "locator-group-instance"), client)
51
+ end
52
+
53
+ end
54
+
55
+ # A locator instance
56
+ class LocatorInstance < Shared::Instance
57
+
58
+ def initialize(location, client) #:nodoc:
59
+ super(location, client, Group, Installation, LocatorLiveConfigurations, LocatorPendingConfigurations, LocatorNodeInstance, 'locator-node-instance')
60
+ end
61
+
62
+ # Updates the instance using the supplied +options+.
63
+ #
64
+ # Recognized options are:
65
+ #
66
+ # installation:: The installation to use when running the locator instance. If omitted or nil, the installation configuration will not be changed
67
+ # peer:: Whether or not the locator will act as a peer. If omitted, the configuration will not be changed
68
+ # port:: The port on which the locator will listen. If omitted, the port configuration will not be changed
69
+ # server:: Whether or not the locator will act as a server. If omitted, the configuration will not be changed
70
+ def update(options)
71
+ payload = {}
72
+
73
+ if options.has_key?(:installation)
74
+ payload[:installation] = options[:installation].location
75
+ end
76
+
77
+ if options.has_key?(:peer)
78
+ payload[:peer] = options[:peer]
79
+ end
80
+
81
+ if options.has_key?(:port)
82
+ payload[:port] = options[:port]
83
+ end
84
+
85
+ if options.has_key?(:server)
86
+ payload[:server] = options[:server]
87
+ end
88
+
89
+ client.post(location, payload)
90
+ end
91
+
92
+ # The port that the locator will listen on
93
+ def port
94
+ client.get(location)['port']
95
+ end
96
+
97
+ # +true+ if the locator will act as a peer, +false+ if it will not
98
+ def peer
99
+ client.get(location)['peer']
100
+ end
101
+
102
+ # +true+ if the locator will act as a server, +false+ if it will not
103
+ def server
104
+ client.get(location)['server']
105
+ end
106
+
107
+ end
108
+
109
+ 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 Gemfire
19
+
20
+ # Used to enumerate a locator instance's live configuration
21
+ class LocatorLiveConfigurations < Shared::Collection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "live-configurations", LocatorConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ end