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,42 @@
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 TcServer
19
+
20
+ # Used to enumerate, create, and delete tc Server 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 instances
33
+ attr_reader :instances
34
+
35
+ def initialize(location, client) #:nodoc:#
36
+ super(location, client, Node, Installations)
37
+ @instances = Instances.new(Util::LinkUtils.get_link_href(details, "group-instances"), client)
38
+ end
39
+
40
+ end
41
+
42
+ 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 TcServer
19
+
20
+ # Used to enumerate, create, and delete tc Server 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 tc Server 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,54 @@
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 TcServer
19
+
20
+ # Used to enumerate, create, and delete tc Server 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 tc Server installation
30
+ class Installation < Shared::Installation
31
+
32
+ # The versions of the tc Server runtime that are supported by the installation
33
+ attr_reader :runtime_versions
34
+
35
+ def initialize(location, client) #:nodoc:
36
+ super(location, client, InstallationImage, Group)
37
+
38
+ @runtime_versions = details["runtime-versions"]
39
+ @templates_location = Util::LinkUtils.get_link_href(details, "templates")
40
+ end
41
+
42
+ # The installation's templates
43
+ def templates
44
+ Templates.new(@templates_location, client)
45
+ end
46
+
47
+ # An array of the instances that are using the installation
48
+ def instances
49
+ retrieve_instances("group-instance", Instance);
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,102 @@
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 TcServer
19
+
20
+ # Used to enumerate, create, and delete tc Server 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
+ # Creation can be customized using +options+.
29
+ #
30
+ # Recognized options are:
31
+ #
32
+ # properties:: A hash of properties
33
+ # runtime_version:: The version of the runtime to be used by the instance.
34
+ # Must be one of the runtime_versions available in the Installation.
35
+ # Defaults to the latest available version.
36
+ # templates:: An array of templates to use when creating the instance. Each Template
37
+ # must be present in the Installation.
38
+ # layout:: The layout to use when creating the instance. Valid values are +COMBINED+
39
+ # and +SEPARATE+. Defaults to +SEPARATE+.
40
+ def create(installation, name, options = {})
41
+ payload = { :installation => installation.location, :name => name }
42
+
43
+ if options.has_key?(:properties)
44
+ payload[:properties] = options[:properties]
45
+ end
46
+
47
+ if options.has_key?(:runtime_version)
48
+ payload["runtime-version"] = options[:runtime_version]
49
+ end
50
+
51
+ if options.has_key?(:templates)
52
+ template_locations = []
53
+ options[:templates].each { |template| template_locations << template.location }
54
+ payload[:templates] = template_locations
55
+ end
56
+
57
+ if options.has_key?(:layout)
58
+ payload[:layout] = options[:layout]
59
+ end
60
+
61
+ Instance.new(client.post(location, payload, "group-instance"), client)
62
+ end
63
+
64
+ end
65
+
66
+ # A tc Server instance
67
+ class Instance < Shared::Instance
68
+
69
+ # The instance's layout
70
+ attr_reader :layout
71
+
72
+ # The version of runtime used by the instance
73
+ attr_reader :runtime_version
74
+
75
+ # The instance's services
76
+ attr_reader :services
77
+
78
+ # The instance's Applications
79
+ attr_reader :applications
80
+
81
+ def initialize(location, client) #:nodoc:
82
+ super(location, client, Group, Installation, LiveConfigurations, PendingConfigurations, NodeInstance, 'node-instance')
83
+
84
+ @layout = details["layout"]
85
+ @runtime_version = details["runtime-version"]
86
+ @services = details["services"]
87
+ @applications = Applications.new(Util::LinkUtils.get_link_href(details, "group-applications"), client)
88
+
89
+ end
90
+
91
+ # Updates the instance to use the given +installation+ and, optionally, to use the given +runtime_version+
92
+ def update(installation, runtime_version = nil)
93
+ payload = { :installation => installation.location }
94
+ if (!runtime_version.nil?)
95
+ payload['runtime-version'] = runtime_version
96
+ end
97
+ client.post(location, payload);
98
+ end
99
+
100
+ end
101
+
102
+ 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 TcServer
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 TcServer
19
+
20
+ # Used to enumerate a tc Server node 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 tc Server 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,76 @@
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 TcServer
19
+
20
+ # Used to enumerate a NodeInstance's NodeApplication s
21
+ class NodeApplications < Shared::Collection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, "applications", NodeApplication)
25
+ end
26
+
27
+ end
28
+
29
+ # A node application
30
+ class NodeApplication < Shared::Resource
31
+
32
+ # The application's context path
33
+ attr_reader :context_path
34
+
35
+ # The application's name
36
+ attr_reader :name
37
+
38
+ # The service the application will deploy its revisions to
39
+ attr_reader :service
40
+
41
+ # The host the application will deploy its revisions to
42
+ attr_reader :host
43
+
44
+ # The application's NodeRevisions
45
+ attr_reader :revisions
46
+
47
+ # The Application that this node application is a member of
48
+ attr_reader :group_application
49
+
50
+ def initialize(location, client) #:nodoc:
51
+ super(location, client)
52
+
53
+ @revisions = NodeRevisions.new(Util::LinkUtils.get_link_href(details, "node-revisions"), client)
54
+
55
+ @context_path = details["context-path"]
56
+ @name = details["name"]
57
+ @service = details["service"]
58
+ @host = details["host"]
59
+
60
+ @instance_location = Util::LinkUtils.get_link_href(details, "node-instance")
61
+
62
+ @group_application = Application.new(Util::LinkUtils.get_link_href(details, "group-application"), client)
63
+ end
64
+
65
+ # The node instance that contains the application
66
+ def instance
67
+ NodeInstance.new(@instance_location, client)
68
+ end
69
+
70
+ def to_s #:nodoc:
71
+ "#<#{self.class} name='#@name' context_path='#@context_path' service='#@service' host='#@host'>"
72
+ end
73
+
74
+ end
75
+
76
+ end
@@ -0,0 +1,55 @@
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 TcServer
19
+
20
+ # Used to enumerate tc Server 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 tc Server node instance
30
+ class NodeInstance < Shared::NodeInstance
31
+
32
+ # The instance's layout
33
+ attr_reader :layout
34
+
35
+ # The version of runtime used by the instance
36
+ attr_reader :runtime_version
37
+
38
+ # The instance's services
39
+ attr_reader :services
40
+
41
+ # The instance's NodeApplications
42
+ attr_reader :applications
43
+
44
+ def initialize(location, client) #:nodoc:
45
+ super(location, client, Node, Logs, Instance, 'group-instance')
46
+
47
+ @layout = details["layout"]
48
+ @runtime_version = details["runtime-version"]
49
+ @services = details["services"]
50
+ @applications = NodeApplications.new(Util::LinkUtils.get_link_href(details, "node-applications"), client)
51
+ end
52
+
53
+ end
54
+
55
+ end
@@ -0,0 +1,55 @@
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 TcServer
19
+
20
+ # Used to enumerate Node Revision s
21
+ class NodeRevisions < Shared::Collection
22
+
23
+ def initialize(location, client) #:nodoc:
24
+ super(location, client, 'revisions', NodeRevision)
25
+ end
26
+
27
+ end
28
+
29
+ # A revision of a NodeApplication
30
+ class NodeRevision < Shared::StateResource
31
+
32
+ # The Revision's version
33
+ attr_reader :version
34
+
35
+ # The Revision's application
36
+ attr_reader :application
37
+
38
+ # The revision's group revision
39
+ attr_reader :group_revision
40
+
41
+ def initialize(location, client) #:nodoc:
42
+ super(location, client)
43
+
44
+ @version = details['version']
45
+ @application = NodeApplication.new(Util::LinkUtils.get_link_href(details, 'node-application'), client)
46
+ @group_revision = Revision.new(Util::LinkUtils.get_link_href(details, 'group-revision'), client)
47
+ end
48
+
49
+ def to_s #:nodoc:
50
+ "#<#{self.class} version='#@version'>"
51
+ end
52
+
53
+ end
54
+
55
+ end