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.
- data/README.md +1 -1
- data/lib/vas.rb +44 -1
- data/lib/vas/gemfire/agent_instances.rb +4 -3
- data/lib/vas/gemfire/agent_live_configurations.rb +3 -3
- data/lib/vas/gemfire/agent_node_instances.rb +2 -2
- data/lib/vas/gemfire/agent_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/application_code.rb +13 -12
- data/lib/vas/gemfire/application_code_images.rb +13 -11
- data/lib/vas/gemfire/cache_server_instances.rb +20 -12
- data/lib/vas/gemfire/cache_server_live_configurations.rb +3 -3
- data/lib/vas/gemfire/cache_server_node_instances.rb +16 -9
- data/lib/vas/gemfire/cache_server_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/disk_stores.rb +19 -11
- data/lib/vas/gemfire/gemfire.rb +4 -4
- data/lib/vas/gemfire/groups.rb +17 -10
- data/lib/vas/gemfire/installations.rb +12 -3
- data/lib/vas/gemfire/live_application_codes.rb +2 -2
- data/lib/vas/gemfire/locator_instances.rb +23 -13
- data/lib/vas/gemfire/locator_live_configurations.rb +3 -3
- data/lib/vas/gemfire/locator_node_instances.rb +22 -14
- data/lib/vas/gemfire/locator_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/nodes.rb +27 -6
- data/lib/vas/gemfire/pending_application_codes.rb +7 -2
- data/lib/vas/gemfire/statistics.rb +18 -11
- data/lib/vas/rabbitmq/groups.rb +6 -4
- data/lib/vas/rabbitmq/installations.rb +14 -6
- data/lib/vas/rabbitmq/instances.rb +9 -6
- data/lib/vas/rabbitmq/live_configurations.rb +3 -3
- data/lib/vas/rabbitmq/node_instances.rb +2 -2
- data/lib/vas/rabbitmq/node_live_configurations.rb +39 -0
- data/lib/vas/rabbitmq/nodes.rb +11 -8
- data/lib/vas/rabbitmq/plugin_images.rb +14 -7
- data/lib/vas/rabbitmq/plugins.rb +29 -20
- data/lib/vas/rabbitmq/rabbitmq.rb +4 -4
- data/lib/vas/shared/collection.rb +34 -11
- data/lib/vas/shared/configuration.rb +16 -9
- data/lib/vas/shared/deletable.rb +34 -0
- data/lib/vas/shared/groups.rb +26 -15
- data/lib/vas/shared/installation_images.rb +18 -10
- data/lib/vas/shared/installations.rb +22 -22
- data/lib/vas/shared/instance.rb +40 -19
- data/lib/vas/shared/live_configuration.rb +42 -0
- data/lib/vas/shared/logs.rb +27 -14
- data/lib/vas/shared/mutable_collection.rb +13 -5
- data/lib/vas/shared/node_configuration.rb +74 -0
- data/lib/vas/shared/node_instances.rb +32 -14
- data/lib/vas/shared/nodes.rb +37 -14
- data/lib/vas/shared/{pending_configuration.rb → pending_configurations.rb} +4 -2
- data/lib/vas/shared/resource.rb +12 -2
- data/lib/vas/shared/security.rb +11 -4
- data/lib/vas/shared/state_resource.rb +1 -1
- data/lib/vas/sqlfire/agent_instances.rb +98 -0
- data/lib/vas/sqlfire/agent_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/agent_logs.rb +39 -0
- data/lib/vas/sqlfire/agent_node_instances.rb +54 -0
- data/lib/vas/sqlfire/agent_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/agent_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/groups.rb +58 -0
- data/lib/vas/sqlfire/installation_images.rb +39 -0
- data/lib/vas/sqlfire/installations.rb +61 -0
- data/lib/vas/sqlfire/locator_instances.rb +210 -0
- data/lib/vas/sqlfire/locator_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/locator_logs.rb +39 -0
- data/lib/vas/sqlfire/locator_node_instances.rb +91 -0
- data/lib/vas/sqlfire/locator_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/locator_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/nodes.rb +73 -0
- data/lib/vas/sqlfire/server_instances.rb +192 -0
- data/lib/vas/sqlfire/server_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/server_logs.rb +39 -0
- data/lib/vas/sqlfire/server_node_instances.rb +86 -0
- data/lib/vas/sqlfire/server_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/server_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/sqlfire.rb +44 -0
- data/lib/vas/tc_server/applications.rb +32 -21
- data/lib/vas/tc_server/configuration.rb +1 -1
- data/lib/vas/tc_server/groups.rb +7 -4
- data/lib/vas/tc_server/installations.rb +16 -6
- data/lib/vas/tc_server/instances.rb +25 -13
- data/lib/vas/tc_server/live_configurations.rb +11 -1
- data/lib/vas/tc_server/logs.rb +4 -2
- data/lib/vas/tc_server/node_applications.rb +21 -17
- data/lib/vas/tc_server/node_instances.rb +23 -9
- data/lib/vas/tc_server/node_live_configurations.rb +39 -0
- data/lib/vas/tc_server/node_revisions.rb +15 -10
- data/lib/vas/tc_server/nodes.rb +15 -8
- data/lib/vas/tc_server/revision_images.rb +16 -10
- data/lib/vas/tc_server/revisions.rb +20 -16
- data/lib/vas/tc_server/tc_server.rb +5 -5
- data/lib/vas/tc_server/template_images.rb +13 -7
- data/lib/vas/tc_server/templates.rb +21 -13
- data/lib/vas/util/client.rb +15 -6
- data/lib/vas/vfabric/agent_image.rb +1 -1
- data/lib/vas/vfabric/nodes.rb +4 -11
- data/lib/vas/vfabric/v_fabric.rb +2 -2
- data/lib/vas/vfabric_administration_server.rb +37 -6
- data/lib/vas/web_server/configuration.rb +29 -0
- data/lib/vas/web_server/groups.rb +44 -0
- data/lib/vas/web_server/installation_images.rb +54 -0
- data/lib/vas/web_server/installations.rb +52 -0
- data/lib/vas/web_server/instances.rb +65 -0
- data/lib/vas/web_server/live_configurations.rb +39 -0
- data/lib/vas/web_server/logs.rb +37 -0
- data/lib/vas/web_server/node_instances.rb +39 -0
- data/lib/vas/web_server/node_live_configurations.rb +39 -0
- data/lib/vas/web_server/nodes.rb +53 -0
- data/lib/vas/web_server/pending_configurations.rb +39 -0
- data/lib/vas/web_server/web_server.rb +43 -0
- metadata +137 -76
|
@@ -40,11 +40,11 @@ module TcServer
|
|
|
40
40
|
|
|
41
41
|
json = client.get(location)
|
|
42
42
|
|
|
43
|
-
@groups = Groups.new(Util::LinkUtils.get_link_href(json,
|
|
44
|
-
@installation_images = InstallationImages.new(Util::LinkUtils.get_link_href(json,
|
|
45
|
-
@nodes = Nodes.new(Util::LinkUtils.get_link_href(json,
|
|
46
|
-
@revision_images = RevisionImages.new(Util::LinkUtils.get_link_href(json,
|
|
47
|
-
@template_images = TemplateImages.new(Util::LinkUtils.get_link_href(json,
|
|
43
|
+
@groups = Groups.new(Util::LinkUtils.get_link_href(json, 'groups'), client)
|
|
44
|
+
@installation_images = InstallationImages.new(Util::LinkUtils.get_link_href(json, 'installation-images'), client)
|
|
45
|
+
@nodes = Nodes.new(Util::LinkUtils.get_link_href(json, 'nodes'), client)
|
|
46
|
+
@revision_images = RevisionImages.new(Util::LinkUtils.get_link_href(json, 'revision-images'), client)
|
|
47
|
+
@template_images = TemplateImages.new(Util::LinkUtils.get_link_href(json, 'template-images'), client)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
end
|
|
@@ -21,7 +21,7 @@ module TcServer
|
|
|
21
21
|
|
|
22
22
|
# @private
|
|
23
23
|
def initialize(location, client)
|
|
24
|
-
super(location, client,
|
|
24
|
+
super(location, client, 'template-images', TemplateImage)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# Creates a new template image by uploading a +.zip+ file to the server
|
|
@@ -32,7 +32,7 @@ module TcServer
|
|
|
32
32
|
#
|
|
33
33
|
# @return [TemplateImage] the new template image
|
|
34
34
|
def create(path, name, version)
|
|
35
|
-
|
|
35
|
+
create_image(path, { :name => name, :version => version })
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
end
|
|
@@ -40,6 +40,8 @@ module TcServer
|
|
|
40
40
|
# A template image
|
|
41
41
|
class TemplateImage < Shared::Resource
|
|
42
42
|
|
|
43
|
+
include Shared::Deletable
|
|
44
|
+
|
|
43
45
|
# @return [String] the template image's name
|
|
44
46
|
attr_reader :name
|
|
45
47
|
|
|
@@ -53,16 +55,20 @@ module TcServer
|
|
|
53
55
|
def initialize(location, client)
|
|
54
56
|
super(location, client)
|
|
55
57
|
|
|
56
|
-
@name = details[
|
|
57
|
-
@version = details[
|
|
58
|
+
@name = details['name']
|
|
59
|
+
@version = details['version']
|
|
58
60
|
@size = details['size']
|
|
59
61
|
end
|
|
60
62
|
|
|
63
|
+
# Reloads the template image's details from the server
|
|
64
|
+
def reload
|
|
65
|
+
super
|
|
66
|
+
@templates = nil
|
|
67
|
+
end
|
|
68
|
+
|
|
61
69
|
# @return [Template[]] the templates that have been created from the template image
|
|
62
70
|
def templates
|
|
63
|
-
templates
|
|
64
|
-
Util::LinkUtils.get_link_hrefs(client.get(location), "template").each { |template_location| templates << Template.new(template_location, client)}
|
|
65
|
-
templates
|
|
71
|
+
@templates ||= create_resources_from_links('template', Template)
|
|
66
72
|
end
|
|
67
73
|
|
|
68
74
|
# @return [String] a string representation of the template image
|
|
@@ -21,7 +21,7 @@ module TcServer
|
|
|
21
21
|
|
|
22
22
|
# @private
|
|
23
23
|
def initialize(location, client)
|
|
24
|
-
super(location, client,
|
|
24
|
+
super(location, client, 'templates', Template)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# Creates a new template
|
|
@@ -30,7 +30,7 @@ module TcServer
|
|
|
30
30
|
#
|
|
31
31
|
# @return [Template] the new template
|
|
32
32
|
def create(template_image)
|
|
33
|
-
|
|
33
|
+
super({ :image => template_image.location }, 'template')
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
end
|
|
@@ -38,28 +38,36 @@ module TcServer
|
|
|
38
38
|
# A tc Server template
|
|
39
39
|
class Template < Shared::Resource
|
|
40
40
|
|
|
41
|
+
include Shared::Deletable
|
|
42
|
+
|
|
41
43
|
# @return [String] the template's version
|
|
42
44
|
attr_reader :version
|
|
43
45
|
|
|
44
46
|
# @return [String] the template's name
|
|
45
47
|
attr_reader :name
|
|
46
48
|
|
|
47
|
-
# @return [TemplateImage] the template image, if any, that this template was created from
|
|
48
|
-
attr_reader :template_image
|
|
49
|
-
|
|
50
|
-
# @return [Installation] the template's installation
|
|
51
|
-
attr_reader :installation
|
|
52
|
-
|
|
53
49
|
# @private
|
|
54
50
|
def initialize(location, client)
|
|
55
51
|
super(location, client)
|
|
56
52
|
|
|
57
|
-
@version = details[
|
|
58
|
-
@name = details[
|
|
59
|
-
@installation = Installation.new(Util::LinkUtils.get_link_href(details, 'installation'), client)
|
|
53
|
+
@version = details['version']
|
|
54
|
+
@name = details['name']
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
@
|
|
56
|
+
@installation_location = Util::LinkUtils.get_link_href(details, 'installation')
|
|
57
|
+
@template_image_location = Util::LinkUtils.get_link_href(details, 'template-image')
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# @return [Installation] the template's installation
|
|
61
|
+
def installation
|
|
62
|
+
@installation ||= Installation.new(@installation_location, client)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# @return [TemplateImage] the template image, if any, that this template was created from
|
|
66
|
+
def template_image
|
|
67
|
+
if @template_image.nil?
|
|
68
|
+
@template_image = TemplateImage.new(@template_image_location, client) unless @template_image_location.nil?
|
|
69
|
+
end
|
|
70
|
+
@template_image
|
|
63
71
|
end
|
|
64
72
|
|
|
65
73
|
# @return [String] a string representation of the template
|
data/lib/vas/util/client.rb
CHANGED
|
@@ -71,18 +71,25 @@ module Util
|
|
|
71
71
|
end
|
|
72
72
|
}
|
|
73
73
|
end
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
def post(location, payload, rel = nil)
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
req = Net::HTTP::Post.new(location)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
|
|
79
|
+
if (payload.is_a?(String))
|
|
80
|
+
req['Content-Type'] = "text/plain"
|
|
81
|
+
req.body = payload
|
|
82
|
+
else
|
|
83
|
+
req['Content-Type'] = "application/json"
|
|
84
|
+
req.body = payload.to_json
|
|
85
|
+
end
|
|
86
|
+
|
|
82
87
|
do_request(req) { |res|
|
|
83
88
|
case res.code
|
|
84
89
|
when "202"
|
|
85
90
|
return await_task(res["Location"], rel)
|
|
91
|
+
when "200"
|
|
92
|
+
return
|
|
86
93
|
else
|
|
87
94
|
raise_vas_exception(res)
|
|
88
95
|
end
|
|
@@ -134,12 +141,14 @@ module Util
|
|
|
134
141
|
when "IN_PROGRESS"
|
|
135
142
|
sleep TASK_POLLING_INTERVAL
|
|
136
143
|
when "SUCCESS"
|
|
144
|
+
delete(task_location)
|
|
137
145
|
if rel
|
|
138
146
|
return LinkUtils.get_link_hrefs(task, rel)[0]
|
|
139
147
|
else
|
|
140
148
|
return
|
|
141
149
|
end
|
|
142
150
|
else
|
|
151
|
+
delete(task_location)
|
|
143
152
|
raise VasException.new([task["message"], task["detail"]])
|
|
144
153
|
end
|
|
145
154
|
end
|
|
@@ -40,7 +40,7 @@ module VFabric
|
|
|
40
40
|
#
|
|
41
41
|
# @return [void]
|
|
42
42
|
def extract_to(location = '.')
|
|
43
|
-
|
|
43
|
+
Tempfile.open('agent-image.zip') { |temp_file|
|
|
44
44
|
content { |chunk| temp_file << chunk }
|
|
45
45
|
temp_file.rewind
|
|
46
46
|
Zip::ZipFile.foreach(temp_file.path) { |entry|
|
data/lib/vas/vfabric/nodes.rb
CHANGED
|
@@ -26,18 +26,11 @@ module VFabric
|
|
|
26
26
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# Deletes the node
|
|
30
|
-
#
|
|
31
|
-
# @param node [Node] the node to delete
|
|
32
|
-
#
|
|
33
|
-
# @return [void]
|
|
34
|
-
def delete(node)
|
|
35
|
-
client.delete(node.location)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
29
|
# A VFabric node
|
|
39
30
|
class Node < Shared::Node
|
|
40
|
-
|
|
31
|
+
|
|
32
|
+
include Shared::Deletable
|
|
33
|
+
|
|
41
34
|
# @private
|
|
42
35
|
def initialize(location, client)
|
|
43
36
|
super(location, client)
|
|
@@ -45,7 +38,7 @@ module VFabric
|
|
|
45
38
|
|
|
46
39
|
# @return [String] a string representation of the node
|
|
47
40
|
def to_s
|
|
48
|
-
"#<#{self.class} host_names='#{host_names}' ip_addresses='#{ip_addresses}' operating_system='#{operating_system}' architecture='#{architecture}' agent_home='#{agent_home}' metadata='#{metadata}'>"
|
|
41
|
+
"#<#{self.class} host_names='#{host_names}' ip_addresses='#{ip_addresses}' ipv4_addresses='#{ipv4_addresses}' ipv6_addresses='#{ipv6_addresses}' operating_system='#{operating_system}' architecture='#{architecture}' agent_home='#{agent_home}' metadata='#{metadata}'>"
|
|
49
42
|
end
|
|
50
43
|
|
|
51
44
|
end
|
data/lib/vas/vfabric/v_fabric.rb
CHANGED
|
@@ -28,8 +28,8 @@ module VFabric
|
|
|
28
28
|
# @private
|
|
29
29
|
def initialize(location, client)
|
|
30
30
|
json = client.get(location)
|
|
31
|
-
@nodes = Nodes.new(Util::LinkUtils.get_link_href(json,
|
|
32
|
-
@agent_image = AgentImage.new(Util::LinkUtils.get_link_href(json,
|
|
31
|
+
@nodes = Nodes.new(Util::LinkUtils.get_link_href(json, 'nodes'), client)
|
|
32
|
+
@agent_image = AgentImage.new(Util::LinkUtils.get_link_href(json, 'agent-image'), client)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
end
|
|
@@ -23,12 +23,18 @@ class VFabricAdministrationServer
|
|
|
23
23
|
# @return [RabbitMq::RabbitMq] the RabbitMQ API
|
|
24
24
|
attr_reader :rabbitmq
|
|
25
25
|
|
|
26
|
+
# @return [Sqlfire::Sqlfire, nil] the SQLFire API, or +nil+ if the server is not version 1.1.0 or later
|
|
27
|
+
attr_reader :sqlfire
|
|
28
|
+
|
|
26
29
|
# @return [TcServer::TcServer] the tc Server API
|
|
27
30
|
attr_reader :tc_server
|
|
28
31
|
|
|
29
32
|
# @return [VFabric::VFabric] the vFabric API
|
|
30
33
|
attr_reader :vfabric
|
|
31
34
|
|
|
35
|
+
# @return [WebServer::WebServer, nil] the vFabric Web Server API, or +nil+ if the server is not version 1.1.0 or later
|
|
36
|
+
attr_reader :web_server
|
|
37
|
+
|
|
32
38
|
# Creates an entry point that will connect to a vFabric Administration Server.
|
|
33
39
|
# @param [Hash] configuration the connection configuration
|
|
34
40
|
# @option configuration [String] :username ('admin') The username to use to authenticate with the server
|
|
@@ -36,15 +42,40 @@ class VFabricAdministrationServer
|
|
|
36
42
|
# @option configuration [String] :host ('localhost') The host of the server
|
|
37
43
|
# @option configuration [Integer] :port (8443) The HTTPS port of the server
|
|
38
44
|
def initialize(configuration = {})
|
|
39
|
-
|
|
45
|
+
|
|
46
|
+
configuration.has_key?(:client) ?
|
|
47
|
+
client = configuration[:client] :
|
|
48
|
+
client = Util::Client.new(configuration[:username] || "admin", configuration[:password] || "vmware")
|
|
40
49
|
|
|
41
50
|
host = configuration[:host] || "localhost"
|
|
42
51
|
port = configuration[:port] || 8443
|
|
43
52
|
|
|
44
|
-
@
|
|
45
|
-
@
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
@gemfire = Gemfire::Gemfire.new("https://#{host}:#{port}/gemfire/v1/", client)
|
|
54
|
+
@rabbitmq = RabbitMq::RabbitMq.new("https://#{host}:#{port}/rabbitmq/v1/", client)
|
|
55
|
+
|
|
56
|
+
sqlfire_location = "https://#{host}:#{port}/sqlfire/v1/"
|
|
57
|
+
@sqlfire = Sqlfire::Sqlfire.new(sqlfire_location, client) if available? sqlfire_location, client
|
|
58
|
+
|
|
59
|
+
@tc_server = TcServer::TcServer.new("https://#{host}:#{port}/tc-server/v1/", client)
|
|
60
|
+
@vfabric = VFabric::VFabric.new("https://#{host}:#{port}/vfabric/v1/", client)
|
|
61
|
+
|
|
62
|
+
web_server_location = "https://#{host}:#{port}/web-server/v1/"
|
|
63
|
+
@web_server = WebServer::WebServer.new(web_server_location, client) if available? web_server_location, client
|
|
48
64
|
end
|
|
49
|
-
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def available? (location, client)
|
|
69
|
+
begin
|
|
70
|
+
client.get(location)
|
|
71
|
+
true
|
|
72
|
+
rescue VasException => error
|
|
73
|
+
if error.code == 404
|
|
74
|
+
false
|
|
75
|
+
else
|
|
76
|
+
raise error
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
50
81
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
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 WebServer
|
|
18
|
+
|
|
19
|
+
# A configuration file in a Web Server instance
|
|
20
|
+
class Configuration < Shared::Configuration
|
|
21
|
+
|
|
22
|
+
# @private
|
|
23
|
+
def initialize(location, client)
|
|
24
|
+
super(location, client, 'group-instance', Instance)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
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
|
+
module WebServer
|
|
18
|
+
|
|
19
|
+
# Used to enumerate, create, and delete Web Server groups
|
|
20
|
+
class Groups < Shared::Groups
|
|
21
|
+
|
|
22
|
+
# @private
|
|
23
|
+
def initialize(location, client)
|
|
24
|
+
super(location, client, Group)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# A Web Server group
|
|
30
|
+
class Group < Shared::MutableGroup
|
|
31
|
+
|
|
32
|
+
# @private
|
|
33
|
+
def initialize(location, client)
|
|
34
|
+
super(location, client, Node, Installations)
|
|
35
|
+
@instances_location = Util::LinkUtils.get_link_href(details, 'group-instances')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @return [Instances] the group's instances
|
|
39
|
+
def instances
|
|
40
|
+
@instances ||= Instances.new(@instances_location, client)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
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 WebServer
|
|
18
|
+
|
|
19
|
+
# Used to enumerate, create, and delete Web Server installation images.
|
|
20
|
+
class InstallationImages < Shared::InstallationImages
|
|
21
|
+
|
|
22
|
+
# @private
|
|
23
|
+
def initialize(location, client)
|
|
24
|
+
super(location, client, InstallationImage)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Creates an installation image by uploading a file to the server and assigning it a version, architecture,
|
|
28
|
+
# and operating system
|
|
29
|
+
#
|
|
30
|
+
# @param path the path of the file to upload
|
|
31
|
+
# @param version [String] the installation image's version
|
|
32
|
+
# @param architecture [String] the installation image's architecture
|
|
33
|
+
# @param operating_system [String] the installation image's operating system
|
|
34
|
+
#
|
|
35
|
+
# @return [InstallationImage] the new installation image
|
|
36
|
+
def create(path, version, architecture, operating_system)
|
|
37
|
+
create_image(path, { :version => version,
|
|
38
|
+
:architecture => architecture,
|
|
39
|
+
'operating-system' => operating_system })
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# A Web Server installation image
|
|
45
|
+
class InstallationImage < Shared::InstallationImage
|
|
46
|
+
|
|
47
|
+
# @private
|
|
48
|
+
def initialize(location, client)
|
|
49
|
+
super(location, client, Installation)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
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 WebServer
|
|
18
|
+
|
|
19
|
+
# Used to enumerate, create, and delete Web Server installations
|
|
20
|
+
class Installations < Shared::Installations
|
|
21
|
+
|
|
22
|
+
# @private
|
|
23
|
+
def initialize(location, client)
|
|
24
|
+
super(location, client, Installation)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# A Web Server installation
|
|
30
|
+
class Installation < Shared::Installation
|
|
31
|
+
|
|
32
|
+
# @private
|
|
33
|
+
def initialize(location, client)
|
|
34
|
+
super(location, client, InstallationImage, Group)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Reloads the installation's details from the server
|
|
38
|
+
#
|
|
39
|
+
# @return [void]
|
|
40
|
+
def reload
|
|
41
|
+
super
|
|
42
|
+
@instances = nil
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @return [Instance[]] the instances that are using the installation
|
|
46
|
+
def instances
|
|
47
|
+
@instances ||= create_resources_from_links('group-instance', Instance)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|