fog 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -8
- data/Gemfile.lock +3 -3
- data/bin/fog +2 -10
- data/fog.gemspec +45 -20
- data/lib/fog.rb +2 -1
- data/lib/fog/attributes.rb +48 -8
- data/lib/fog/aws/ec2.rb +5 -2
- data/lib/fog/aws/elb.rb +5 -2
- data/lib/fog/aws/models/ec2/server.rb +1 -1
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +43 -12
- data/lib/fog/aws/s3.rb +2 -2
- data/lib/fog/aws/simpledb.rb +15 -3
- data/lib/fog/bin.rb +11 -2
- data/lib/fog/bluebox.rb +5 -1
- data/lib/fog/connection.rb +9 -1
- data/lib/fog/credentials.rb +3 -0
- data/lib/fog/new_servers.rb +89 -0
- data/lib/fog/new_servers/bin.rb +30 -0
- data/lib/fog/new_servers/requests/add_server.rb +39 -0
- data/lib/fog/new_servers/requests/cancel_server.rb +36 -0
- data/lib/fog/new_servers/requests/get_server.rb +42 -0
- data/lib/fog/new_servers/requests/list_images.rb +33 -0
- data/lib/fog/new_servers/requests/list_plans.rb +36 -0
- data/lib/fog/new_servers/requests/list_servers.rb +43 -0
- data/lib/fog/new_servers/requests/reboot_server.rb +30 -0
- data/lib/fog/parser.rb +6 -0
- data/lib/fog/rackspace/files.rb +8 -2
- data/lib/fog/rackspace/models/servers/server.rb +5 -0
- data/lib/fog/rackspace/servers.rb +5 -1
- data/lib/fog/service.rb +6 -1
- data/lib/fog/slicehost.rb +5 -1
- data/lib/fog/terremark/ecloud.rb +1 -0
- data/lib/fog/terremark/shared.rb +4 -1
- data/lib/fog/terremark/vcloud.rb +1 -0
- data/lib/fog/vcloud.rb +150 -141
- data/lib/fog/vcloud/bin.rb +2 -2
- data/lib/fog/vcloud/collection.rb +3 -84
- data/lib/fog/vcloud/extension.rb +44 -0
- data/lib/fog/vcloud/generators.rb +33 -0
- data/lib/fog/vcloud/model.rb +5 -38
- data/lib/fog/vcloud/models/vdc.rb +14 -24
- data/lib/fog/vcloud/models/vdcs.rb +13 -8
- data/lib/fog/vcloud/requests/get_network.rb +4 -11
- data/lib/fog/vcloud/requests/get_organization.rb +4 -11
- data/lib/fog/vcloud/requests/get_vdc.rb +4 -12
- data/lib/fog/vcloud/requests/get_versions.rb +4 -13
- data/lib/fog/vcloud/requests/login.rb +4 -4
- data/lib/fog/vcloud/terremark/ecloud.rb +125 -54
- data/lib/fog/vcloud/terremark/ecloud/models/catalog.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/catalog_item.rb +31 -0
- data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +21 -22
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +11 -25
- data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +38 -5
- data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +11 -15
- data/lib/fog/vcloud/terremark/ecloud/models/network.rb +52 -11
- data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +14 -13
- data/lib/fog/vcloud/terremark/ecloud/models/node.rb +47 -0
- data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/public_ip.rb +6 -9
- data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +19 -3
- data/lib/fog/vcloud/terremark/ecloud/models/server.rb +203 -0
- data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +43 -0
- data/lib/fog/vcloud/terremark/ecloud/models/task.rb +22 -0
- data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +32 -10
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +5 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +23 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +54 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +14 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +53 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +52 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +42 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb +115 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_internet_service.rb +4 -23
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_node.rb +0 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +9 -16
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network.rb +8 -14
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +36 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +44 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +11 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_node.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_nodes.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb +5 -19
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb +5 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task_list.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vapp.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +7 -15
- data/lib/fog/vcloud/terremark/ecloud/requests/power_off.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_on.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_reset.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_shutdown.rb +18 -0
- data/lib/fog/vcloud/terremark/vcloud.rb +4 -18
- data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +4 -12
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +18 -0
- data/spec/vcloud/bin_spec.rb +2 -2
- data/spec/vcloud/models/vdc_spec.rb +35 -29
- data/spec/vcloud/requests/get_network_spec.rb +32 -43
- data/spec/vcloud/requests/get_organization_spec.rb +45 -38
- data/spec/vcloud/requests/get_vdc_spec.rb +42 -32
- data/spec/vcloud/requests/get_versions_spec.rb +17 -17
- data/spec/vcloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/spec_helper.rb +137 -46
- data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +53 -58
- data/spec/vcloud/terremark/ecloud/models/internet_services_spec.rb +20 -20
- data/spec/vcloud/terremark/ecloud/models/ip_spec.rb +22 -21
- data/spec/vcloud/terremark/ecloud/models/ips_spec.rb +18 -18
- data/spec/vcloud/terremark/ecloud/models/network_spec.rb +55 -51
- data/spec/vcloud/terremark/ecloud/models/networks_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/public_ip_spec.rb +26 -27
- data/spec/vcloud/terremark/ecloud/models/public_ips_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/vdc_spec.rb +52 -36
- data/spec/vcloud/terremark/ecloud/models/vdcs_spec.rb +18 -15
- data/spec/vcloud/terremark/ecloud/requests/add_internet_service_spec.rb +46 -43
- data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +37 -32
- data/spec/vcloud/terremark/ecloud/requests/delete_internet_service_spec.rb +26 -23
- data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +57 -49
- data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +41 -0
- data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +39 -34
- data/spec/vcloud/terremark/ecloud/requests/get_network_spec.rb +26 -48
- data/spec/vcloud/terremark/ecloud/requests/get_public_ip_spec.rb +25 -26
- data/spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb +35 -27
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +85 -110
- data/spec/vcloud/terremark/ecloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/vcloud_spec.rb +9 -8
- metadata +62 -26
- data/lib/fog/vcloud/parser.rb +0 -42
- data/lib/fog/vcloud/parsers/get_organization.rb +0 -37
- data/lib/fog/vcloud/parsers/get_vdc.rb +0 -62
- data/lib/fog/vcloud/parsers/get_versions.rb +0 -46
- data/lib/fog/vcloud/parsers/login.rb +0 -36
- data/lib/fog/vcloud/parsers/network.rb +0 -53
- data/lib/fog/vcloud/terremark/all.rb +0 -9
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_internet_services.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ip.rb +0 -30
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ips.rb +0 -40
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/internet_service.rb +0 -58
- data/lib/fog/vcloud/terremark/ecloud/parsers/network.rb +0 -28
- data/lib/fog/vcloud/terremark/ecloud/parsers/network_ips.rb +0 -31
- data/lib/fog/vcloud/terremark/ecloud/requests/login.rb +0 -27
- data/lib/fog/vcloud/terremark/vcloud/parsers/get_vdc.rb +0 -34
- data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +0 -74
@@ -0,0 +1,52 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
module Terremark
|
4
|
+
module Ecloud
|
5
|
+
module Real
|
6
|
+
|
7
|
+
def validate_network_ip_data(network_ip_data, configure=false)
|
8
|
+
valid_opts = [:id, :href, :name, :status, :server, :rnat]
|
9
|
+
unless valid_opts.all? { |opt| network_ip_data.keys.include?(opt) }
|
10
|
+
raise ArgumentError.new("Required data missing: #{(valid_opts - network_ip_data.keys).map(&:inspect).join(", ")}")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def configure_network_ip(network_ip_uri, network_ip_data)
|
15
|
+
validate_network_ip_data(network_ip_data)
|
16
|
+
|
17
|
+
request(
|
18
|
+
:body => generate_configure_network_ip_request(network_ip_data),
|
19
|
+
:expects => 200,
|
20
|
+
:headers => {'Content-Type' => 'application/vnd.tmrk.ecloud.ip+xml' },
|
21
|
+
:method => 'PUT',
|
22
|
+
:uri => network_ip_uri
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def generate_configure_network_ip_request(network_ip_data)
|
29
|
+
builder = Builder::XmlMarkup.new
|
30
|
+
builder.IpAddress(:"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance",
|
31
|
+
:xmlns => "urn:tmrk:eCloudExtensions-2.3") {
|
32
|
+
builder.Id(network_ip_data[:id])
|
33
|
+
builder.Href(network_ip_data[:href])
|
34
|
+
builder.Name(network_ip_data[:name])
|
35
|
+
builder.Status(network_ip_data[:status])
|
36
|
+
builder.Server(network_ip_data[:server])
|
37
|
+
builder.RnatAddress(network_ip_data[:rnat])
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
module Mock
|
44
|
+
|
45
|
+
def configure_network_ip(network_ip_uri, network_ip_data)
|
46
|
+
Fog::Mock.not_implemented
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
module Terremark
|
4
|
+
module Ecloud
|
5
|
+
module Real
|
6
|
+
|
7
|
+
def configure_node(node_uri, node_data)
|
8
|
+
validate_node_data(node_data, true)
|
9
|
+
|
10
|
+
request(
|
11
|
+
:body => generate_configure_node_request(node_data),
|
12
|
+
:expects => 200,
|
13
|
+
:headers => {'Content-Type' => 'application/vnd.tmrk.ecloud.nodeService+xml'},
|
14
|
+
:method => 'PUT',
|
15
|
+
:uri => node_uri
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def generate_configure_node_request(node_data)
|
22
|
+
builder = Builder::XmlMarkup.new
|
23
|
+
builder.NodeService(:"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance",
|
24
|
+
:xmlns => "urn:tmrk:eCloudExtensions-2.0") {
|
25
|
+
builder.Name(node_data[:name])
|
26
|
+
builder.Enabled(node_data[:enabled].to_s)
|
27
|
+
builder.Description(node_data[:description])
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
module Mock
|
34
|
+
|
35
|
+
def configure_node(node_uri, node_data)
|
36
|
+
Fog::Mock.not_implemented
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
module Terremark
|
4
|
+
module Ecloud
|
5
|
+
module Real
|
6
|
+
|
7
|
+
def generate_configure_vapp_request(vapp_uri, vapp_data)
|
8
|
+
rasd_xmlns = { "xmlns" => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" }
|
9
|
+
|
10
|
+
xml = Nokogiri::XML(request( :uri => vapp_uri).body)
|
11
|
+
xml.root['name'] = vapp_data[:name]
|
12
|
+
|
13
|
+
#cpu
|
14
|
+
xml.at("//xmlns:ResourceType[.='3']/..", rasd_xmlns).at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:cpus]
|
15
|
+
|
16
|
+
#memory
|
17
|
+
xml.at("//xmlns:ResourceType[.='4']/..", rasd_xmlns).at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:memory]
|
18
|
+
|
19
|
+
#disks
|
20
|
+
real_disks = xml.xpath("//xmlns:ResourceType[ .='17']/..", rasd_xmlns)
|
21
|
+
real_disk_numbers = real_disks.map { |disk| disk.at('.//xmlns:AddressOnParent', rasd_xmlns).content }
|
22
|
+
disk_numbers = vapp_data[:disks].map { |vdisk| vdisk[:number].to_s }
|
23
|
+
|
24
|
+
if vapp_data[:disks].length < real_disks.length
|
25
|
+
#Assume we're removing a disk
|
26
|
+
remove_disk_numbers = real_disk_numbers - disk_numbers
|
27
|
+
remove_disk_numbers.each do |number|
|
28
|
+
if result = xml.at("//xmlns:ResourceType[ .='17']/../xmlns:AddressOnParent[.='#{number}']/..", rasd_xmlns)
|
29
|
+
result.remove
|
30
|
+
end
|
31
|
+
end
|
32
|
+
elsif vapp_data[:disks].length > real_disks.length
|
33
|
+
add_disk_numbers = disk_numbers - real_disk_numbers
|
34
|
+
|
35
|
+
add_disk_numbers.each do |number|
|
36
|
+
new_disk = real_disks.first.dup
|
37
|
+
new_disk.at('.//xmlns:AddressOnParent', rasd_xmlns).content = -1
|
38
|
+
new_disk.at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:disks].detect { |disk| disk[:number].to_s == number.to_s }[:size]
|
39
|
+
real_disks.first.parent << new_disk
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
#puts xml.root.to_s
|
44
|
+
xml.root.to_s
|
45
|
+
|
46
|
+
#builder = Builder::XmlMarkup.new
|
47
|
+
#builder.Vapp(:href => vapp_uri.to_s,
|
48
|
+
# :type => 'application/vnd.vmware.vcloud.vApp+xml',
|
49
|
+
# :name => vapp_data[:name],
|
50
|
+
# :status => 2,
|
51
|
+
# :size => 0,
|
52
|
+
# :xmlns => 'http://www.vmware.com/vcloud/v0.8',
|
53
|
+
# :"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance',
|
54
|
+
# :"xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema') {
|
55
|
+
# #builder.VirtualHardwareSection(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
56
|
+
# builder.Section(:"xsi:type" => "q2:VirtualHardwareSection_Type", :xmlns => "http://schemas.dmtf.org/ovf/envelope/1", :"xmlns:q2" => "http://www.vmware.com/vcloud/v0.8") {
|
57
|
+
# builder.Info('Virtual Hardware')
|
58
|
+
# builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
59
|
+
# #builder.Item {
|
60
|
+
# builder.InstanceID(1, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
61
|
+
# builder.ResourceType(3, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
62
|
+
# builder.VirtualQuantity(vapp_data[:cpus], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
63
|
+
# }
|
64
|
+
# builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
65
|
+
# #builder.Item {
|
66
|
+
# builder.InstanceID(2, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
67
|
+
# builder.ResourceType(4, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
68
|
+
# builder.VirtualQuantity(vapp_data[:memory], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
69
|
+
# }
|
70
|
+
# vapp_data[:disks].each do |disk_data|
|
71
|
+
# #builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
72
|
+
# builder.Item {
|
73
|
+
# builder.AddressOnParent(disk_data[:number], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
74
|
+
# builder.HostResource(disk_data[:resource], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
75
|
+
# builder.InstanceID(9, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
76
|
+
# builder.ResourceType(17, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
77
|
+
# builder.VirtualQuantity(disk_data[:size], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
78
|
+
# }
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# }
|
82
|
+
#}
|
83
|
+
end
|
84
|
+
|
85
|
+
def validate_vapp_data(vapp_data)
|
86
|
+
valid_opts = [:name, :cpus, :memory, :disks]
|
87
|
+
unless valid_opts.all? { |opt| vapp_data.keys.include?(opt) }
|
88
|
+
raise ArgumentError.new("Required Vapp data missing: #{(valid_opts - vapp_data.keys).map(&:inspect).join(", ")}")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def configure_vapp(vapp_uri, vapp_data)
|
93
|
+
validate_vapp_data(vapp_data)
|
94
|
+
|
95
|
+
request(
|
96
|
+
:body => generate_configure_vapp_request(vapp_uri, vapp_data),
|
97
|
+
:expects => 202,
|
98
|
+
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vApp+xml' },
|
99
|
+
:method => 'PUT',
|
100
|
+
:uri => vapp_uri
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
module Mock
|
107
|
+
def configure_vapp(vapp_uri, vapp_data)
|
108
|
+
Fog::Mock.not_implemented
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
@@ -2,34 +2,15 @@ module Fog
|
|
2
2
|
module Vcloud
|
3
3
|
module Terremark
|
4
4
|
module Ecloud
|
5
|
-
module Real
|
6
|
-
|
7
|
-
def delete_internet_service(internet_service_uri)
|
8
|
-
request(
|
9
|
-
:body => "",
|
10
|
-
:expects => 200,
|
11
|
-
#:headers => {'Content-Type' => 'application/vnd.tmrk.ecloud.internetService+xml'},
|
12
|
-
:method => 'DELETE',
|
13
|
-
:uri => internet_service_uri
|
14
|
-
)
|
15
|
-
end
|
16
5
|
|
6
|
+
module Real
|
7
|
+
basic_request :delete_node, 200, 'DELETE', {}, ""
|
17
8
|
end
|
18
9
|
|
19
10
|
module Mock
|
20
|
-
#
|
21
|
-
# Based on
|
22
|
-
# http://support.theenterprisecloud.com/kb/default.asp?id=561&Lang=1&SID=
|
23
|
-
#
|
24
11
|
|
25
|
-
def
|
26
|
-
|
27
|
-
flatten.detect { |service| service[:id].to_s == internet_service_uri.to_s.split('/')[-1] }
|
28
|
-
Fog::Vcloud::Mock.data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:public_ips].map { |public_ip| public_ip[:services].delete(service) } } }
|
29
|
-
mock_it nil, 200, "", {}
|
30
|
-
else
|
31
|
-
mock_error 200, "401 Unauthorized"
|
32
|
-
end
|
12
|
+
def delete_node(node_uri)
|
13
|
+
Fog::Mock.not_implemented
|
33
14
|
end
|
34
15
|
end
|
35
16
|
end
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
module Terremark
|
4
|
+
module Ecloud
|
5
|
+
|
6
|
+
module Real
|
7
|
+
basic_request :delete_vapp, 202, "DELETE"
|
8
|
+
end
|
9
|
+
|
10
|
+
module Mock
|
11
|
+
def delete_vapp(vapp_uri)
|
12
|
+
Fog::Mock.not_implemented
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
module Terremark
|
4
|
+
module Ecloud
|
5
|
+
|
6
|
+
module Real
|
7
|
+
basic_request :get_customization_options
|
8
|
+
end
|
9
|
+
|
10
|
+
module Mock
|
11
|
+
def get_customization_options( options_uri )
|
12
|
+
Fog::Mock.not_implemented
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -4,15 +4,7 @@ module Fog
|
|
4
4
|
module Ecloud
|
5
5
|
|
6
6
|
module Real
|
7
|
-
|
8
|
-
def get_internet_services(internet_services_uri)
|
9
|
-
request(
|
10
|
-
:expects => 200,
|
11
|
-
:method => 'GET',
|
12
|
-
:parser => Fog::Parsers::Vcloud::Terremark::Ecloud::GetInternetServices.new,
|
13
|
-
:uri => internet_services_uri
|
14
|
-
)
|
15
|
-
end
|
7
|
+
basic_request :get_internet_services
|
16
8
|
end
|
17
9
|
|
18
10
|
module Mock
|
@@ -39,28 +31,29 @@ module Fog
|
|
39
31
|
xml.Enabled(service[:enabled])
|
40
32
|
xml.Timeout(service[:timeout])
|
41
33
|
xml.Description(service[:description])
|
42
|
-
xml.
|
43
|
-
xml.
|
34
|
+
xml.RedirectURL
|
35
|
+
xml.Monitor
|
44
36
|
}
|
45
37
|
end
|
46
38
|
end
|
47
39
|
|
48
40
|
def get_internet_services(internet_services_uri)
|
41
|
+
internet_services_uri = ensure_unparsed(internet_services_uri)
|
49
42
|
xml = nil
|
50
43
|
builder = Builder::XmlMarkup.new
|
51
|
-
if vdc =
|
52
|
-
xml = builder.InternetServices( :xmlns => "urn:tmrk:eCloudExtensions-2.
|
44
|
+
if vdc = vdc_from_uri(internet_services_uri)
|
45
|
+
xml = builder.InternetServices( :xmlns => "urn:tmrk:eCloudExtensions-2.3",:"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance" ) { |xml|
|
53
46
|
vdc[:public_ips].each do |ip|
|
54
47
|
Fog::Vcloud::Terremark::Ecloud::Mock.internet_services_for_ip(xml,ip)
|
55
48
|
end
|
56
49
|
}
|
57
|
-
elsif ip =
|
58
|
-
xml = builder.InternetServices( :xmlns => "urn:tmrk:eCloudExtensions-2.
|
50
|
+
elsif ip = ip_from_uri(internet_services_uri)
|
51
|
+
xml = builder.InternetServices( :xmlns => "urn:tmrk:eCloudExtensions-2.3",:"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance" ) { |xml|
|
59
52
|
Fog::Vcloud::Terremark::Ecloud::Mock.internet_services_for_ip(xml,ip)
|
60
53
|
}
|
61
54
|
end
|
62
55
|
if xml
|
63
|
-
mock_it
|
56
|
+
mock_it 200,
|
64
57
|
xml, { 'Content-Type' => 'application/vnd.tmrk.ecloud.internetServicesList+xml' }
|
65
58
|
else
|
66
59
|
mock_error 200, "401 Unauthorized"
|
@@ -2,17 +2,9 @@ module Fog
|
|
2
2
|
module Vcloud
|
3
3
|
module Terremark
|
4
4
|
module Ecloud
|
5
|
-
module Real
|
6
|
-
|
7
|
-
def get_network(network_uri)
|
8
|
-
request(
|
9
|
-
:expects => 200,
|
10
|
-
:method => 'GET',
|
11
|
-
:parser => Fog::Parsers::Vcloud::Terremark::Ecloud::Network.new,
|
12
|
-
:uri => network_uri
|
13
|
-
)
|
14
|
-
end
|
15
5
|
|
6
|
+
module Real
|
7
|
+
# Handled by the main Vcloud get_network
|
16
8
|
end
|
17
9
|
|
18
10
|
module Mock
|
@@ -22,21 +14,23 @@ module Fog
|
|
22
14
|
# Based off of:
|
23
15
|
# http://support.theenterprisecloud.com/kb/default.asp?id=546&Lang=1&SID=
|
24
16
|
#
|
17
|
+
network_uri = ensure_unparsed(network_uri)
|
25
18
|
type = "application/vnd.vmware.vcloud.network+xml"
|
26
19
|
response = Excon::Response.new
|
27
|
-
if network = mock_data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:networks] } }.flatten.detect { |network| network[:href] == network_uri
|
20
|
+
if network = mock_data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:networks] } }.flatten.detect { |network| network[:href] == network_uri }
|
28
21
|
xml = Builder::XmlMarkup.new
|
29
|
-
mock_it
|
22
|
+
mock_it 200,
|
30
23
|
xml.Network(xmlns.merge(:href => network[:href], :name => network[:name], :type => type)) {
|
31
24
|
xml.Link( :rel => "down", :href => network[:href] + "/ips", :type => "application/xml", :name => "IP Addresses" )
|
25
|
+
xml.Link( :rel => "down", :href => network[:extension_href], :type => "application/xml", :name => network[:name] )
|
32
26
|
xml.Configuration {
|
33
27
|
xml.Gateway(network[:gateway])
|
34
28
|
xml.Netmask(network[:netmask])
|
35
29
|
}
|
36
30
|
if network[:features]
|
37
31
|
xml.Features {
|
38
|
-
|
39
|
-
xml.
|
32
|
+
network[:features].each do |feature|
|
33
|
+
eval "xml.#{feature[:type].to_sym}('#{feature[:value]}')"
|
40
34
|
end
|
41
35
|
}
|
42
36
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
module Terremark
|
4
|
+
module Ecloud
|
5
|
+
|
6
|
+
module Real
|
7
|
+
basic_request :get_network_extensions
|
8
|
+
end
|
9
|
+
|
10
|
+
module Mock
|
11
|
+
|
12
|
+
def get_network_extensions(network_uri)
|
13
|
+
network_uri = ensure_unparsed(network_uri)
|
14
|
+
type = "application/vnd.vmware.vcloud.network+xml"
|
15
|
+
response = Excon::Response.new
|
16
|
+
if network = mock_data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:networks] } }.flatten.detect { |network| network[:extension_href] == network_uri }
|
17
|
+
xml = Builder::XmlMarkup.new
|
18
|
+
mock_it 200,
|
19
|
+
xml.Network(:xmlns => "urn:tmrk:eCloudExtensions-2.3", :"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance") {
|
20
|
+
xml.Address(network[:name].split("/")[0])
|
21
|
+
xml.RnatAddress(network[:rnat])
|
22
|
+
xml.Href(network[:extension_href])
|
23
|
+
xml.Id(network[:id])
|
24
|
+
xml.Name(network[:name])
|
25
|
+
xml.GatewayAddress(network[:gateway])
|
26
|
+
xml.BroadcastAddress(IPAddr.new(network[:subnet]).to_range.last.to_s)
|
27
|
+
}, { 'Content-Type' => type }
|
28
|
+
else
|
29
|
+
mock_error 200, "401 Unauthorized"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|