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
@@ -11,7 +11,7 @@ module Fog
|
|
11
11
|
'Authorization' => authorization_header
|
12
12
|
},
|
13
13
|
:method => 'POST',
|
14
|
-
:
|
14
|
+
:parse => true,
|
15
15
|
:uri => @login_uri
|
16
16
|
})
|
17
17
|
end
|
@@ -29,10 +29,10 @@ module Fog
|
|
29
29
|
#
|
30
30
|
xml = Builder::XmlMarkup.new
|
31
31
|
|
32
|
-
mock_it
|
32
|
+
mock_it 200,
|
33
33
|
xml.OrgList(xmlns) {
|
34
|
-
|
35
|
-
xml.Org(
|
34
|
+
mock_data[:organizations].each do |org|
|
35
|
+
xml.Org( :type => "application/vnd.vmware.vcloud.org+xml", :href => org[:info][:href], :name => org[:info][:name] )
|
36
36
|
end
|
37
37
|
},
|
38
38
|
{ 'Set-Cookie' => 'vcloud-token=fc020a05-21d7-4f33-9b2a-25d8cd05a44e; path=/',
|
@@ -2,14 +2,130 @@ module Fog
|
|
2
2
|
module Vcloud
|
3
3
|
module Terremark
|
4
4
|
module Ecloud
|
5
|
+
extend Fog::Vcloud::Extension
|
6
|
+
|
7
|
+
model_path 'fog/vcloud/terremark/ecloud/models'
|
8
|
+
model :catalog_item
|
9
|
+
model :catalog
|
10
|
+
model :internet_service
|
11
|
+
model :internet_services
|
12
|
+
model :ip
|
13
|
+
model :ips
|
14
|
+
model :network
|
15
|
+
model :networks
|
16
|
+
model :node
|
17
|
+
model :nodes
|
18
|
+
model :public_ip
|
19
|
+
model :public_ips
|
20
|
+
model :server
|
21
|
+
model :servers
|
22
|
+
model :task
|
23
|
+
model :tasks
|
24
|
+
model :vdc
|
25
|
+
model :vdcs
|
26
|
+
|
27
|
+
request_path 'fog/vcloud/terremark/ecloud/requests'
|
28
|
+
request :add_internet_service
|
29
|
+
request :add_node
|
30
|
+
request :configure_internet_service
|
31
|
+
request :configure_network
|
32
|
+
request :configure_network_ip
|
33
|
+
request :configure_node
|
34
|
+
request :configure_vapp
|
35
|
+
request :delete_internet_service
|
36
|
+
request :delete_node
|
37
|
+
request :delete_vapp
|
38
|
+
request :get_catalog
|
39
|
+
request :get_catalog_item
|
40
|
+
request :get_customization_options
|
41
|
+
request :get_internet_services
|
42
|
+
request :get_network
|
43
|
+
request :get_network_ip
|
44
|
+
request :get_network_ips
|
45
|
+
request :get_network_extensions
|
46
|
+
request :get_node
|
47
|
+
request :get_nodes
|
48
|
+
request :get_public_ip
|
49
|
+
request :get_public_ips
|
50
|
+
request :get_task
|
51
|
+
request :get_task_list
|
52
|
+
request :get_vapp
|
53
|
+
request :get_vdc
|
54
|
+
request :power_off
|
55
|
+
request :power_on
|
56
|
+
request :power_reset
|
57
|
+
request :power_shutdown
|
58
|
+
|
59
|
+
versions "v0.8b-ext2.3"
|
5
60
|
|
6
61
|
module Mock
|
7
62
|
def self.base_url
|
8
|
-
"https://fakey.com/api/v0.
|
63
|
+
"https://fakey.com/api/v0.8b-ext2.3"
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.data_reset
|
67
|
+
@mock_data = nil
|
68
|
+
Fog::Vcloud::Mock.data_reset
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.extension_url
|
72
|
+
self.base_url + "/extensions"
|
9
73
|
end
|
10
74
|
|
11
|
-
def self.data
|
12
|
-
@mock_data ||=
|
75
|
+
def self.data( base_url = self.base_url )
|
76
|
+
@mock_data ||= begin
|
77
|
+
extension_href =
|
78
|
+
vcloud_data = Fog::Vcloud::Mock.data(base_url)
|
79
|
+
vcloud_data.delete( :versions )
|
80
|
+
vcloud_data.merge!( :versions => [ { :version => "v0.8b-ext2.3", :login_url => "#{base_url}/login", :supported => true } ] )
|
81
|
+
|
82
|
+
vcloud_data[:organizations][0][:vdcs][0][:public_ips] =
|
83
|
+
[
|
84
|
+
{ :id => "51",
|
85
|
+
:href => extension_url + "/publicIp/51",
|
86
|
+
:name => "99.1.2.3",
|
87
|
+
:services => [
|
88
|
+
{ :id => "71", :port => "80", :protocol => 'HTTP', :enabled => "true", :timeout => "2", :name => 'Web Site', :description => 'Web Servers' },
|
89
|
+
{ :id => "72", :port => "7000", :protocol => 'HTTP', :enabled => "true", :timeout => "2", :name => 'An SSH Map', :description => 'SSH 1' }
|
90
|
+
]
|
91
|
+
},
|
92
|
+
{ :id => "52",
|
93
|
+
:href => extension_url + "/publicIp/52",
|
94
|
+
:name => "99.1.2.4",
|
95
|
+
:services => [
|
96
|
+
{ :id => "73", :port => "80", :protocol => 'HTTP', :enabled => "true", :timeout => "2", :name => 'Web Site', :description => 'Web Servers' },
|
97
|
+
{ :id => "74", :port => "7000", :protocol => 'HTTP', :enabled => "true", :timeout => "2", :name => 'An SSH Map', :description => 'SSH 2' }
|
98
|
+
]
|
99
|
+
},
|
100
|
+
{ :id => "53",
|
101
|
+
:href => extension_url + "/publicIp/53",
|
102
|
+
:name => "99.1.9.7",
|
103
|
+
:services => []
|
104
|
+
}
|
105
|
+
]
|
106
|
+
|
107
|
+
vcloud_data[:organizations][0][:vdcs][1][:public_ips] =
|
108
|
+
[
|
109
|
+
{ :id => "54",
|
110
|
+
:href => extension_url + "/publicIp/54",
|
111
|
+
:name => "99.99.99.99",
|
112
|
+
:services => []
|
113
|
+
}
|
114
|
+
]
|
115
|
+
|
116
|
+
vcloud_data[:organizations].each do |organization|
|
117
|
+
organization[:info][:extension_href] = extension_url
|
118
|
+
organization[:vdcs].each do | vdc|
|
119
|
+
vdc[:extension_href] = "#{base_url}/extensions/vdc/#{vdc[:id]}"
|
120
|
+
vdc[:networks].each do |network|
|
121
|
+
network[:extension_href] = "#{extension_url}/network/#{network[:id]}"
|
122
|
+
network[:rnat] = vdc[:public_ips].first[:name]
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
vcloud_data
|
128
|
+
end
|
13
129
|
end
|
14
130
|
|
15
131
|
def self.public_ip_href(ip)
|
@@ -19,62 +135,17 @@ module Fog
|
|
19
135
|
def self.internet_service_href(internet_service)
|
20
136
|
"#{base_url}/extensions/internetService/#{internet_service[:id]}"
|
21
137
|
end
|
22
|
-
end
|
23
138
|
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.extended(klass)
|
29
|
-
#Do anything we need to do here that's specific to ecloud
|
30
|
-
unless @required
|
31
|
-
require 'fog/vcloud/terremark/all'
|
32
|
-
require 'fog/vcloud/terremark/ecloud/models/internet_service'
|
33
|
-
require 'fog/vcloud/terremark/ecloud/models/internet_services'
|
34
|
-
require 'fog/vcloud/terremark/ecloud/models/ip'
|
35
|
-
require 'fog/vcloud/terremark/ecloud/models/ips'
|
36
|
-
require 'fog/vcloud/terremark/ecloud/models/network'
|
37
|
-
require 'fog/vcloud/terremark/ecloud/models/networks'
|
38
|
-
require 'fog/vcloud/terremark/ecloud/models/public_ip'
|
39
|
-
require 'fog/vcloud/terremark/ecloud/models/public_ips'
|
40
|
-
require 'fog/vcloud/terremark/ecloud/models/vdc'
|
41
|
-
require 'fog/vcloud/terremark/ecloud/models/vdcs'
|
42
|
-
require 'fog/vcloud/terremark/ecloud/parsers/get_internet_services'
|
43
|
-
require 'fog/vcloud/terremark/ecloud/parsers/get_public_ip'
|
44
|
-
require 'fog/vcloud/terremark/ecloud/parsers/get_public_ips'
|
45
|
-
require 'fog/vcloud/terremark/ecloud/parsers/get_vdc'
|
46
|
-
require 'fog/vcloud/terremark/ecloud/parsers/internet_service'
|
47
|
-
require 'fog/vcloud/terremark/ecloud/parsers/network'
|
48
|
-
require 'fog/vcloud/terremark/ecloud/parsers/network_ips'
|
49
|
-
require 'fog/vcloud/terremark/ecloud/requests/add_internet_service'
|
50
|
-
require 'fog/vcloud/terremark/ecloud/requests/configure_internet_service'
|
51
|
-
require 'fog/vcloud/terremark/ecloud/requests/delete_internet_service'
|
52
|
-
require 'fog/vcloud/terremark/ecloud/requests/get_internet_services'
|
53
|
-
require 'fog/vcloud/terremark/ecloud/requests/get_network'
|
54
|
-
require 'fog/vcloud/terremark/ecloud/requests/get_network_ips'
|
55
|
-
require 'fog/vcloud/terremark/ecloud/requests/get_public_ip'
|
56
|
-
require 'fog/vcloud/terremark/ecloud/requests/get_public_ips'
|
57
|
-
require 'fog/vcloud/terremark/ecloud/requests/login'
|
58
|
-
require 'fog/vcloud/terremark/ecloud/requests/get_vdc'
|
59
|
-
Struct.new("TmrkEcloudVdc", :links, :resource_entities, :networks, :cpu_capacity, :storage_capacity,
|
60
|
-
:memory_capacity, :deployed_vm_quota, :instantiated_vm_quota, :href, :type,
|
61
|
-
:name, :xmlns, :description)
|
62
|
-
Struct.new("TmrkEcloudList", :links)
|
63
|
-
Struct.new("TmrkEcloudPublicIp", :type, :href, :name, :id)
|
64
|
-
Struct.new("TmrkEcloudInternetService", :type, :href, :id, :name, :public_ip, :port, :protocol,
|
65
|
-
:enabled, :timeout, :description, :url_send_string, :http_header)
|
66
|
-
Struct.new("TmrkEcloudNetwork", :features, :configuration, :ips_link, :name, :type, :href, :xmlns)
|
67
|
-
Struct.new("TmrkEcloudNetworkIps", :addresses)
|
68
|
-
Struct.new("TmrkEcloudNetworkIp", :name, :status, :server)
|
69
|
-
@required = true
|
139
|
+
def ecloud_xmlns
|
140
|
+
{ :xmlns => "urn:tmrk:eCloudExtensions-2.3", :"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance" }
|
70
141
|
end
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
klass.extend Fog::Vcloud::Terremark::Ecloud::Real
|
142
|
+
|
143
|
+
def mock_data
|
144
|
+
Fog::Vcloud::Terremark::Ecloud::Mock.data
|
75
145
|
end
|
76
146
|
end
|
77
147
|
|
148
|
+
|
78
149
|
private
|
79
150
|
|
80
151
|
# If we don't support any versions the service does, then raise an error.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
module Terremark
|
4
|
+
module Ecloud
|
5
|
+
|
6
|
+
class Catalog < Fog::Vcloud::Collection
|
7
|
+
|
8
|
+
model Fog::Vcloud::Terremark::Ecloud::CatalogItem
|
9
|
+
|
10
|
+
attribute :href, :aliases => :Href
|
11
|
+
|
12
|
+
def all
|
13
|
+
if data = connection.get_catalog(href).body[:CatalogItems][:CatalogItem]
|
14
|
+
load(data)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def get(uri)
|
19
|
+
if data = connection.get_catalog_item(uri)
|
20
|
+
new(data.body)
|
21
|
+
end
|
22
|
+
rescue Fog::Errors::NotFound
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
module Terremark
|
4
|
+
module Ecloud
|
5
|
+
class CatalogItem < Fog::Vcloud::Model
|
6
|
+
|
7
|
+
identity :href, :Href
|
8
|
+
|
9
|
+
ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd
|
10
|
+
|
11
|
+
attribute :type
|
12
|
+
attribute :name
|
13
|
+
attribute :entity, :aliases => :Entity
|
14
|
+
attribute :link, :aliases => :Link
|
15
|
+
attribute :property, :aliases => :Property
|
16
|
+
|
17
|
+
def customization_options
|
18
|
+
load_unless_loaded!
|
19
|
+
if data = connection.get_customization_options( link[:href] ).body
|
20
|
+
data.delete_if { |key, value| [:xmlns_i, :xmlns].include?(key) }
|
21
|
+
data
|
22
|
+
else
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,49 +1,48 @@
|
|
1
|
-
require 'fog/model'
|
2
|
-
|
3
1
|
module Fog
|
4
2
|
module Vcloud
|
5
3
|
module Terremark
|
6
4
|
module Ecloud
|
7
5
|
class InternetService < Fog::Vcloud::Model
|
8
6
|
|
9
|
-
identity :href
|
7
|
+
identity :href, :Href
|
10
8
|
|
11
|
-
|
12
|
-
attribute :id
|
13
|
-
attribute :type
|
14
|
-
attribute :protocol
|
15
|
-
attribute :port
|
16
|
-
attribute :enabled
|
17
|
-
attribute :description
|
18
|
-
attribute :public_ip
|
19
|
-
attribute :timeout
|
20
|
-
attribute :url_send_string
|
21
|
-
attribute :http_header
|
9
|
+
ignore_attributes :xmlns, :xmlns_i
|
22
10
|
|
23
|
-
|
11
|
+
attribute :name, :aliases => :Name
|
12
|
+
attribute :id, :aliases => :Id
|
13
|
+
attribute :protocol, :aliases => :Protocol
|
14
|
+
attribute :port, :aliases => :Port
|
15
|
+
attribute :enabled, :aliases => :Enabled
|
16
|
+
attribute :description, :aliases => :Description
|
17
|
+
attribute :public_ip, :aliases => :PublicIpAddress
|
18
|
+
attribute :timeout, :aliases => :Timeout
|
19
|
+
attribute :redirect_url, :aliases => :RedirectURL
|
20
|
+
attribute :monitor, :aliases => :Monitor
|
24
21
|
|
25
22
|
def delete
|
26
23
|
requires :href
|
27
24
|
|
28
|
-
connection.delete_internet_service(
|
29
|
-
collection.reload
|
25
|
+
connection.delete_internet_service( href )
|
30
26
|
end
|
31
27
|
|
32
28
|
def save
|
33
29
|
if new_record?
|
34
30
|
result = connection.add_internet_service( collection.href, _compose_service_data )
|
35
|
-
|
36
|
-
self.reload
|
31
|
+
merge_attributes(result.body)
|
37
32
|
else
|
38
|
-
connection.configure_internet_service(
|
33
|
+
connection.configure_internet_service( href, _compose_service_data, _compose_ip_data )
|
39
34
|
end
|
40
35
|
end
|
41
36
|
|
37
|
+
def nodes
|
38
|
+
@nodes ||= Fog::Vcloud::Terremark::Ecloud::Nodes.new( :connection => connection, :href => href + "/nodeServices" )
|
39
|
+
end
|
40
|
+
|
42
41
|
private
|
43
42
|
|
44
43
|
def _compose_service_data
|
45
44
|
service_data = {}
|
46
|
-
self.class.attributes.select{ |attribute| !attribute.nil? }.each { |attribute| service_data[attribute] = send(attribute).to_s }
|
45
|
+
self.class.attributes.select{ |attribute| !send(attribute).nil? }.each { |attribute| service_data[attribute] = send(attribute).to_s }
|
47
46
|
service_data
|
48
47
|
end
|
49
48
|
|
@@ -51,7 +50,7 @@ module Fog
|
|
51
50
|
if public_ip.nil?
|
52
51
|
{}
|
53
52
|
else
|
54
|
-
{ :id =>
|
53
|
+
{ :id => public_ip[:Id], :href => public_ip[:Href], :name => public_ip[:Name] }
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
@@ -3,12 +3,6 @@ module Fog
|
|
3
3
|
module Terremark
|
4
4
|
module Ecloud
|
5
5
|
|
6
|
-
module Mock
|
7
|
-
def internet_services(options = {})
|
8
|
-
@internet_services ||= Fog::Vcloud::Terremark::Ecloud::InternetServices.new(options.merge(:connection => self))
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
6
|
module Real
|
13
7
|
def internet_services(options = {})
|
14
8
|
@internet_services ||= Fog::Vcloud::Terremark::Ecloud::InternetServices.new(options.merge(:connection => self))
|
@@ -19,29 +13,21 @@ module Fog
|
|
19
13
|
|
20
14
|
model Fog::Vcloud::Terremark::Ecloud::InternetService
|
21
15
|
|
22
|
-
|
23
|
-
all_request lambda { |internet_services| internet_services.send(:raw_results) }
|
16
|
+
attribute :href, :aliases => :Href
|
24
17
|
|
25
|
-
def
|
26
|
-
if
|
27
|
-
|
28
|
-
item.reload
|
18
|
+
def all
|
19
|
+
if data = connection.get_internet_services(href).body[:InternetService]
|
20
|
+
load(data)
|
29
21
|
end
|
30
22
|
end
|
31
23
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def raw_results
|
44
|
-
@raw_results ||= connection.get_internet_services(self.href)
|
24
|
+
# Optimize later, no need to get_internet_services again
|
25
|
+
def get(uri)
|
26
|
+
if data = connection.get_internet_services(href).body[:InternetService].detect { |service| service[:Href] == uri }
|
27
|
+
new(data)
|
28
|
+
end
|
29
|
+
rescue Fog::Errors::NotFound
|
30
|
+
nil
|
45
31
|
end
|
46
32
|
|
47
33
|
end
|
@@ -1,15 +1,48 @@
|
|
1
|
-
require 'fog/model'
|
2
|
-
|
3
1
|
module Fog
|
4
2
|
module Vcloud
|
5
3
|
module Terremark
|
6
4
|
module Ecloud
|
7
5
|
class Ip < Fog::Vcloud::Model
|
8
6
|
|
9
|
-
|
7
|
+
ignore_attributes :xmlns_i, :xmlns
|
8
|
+
|
9
|
+
identity :href, :Href
|
10
|
+
|
11
|
+
attribute :name, :Name
|
12
|
+
attribute :status, :aliases => :Status
|
13
|
+
attribute :server, :aliases => :Server
|
14
|
+
attribute :rnat, :aliases => :RnatAddress
|
15
|
+
attribute :id, :aliases => :Id, :type => :integer
|
16
|
+
|
17
|
+
def rnat=(new_rnat)
|
18
|
+
@rnat = new_rnat
|
19
|
+
@changed = true
|
20
|
+
end
|
21
|
+
|
22
|
+
def save
|
23
|
+
if @changed
|
24
|
+
connection.configure_network_ip( href, _compose_network_ip_data )
|
25
|
+
end
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def reload
|
30
|
+
super
|
31
|
+
@changed = false
|
32
|
+
true
|
33
|
+
end
|
10
34
|
|
11
|
-
|
12
|
-
|
35
|
+
private
|
36
|
+
def _compose_network_ip_data
|
37
|
+
{
|
38
|
+
:id => id,
|
39
|
+
:href => href,
|
40
|
+
:name => name,
|
41
|
+
:status => status,
|
42
|
+
:server => server,
|
43
|
+
:rnat => rnat
|
44
|
+
}
|
45
|
+
end
|
13
46
|
|
14
47
|
end
|
15
48
|
end
|