fog 0.0.77 → 0.0.78
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/fog.gemspec +59 -48
- data/lib/fog.rb +2 -1
- data/lib/fog/aws/models/ec2/snapshot.rb +3 -1
- data/lib/fog/aws/models/ec2/volume.rb +4 -2
- data/lib/fog/aws/s3.rb +1 -1
- data/lib/fog/deprecation.rb +14 -0
- data/lib/fog/terremark.rb +7 -220
- data/lib/fog/terremark/bin.rb +24 -14
- data/lib/fog/terremark/ecloud.rb +51 -0
- data/lib/fog/terremark/models/shared/address.rb +29 -0
- data/lib/fog/terremark/models/shared/addresses.rb +49 -0
- data/lib/fog/terremark/models/shared/network.rb +30 -0
- data/lib/fog/terremark/models/shared/networks.rb +52 -0
- data/lib/fog/terremark/models/shared/server.rb +57 -0
- data/lib/fog/terremark/models/shared/servers.rb +55 -0
- data/lib/fog/terremark/models/shared/task.rb +43 -0
- data/lib/fog/terremark/models/shared/tasks.rb +58 -0
- data/lib/fog/terremark/parser.rb +18 -0
- data/lib/fog/terremark/parsers/shared/get_catalog.rb +46 -0
- data/lib/fog/terremark/parsers/shared/get_catalog_item.rb +46 -0
- data/lib/fog/terremark/parsers/shared/get_internet_services.rb +60 -0
- data/lib/fog/terremark/parsers/{get_node_services.rb → shared/get_node_services.rb} +10 -11
- data/lib/fog/terremark/parsers/shared/get_organization.rb +47 -0
- data/lib/fog/terremark/parsers/shared/get_organizations.rb +27 -0
- data/lib/fog/terremark/parsers/shared/get_public_ips.rb +30 -0
- data/lib/fog/terremark/parsers/shared/get_tasks_list.rb +52 -0
- data/lib/fog/terremark/parsers/shared/get_vapp_template.rb +46 -0
- data/lib/fog/terremark/parsers/shared/get_vdc.rb +108 -0
- data/lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb +41 -0
- data/lib/fog/terremark/parsers/shared/internet_service.rb +65 -0
- data/lib/fog/terremark/parsers/shared/network.rb +51 -0
- data/lib/fog/terremark/parsers/shared/node_service.rb +32 -0
- data/lib/fog/terremark/parsers/shared/public_ip.rb +26 -0
- data/lib/fog/terremark/parsers/shared/task.rb +40 -0
- data/lib/fog/terremark/parsers/shared/vapp.rb +47 -0
- data/lib/fog/terremark/requests/shared/add_internet_service.rb +63 -0
- data/lib/fog/terremark/requests/shared/add_node_service.rb +63 -0
- data/lib/fog/terremark/requests/shared/create_internet_service.rb +63 -0
- data/lib/fog/terremark/requests/shared/delete_internet_service.rb +42 -0
- data/lib/fog/terremark/requests/shared/delete_node_service.rb +42 -0
- data/lib/fog/terremark/requests/shared/delete_public_ip.rb +30 -0
- data/lib/fog/terremark/requests/shared/delete_vapp.rb +42 -0
- data/lib/fog/terremark/requests/shared/deploy_vapp.rb +43 -0
- data/lib/fog/terremark/requests/shared/get_catalog.rb +40 -0
- data/lib/fog/terremark/requests/shared/get_catalog_item.rb +43 -0
- data/lib/fog/terremark/requests/shared/get_internet_services.rb +43 -0
- data/lib/fog/terremark/requests/shared/get_network.rb +37 -0
- data/lib/fog/terremark/requests/shared/get_node_services.rb +38 -0
- data/lib/fog/terremark/requests/shared/get_organization.rb +42 -0
- data/lib/fog/terremark/requests/shared/get_organizations.rb +39 -0
- data/lib/fog/terremark/requests/shared/get_public_ip.rb +41 -0
- data/lib/fog/terremark/requests/shared/get_public_ips.rb +41 -0
- data/lib/fog/terremark/requests/shared/get_task.rb +47 -0
- data/lib/fog/terremark/requests/shared/get_tasks_list.rb +40 -0
- data/lib/fog/terremark/requests/shared/get_vapp.rb +50 -0
- data/lib/fog/terremark/requests/shared/get_vapp_template.rb +43 -0
- data/lib/fog/terremark/requests/shared/get_vdc.rb +43 -0
- data/lib/fog/terremark/requests/shared/instantiate_vapp_template.rb +79 -0
- data/lib/fog/terremark/requests/shared/power_off.rb +43 -0
- data/lib/fog/terremark/requests/shared/power_on.rb +43 -0
- data/lib/fog/terremark/requests/shared/reset.rb +43 -0
- data/lib/fog/terremark/requests/shared/shutdown.rb +43 -0
- data/lib/fog/terremark/shared.rb +139 -0
- data/lib/fog/terremark/vcloud.rb +98 -0
- metadata +60 -49
- data/lib/fog/terremark/models/server.rb +0 -56
- data/lib/fog/terremark/models/servers.rb +0 -53
- data/lib/fog/terremark/models/task.rb +0 -41
- data/lib/fog/terremark/models/tasks.rb +0 -56
- data/lib/fog/terremark/parsers/get_catalog.rb +0 -44
- data/lib/fog/terremark/parsers/get_catalog_item.rb +0 -44
- data/lib/fog/terremark/parsers/get_internet_services.rb +0 -58
- data/lib/fog/terremark/parsers/get_organization.rb +0 -45
- data/lib/fog/terremark/parsers/get_organizations.rb +0 -26
- data/lib/fog/terremark/parsers/get_public_ips.rb +0 -28
- data/lib/fog/terremark/parsers/get_tasks_list.rb +0 -50
- data/lib/fog/terremark/parsers/get_vapp_template.rb +0 -44
- data/lib/fog/terremark/parsers/get_vdc.rb +0 -106
- data/lib/fog/terremark/parsers/instantiate_vapp_template.rb +0 -39
- data/lib/fog/terremark/parsers/internet_service.rb +0 -63
- data/lib/fog/terremark/parsers/node_service.rb +0 -30
- data/lib/fog/terremark/parsers/public_ip.rb +0 -24
- data/lib/fog/terremark/parsers/task.rb +0 -38
- data/lib/fog/terremark/parsers/vapp.rb +0 -45
- data/lib/fog/terremark/requests/add_internet_service.rb +0 -61
- data/lib/fog/terremark/requests/add_node_service.rb +0 -61
- data/lib/fog/terremark/requests/create_internet_service.rb +0 -61
- data/lib/fog/terremark/requests/delete_internet_service.rb +0 -40
- data/lib/fog/terremark/requests/delete_node_service.rb +0 -40
- data/lib/fog/terremark/requests/delete_public_ip.rb +0 -28
- data/lib/fog/terremark/requests/delete_vapp.rb +0 -40
- data/lib/fog/terremark/requests/deploy_vapp.rb +0 -41
- data/lib/fog/terremark/requests/get_catalog.rb +0 -38
- data/lib/fog/terremark/requests/get_catalog_item.rb +0 -41
- data/lib/fog/terremark/requests/get_internet_services.rb +0 -41
- data/lib/fog/terremark/requests/get_node_services.rb +0 -36
- data/lib/fog/terremark/requests/get_organization.rb +0 -40
- data/lib/fog/terremark/requests/get_organizations.rb +0 -37
- data/lib/fog/terremark/requests/get_public_ip.rb +0 -35
- data/lib/fog/terremark/requests/get_public_ips.rb +0 -35
- data/lib/fog/terremark/requests/get_task.rb +0 -45
- data/lib/fog/terremark/requests/get_tasks_list.rb +0 -38
- data/lib/fog/terremark/requests/get_vapp.rb +0 -48
- data/lib/fog/terremark/requests/get_vapp_template.rb +0 -41
- data/lib/fog/terremark/requests/get_vdc.rb +0 -41
- data/lib/fog/terremark/requests/instantiate_vapp_template.rb +0 -77
- data/lib/fog/terremark/requests/power_off.rb +0 -41
- data/lib/fog/terremark/requests/power_on.rb +0 -41
- data/lib/fog/terremark/requests/reset.rb +0 -41
- data/lib/fog/terremark/requests/shutdown.rb +0 -41
@@ -0,0 +1,41 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
module Shared
|
5
|
+
|
6
|
+
class InstantiateVappTemplate < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@property_key
|
10
|
+
@response = { 'Links' => [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def start_element(name, attributes)
|
14
|
+
@value = ''
|
15
|
+
case name
|
16
|
+
when 'Link'
|
17
|
+
link = {}
|
18
|
+
until attributes.empty?
|
19
|
+
link[attributes.shift] = attributes.shift
|
20
|
+
end
|
21
|
+
@response['Links'] << link
|
22
|
+
when 'VApp'
|
23
|
+
vapp_template = {}
|
24
|
+
until attributes.empty?
|
25
|
+
if attributes.first.is_a?(Array)
|
26
|
+
attribute = attributes.shift
|
27
|
+
vapp_template[attribute.first] = attribute.last
|
28
|
+
else
|
29
|
+
vapp_template[attributes.shift] = attributes.shift
|
30
|
+
end
|
31
|
+
end
|
32
|
+
@response.merge!(vapp_template.reject {|key, value| !['href', 'name', 'size', 'status', 'type'].include?(key)})
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
module Shared
|
5
|
+
|
6
|
+
class InternetService < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@in_public_ip_address = false
|
10
|
+
@response = { 'PublicIpAddress' => {} }
|
11
|
+
end
|
12
|
+
|
13
|
+
def start_element(name, attributes)
|
14
|
+
@value = ''
|
15
|
+
case name
|
16
|
+
when 'Href'
|
17
|
+
data = {}
|
18
|
+
until attributes.empty?
|
19
|
+
data[attributes.shift] = attributes.shift
|
20
|
+
end
|
21
|
+
if @in_public_ip_address
|
22
|
+
@response['PublicIpAddress'][name] = data
|
23
|
+
else
|
24
|
+
@response[name] = data
|
25
|
+
end
|
26
|
+
when 'PublicIpAddress'
|
27
|
+
@in_public_ip_address = true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def end_element(name)
|
32
|
+
case name
|
33
|
+
when 'Description', 'Protocol'
|
34
|
+
@response[name] = @value
|
35
|
+
when 'Enabled'
|
36
|
+
if @value == 'false'
|
37
|
+
@response[name] = false
|
38
|
+
else
|
39
|
+
@response[name] = true
|
40
|
+
end
|
41
|
+
when 'Id'
|
42
|
+
if @in_public_ip_address
|
43
|
+
@response['PublicIpAddress'][name] = @value.to_i
|
44
|
+
else
|
45
|
+
@response[name] = @value.to_i
|
46
|
+
end
|
47
|
+
when 'Name'
|
48
|
+
if @in_public_ip_address
|
49
|
+
@response['PublicIpAddress'][name] = @value
|
50
|
+
else
|
51
|
+
@response[name] = @value
|
52
|
+
end
|
53
|
+
when 'Port', 'Timeout'
|
54
|
+
@response[name] = @value.to_i
|
55
|
+
when 'PublicIpAddress'
|
56
|
+
@in_public_ip_address = false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
module Shared
|
5
|
+
|
6
|
+
class Network < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = {
|
10
|
+
"links" => []
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
def start_element(name,attributes=[])
|
15
|
+
@value = ''
|
16
|
+
case name
|
17
|
+
when "Network"
|
18
|
+
until attributes.empty?
|
19
|
+
val = attributes.shift
|
20
|
+
if val.is_a?(String)
|
21
|
+
@response[val] = attributes.shift
|
22
|
+
end
|
23
|
+
end
|
24
|
+
if @response.has_key?("name")
|
25
|
+
@response["subnet"] = @response["name"]
|
26
|
+
end
|
27
|
+
if @response.has_key?("href")
|
28
|
+
@response["id"] = @response["href"].split("/").last
|
29
|
+
end
|
30
|
+
when "Link"
|
31
|
+
link = {}
|
32
|
+
until attributes.empty?
|
33
|
+
link[attributes.shift] = attributes.shift
|
34
|
+
end
|
35
|
+
@response["links"] << link
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def end_element(name)
|
40
|
+
case name
|
41
|
+
when "Gateway", "Netmask", "FenceMode"
|
42
|
+
@response[name.downcase] = @value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
module Shared
|
5
|
+
|
6
|
+
class NodeService < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def end_element(name)
|
13
|
+
case name
|
14
|
+
when 'Description', 'Href', 'IpAddress', 'Name', 'Protocol'
|
15
|
+
@response[name] = @value
|
16
|
+
when 'Enabled'
|
17
|
+
if @value == 'false'
|
18
|
+
@response[name] = false
|
19
|
+
else
|
20
|
+
@response[name] = true
|
21
|
+
end
|
22
|
+
when 'Id', 'Port'
|
23
|
+
@response[name] = @value.to_i
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
module Shared
|
5
|
+
|
6
|
+
class PublicIp < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def end_element(name)
|
13
|
+
case name
|
14
|
+
when 'Href', 'Name'
|
15
|
+
@response[name.downcase] = @value
|
16
|
+
when 'Id'
|
17
|
+
@response['id'] = @value.to_i
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
module Shared
|
5
|
+
|
6
|
+
class Task < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attributes)
|
13
|
+
@value = ''
|
14
|
+
case name
|
15
|
+
when 'Owner', 'Result'
|
16
|
+
data = {}
|
17
|
+
until attributes.empty?
|
18
|
+
data[attributes.shift] = attributes.shift
|
19
|
+
end
|
20
|
+
@response[name] = data
|
21
|
+
when 'Task'
|
22
|
+
task = {}
|
23
|
+
until attributes.empty?
|
24
|
+
if attributes.first.is_a?(Array)
|
25
|
+
attribute = attributes.shift
|
26
|
+
task[attribute.first] = attribute.last
|
27
|
+
else
|
28
|
+
task[attributes.shift] = attributes.shift
|
29
|
+
end
|
30
|
+
end
|
31
|
+
@response.merge!(task.reject {|key,value| !['endTime', 'href', 'startTime', 'status', 'type'].include?(key)})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
module Shared
|
5
|
+
|
6
|
+
class Vapp < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'Links' => [] }
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attributes)
|
13
|
+
@value = ''
|
14
|
+
case name
|
15
|
+
when 'Link'
|
16
|
+
link = {}
|
17
|
+
until attributes.empty?
|
18
|
+
link[attributes.shift] = attributes.shift
|
19
|
+
end
|
20
|
+
@response['Links'] << link
|
21
|
+
when 'Vapp'
|
22
|
+
vapp = {}
|
23
|
+
until attributes.empty?
|
24
|
+
if attributes.first.is_a?(Array)
|
25
|
+
attribute = attributes.shift
|
26
|
+
vapp[attribute.first] = attribute.last
|
27
|
+
else
|
28
|
+
vapp[attributes.shift] = attributes.shift
|
29
|
+
end
|
30
|
+
end
|
31
|
+
@response.merge!(vapp.reject {|key,value| !['href', 'name', 'size', 'status', 'type'].include?(key)})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def end_element(name)
|
36
|
+
case name
|
37
|
+
when 'IpAddress'
|
38
|
+
@response['IpAddress'] = @value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
module Shared
|
4
|
+
module Real
|
5
|
+
|
6
|
+
# Reserve requested resources and deploy vApp
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * ip_id<~Integer> - Id of ip to add service to
|
10
|
+
# * name<~String> - Name of service
|
11
|
+
# * protocol<~String> - Protocol of service
|
12
|
+
# * port<~Integer> - Port of service
|
13
|
+
# * options<~Hash>:
|
14
|
+
# * Enabled<~Boolean>: defaults to true
|
15
|
+
# * Description<~String>: optional description
|
16
|
+
#
|
17
|
+
# ==== Returns
|
18
|
+
# * response<~Excon::Response>:
|
19
|
+
# * body<~Hash>:
|
20
|
+
# * 'endTime'<~String> - endTime of task
|
21
|
+
# * 'href'<~String> - link to task
|
22
|
+
# * 'startTime'<~String> - startTime of task
|
23
|
+
# * 'status'<~String> - status of task
|
24
|
+
# * 'type'<~String> - type of task
|
25
|
+
# * 'Owner'<~String> -
|
26
|
+
# * 'href'<~String> - href of owner
|
27
|
+
# * 'name'<~String> - name of owner
|
28
|
+
# * 'type'<~String> - type of owner
|
29
|
+
def add_internet_service(ip_id, name, protocol, port, options = {})
|
30
|
+
unless options.has_key?('Enabled')
|
31
|
+
options['Enabled'] = true
|
32
|
+
end
|
33
|
+
data = <<-DATA
|
34
|
+
<InternetService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:tmrk:vCloudExpress-1.0:request:createInternetService">
|
35
|
+
<Name>#{name}</Name>
|
36
|
+
<Protocol>#{protocol.upcase}</Protocol>
|
37
|
+
<Port>#{port}</Port>
|
38
|
+
<Enabled>#{options['Enabled']}</Enabled>
|
39
|
+
<Description>#{options['Description']}</Description>
|
40
|
+
</InternetService>
|
41
|
+
DATA
|
42
|
+
request(
|
43
|
+
:body => data,
|
44
|
+
:expects => 200,
|
45
|
+
:headers => {'Content-Type' => 'application/xml'},
|
46
|
+
:method => 'POST',
|
47
|
+
:parser => Fog::Parsers::Terremark::Shared::InternetService.new,
|
48
|
+
:path => "publicIps/#{ip_id}/internetServices"
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
module Mock
|
55
|
+
|
56
|
+
def add_internet_service(ip_id)
|
57
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
module Shared
|
4
|
+
module Real
|
5
|
+
|
6
|
+
# Reserve requested resources and deploy vApp
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * service_id<~String> - Id of service to add node to
|
10
|
+
# * ip<~String> - Private ip of server to add to node
|
11
|
+
# * name<~String> - Name of service
|
12
|
+
# * port<~Integer> - Port of service
|
13
|
+
# * options<~Hash>:
|
14
|
+
# * Enabled<~Boolean>: defaults to true
|
15
|
+
# * Description<~String>: optional description
|
16
|
+
#
|
17
|
+
# ==== Returns
|
18
|
+
# * response<~Excon::Response>:
|
19
|
+
# * body<~Hash>:
|
20
|
+
# * 'endTime'<~String> - endTime of task
|
21
|
+
# * 'href'<~String> - link to task
|
22
|
+
# * 'startTime'<~String> - startTime of task
|
23
|
+
# * 'status'<~String> - status of task
|
24
|
+
# * 'type'<~String> - type of task
|
25
|
+
# * 'Owner'<~String> -
|
26
|
+
# * 'href'<~String> - href of owner
|
27
|
+
# * 'name'<~String> - name of owner
|
28
|
+
# * 'type'<~String> - type of owner
|
29
|
+
def add_node_service(service_id, ip, name, port, options = {})
|
30
|
+
unless options.has_key?('Enabled')
|
31
|
+
options['Enabled'] = true
|
32
|
+
end
|
33
|
+
data = <<-DATA
|
34
|
+
<NodeService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:tmrk:vCloudExpress-1.0:request:createNodeService">
|
35
|
+
<IpAddress>#{ip}</IpAddress>
|
36
|
+
<Name>#{name}</Name>
|
37
|
+
<Port>#{port}</Port>
|
38
|
+
<Enabled>#{options['Enabled']}</Enabled>
|
39
|
+
<Description>#{options['Description']}</Description>
|
40
|
+
</NodeService>
|
41
|
+
DATA
|
42
|
+
request(
|
43
|
+
:body => data,
|
44
|
+
:expects => 200,
|
45
|
+
:headers => {'Content-Type' => 'application/xml'},
|
46
|
+
:method => 'POST',
|
47
|
+
:parser => Fog::Parsers::Terremark::Shared::InternetService.new,
|
48
|
+
:path => "internetServices/#{service_id}/nodes"
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
module Mock
|
55
|
+
|
56
|
+
def add_node_service(ip)
|
57
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
module Shared
|
4
|
+
module Real
|
5
|
+
|
6
|
+
# Reserve requested resources and deploy vApp
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * vdc_id<~Integer> - Id of vDc to add internet service to
|
10
|
+
# * name<~String> - Name of service
|
11
|
+
# * protocol<~String> - Protocol of service
|
12
|
+
# * port<~Integer> - Port of service
|
13
|
+
# * options<~Hash>:
|
14
|
+
# * Enabled<~Boolean>: defaults to true
|
15
|
+
# * Description<~String>: optional description
|
16
|
+
#
|
17
|
+
# ==== Returns
|
18
|
+
# * response<~Excon::Response>:
|
19
|
+
# * body<~Hash>:
|
20
|
+
# * 'endTime'<~String> - endTime of task
|
21
|
+
# * 'href'<~String> - link to task
|
22
|
+
# * 'startTime'<~String> - startTime of task
|
23
|
+
# * 'status'<~String> - status of task
|
24
|
+
# * 'type'<~String> - type of task
|
25
|
+
# * 'Owner'<~String> -
|
26
|
+
# * 'href'<~String> - href of owner
|
27
|
+
# * 'name'<~String> - name of owner
|
28
|
+
# * 'type'<~String> - type of owner
|
29
|
+
def create_internet_service(vdc_id, name, protocol, port, options = {})
|
30
|
+
unless options.has_key?('Enabled')
|
31
|
+
options['Enabled'] = true
|
32
|
+
end
|
33
|
+
data = <<-DATA
|
34
|
+
<InternetService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:tmrk:vCloudExpress-1.0:request:createInternetService">
|
35
|
+
<Name>#{name}</Name>
|
36
|
+
<Protocol>#{protocol.upcase}</Protocol>
|
37
|
+
<Port>#{port}</Port>
|
38
|
+
<Enabled>#{options['Enabled']}</Enabled>
|
39
|
+
<Description>#{options['Description']}</Description>
|
40
|
+
</InternetService>
|
41
|
+
DATA
|
42
|
+
request(
|
43
|
+
:body => data,
|
44
|
+
:expects => 200,
|
45
|
+
:headers => {'Content-Type' => 'application/xml'},
|
46
|
+
:method => 'POST',
|
47
|
+
:parser => Fog::Parsers::Terremark::Shared::InternetService.new,
|
48
|
+
:path => "vdc/#{vdc_id}/internetServices"
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
module Mock
|
55
|
+
|
56
|
+
def create_internet_service(vdc_id)
|
57
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|