fog-profitbricks 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/fog-profitbricks.gemspec +12 -11
- data/lib/fog/compute/profit_bricks.rb +217 -0
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/datacenter.rb +0 -2
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/datacenters.rb +1 -2
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/flavor.rb +0 -6
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/flavors.rb +1 -2
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/image.rb +0 -6
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/images.rb +1 -2
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/interface.rb +0 -6
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/interfaces.rb +1 -2
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/region.rb +0 -6
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/regions.rb +1 -2
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/server.rb +0 -8
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/servers.rb +1 -2
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/volume.rb +0 -6
- data/lib/fog/{profitbricks/models/compute → compute/profit_bricks/models}/volumes.rb +1 -2
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/clear_data_center.rb +0 -2
- data/lib/fog/compute/profit_bricks/requests/connect_storage_to_server.rb +83 -0
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/create_data_center.rb +1 -3
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/create_flavor.rb +2 -2
- data/lib/fog/compute/profit_bricks/requests/create_nic.rb +79 -0
- data/lib/fog/compute/profit_bricks/requests/create_server.rb +105 -0
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/create_storage.rb +4 -6
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/delete_data_center.rb +3 -5
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/delete_nic.rb +3 -5
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/delete_server.rb +2 -4
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/delete_storage.rb +2 -4
- data/lib/fog/compute/profit_bricks/requests/disconnect_storage_from_server.rb +76 -0
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_all_data_centers.rb +0 -1
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_all_flavors.rb +0 -0
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_all_images.rb +0 -2
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_all_locations.rb +0 -0
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_all_nic.rb +2 -4
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_all_servers.rb +0 -1
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_all_storages.rb +2 -4
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_data_center.rb +0 -2
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_data_center_state.rb +2 -3
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_flavor.rb +0 -0
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_image.rb +0 -2
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_location.rb +0 -0
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_nic.rb +0 -2
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_server.rb +0 -2
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/get_storage.rb +0 -2
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/reset_server.rb +0 -2
- data/lib/fog/compute/profit_bricks/requests/set_internet_access.rb +59 -0
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/start_server.rb +0 -1
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/stop_server.rb +0 -1
- data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/update_data_center.rb +3 -4
- data/lib/fog/compute/profit_bricks/requests/update_nic.rb +74 -0
- data/lib/fog/compute/profit_bricks/requests/update_server.rb +79 -0
- data/lib/fog/compute/profit_bricks/requests/update_storage.rb +73 -0
- data/lib/fog/{profitbricks/models → models/profit_bricks}/base.rb +0 -0
- data/lib/fog/parsers/compute.rb +37 -0
- data/lib/fog/parsers/compute/profit_bricks/base.rb +51 -0
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/clear_data_center.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/connect_storage_to_server.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/create_data_center.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/create_nic.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/create_server.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/create_storage.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/delete_data_center.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/delete_nic.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/delete_server.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/delete_storage.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/disconnect_storage_from_server.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_all_data_centers.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_all_images.rb +2 -2
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_all_nic.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_all_servers.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_all_storages.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_data_center.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_data_center_state.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_image.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_nic.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_server.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/get_storage.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/reset_server.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/set_internet_access.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/update_data_center.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/update_nic.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/update_server.rb +1 -1
- data/lib/fog/{profitbricks/parsers/compute → parsers/compute/profit_bricks}/update_storage.rb +1 -1
- data/lib/fog/profitbricks.rb +32 -4
- data/lib/fog/profitbricks/compute.rb +1 -215
- data/lib/fog/profitbricks/storage.rb +1 -0
- data/lib/fog/profitbricks/version.rb +1 -1
- metadata +107 -103
- data/lib/fog/profitbricks/core.rb +0 -18
- data/lib/fog/profitbricks/parsers/base.rb +0 -49
- data/lib/fog/profitbricks/requests/compute/connect_storage_to_server.rb +0 -85
- data/lib/fog/profitbricks/requests/compute/create_nic.rb +0 -81
- data/lib/fog/profitbricks/requests/compute/create_server.rb +0 -107
- data/lib/fog/profitbricks/requests/compute/disconnect_storage_from_server.rb +0 -78
- data/lib/fog/profitbricks/requests/compute/set_internet_access.rb +0 -61
- data/lib/fog/profitbricks/requests/compute/update_nic.rb +0 -76
- data/lib/fog/profitbricks/requests/compute/update_server.rb +0 -81
- data/lib/fog/profitbricks/requests/compute/update_storage.rb +0 -75
@@ -0,0 +1,83 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Connect virtual storage
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * storageId<~String> - Required, UUID of virtual storage
|
9
|
+
# * serverId<~String> - Required,
|
10
|
+
# * options<~Hash>:
|
11
|
+
# * busType<~String> - Optional, VIRTIO, IDE
|
12
|
+
# * deviceNumber<~Integer> - Optional,
|
13
|
+
#
|
14
|
+
# ==== Returns
|
15
|
+
# * response<~Excon::Response>:
|
16
|
+
# * body<~Hash>:
|
17
|
+
# * connectStorageToServerResponse<~Hash>:
|
18
|
+
# * requestId<~String> - ID of request
|
19
|
+
# * dataCenterId<~String> - UUID of virtual data center
|
20
|
+
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
21
|
+
#
|
22
|
+
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/ConnectStorage.html]
|
23
|
+
def connect_storage_to_server(storage_id, server_id, options={})
|
24
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
25
|
+
|xml| xml[:ws].connectStorageToServer {
|
26
|
+
xml.request {
|
27
|
+
xml.storageId(storage_id)
|
28
|
+
xml.serverId(server_id)
|
29
|
+
options.each { |key, value| xml.send(key, value) }
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
request(
|
35
|
+
:expects => [200],
|
36
|
+
:method => 'POST',
|
37
|
+
:body => soap_envelope.to_xml,
|
38
|
+
:parser =>
|
39
|
+
Fog::Parsers::Compute::ProfitBricks::ConnectStorageToServer.new
|
40
|
+
)
|
41
|
+
rescue Excon::Errors::InternalServerError => error
|
42
|
+
Fog::Errors::NotFound.new(error)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Mock
|
47
|
+
def connect_storage_to_server(storage_id, server_id, options={})
|
48
|
+
|
49
|
+
if storage = self.data[:volumes].find {
|
50
|
+
|attrib| attrib['storageId'] == storage_id
|
51
|
+
}
|
52
|
+
else
|
53
|
+
raise Fog::Errors::NotFound.new(
|
54
|
+
'The requested volume could not be found'
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
if server = self.data[:servers].find {
|
59
|
+
|attrib| attrib['serverId'] == server_id
|
60
|
+
}
|
61
|
+
server['connectedStorages'] << storage
|
62
|
+
else
|
63
|
+
raise Fog::Errors::NotFound.new(
|
64
|
+
'The requested server could not be found'
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
response = Excon::Response.new
|
69
|
+
response.status = 200
|
70
|
+
response.body =
|
71
|
+
{ 'connectStorageToServerResponse' =>
|
72
|
+
{
|
73
|
+
'requestId' => Fog::Mock::random_numbers(7),
|
74
|
+
'dataCenterId' => Fog::UUID.uuid,
|
75
|
+
'dataCenterVersion' => 1
|
76
|
+
}
|
77
|
+
}
|
78
|
+
response
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/create_data_center.rb
RENAMED
@@ -2,8 +2,6 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class ProfitBricks
|
4
4
|
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/create_data_center'
|
6
|
-
|
7
5
|
# Create a new virtual data center
|
8
6
|
#
|
9
7
|
# ==== Parameters
|
@@ -34,7 +32,7 @@ module Fog
|
|
34
32
|
:expects => [200],
|
35
33
|
:method => 'POST',
|
36
34
|
:body => soap_envelope.to_xml,
|
37
|
-
:parser =>
|
35
|
+
:parser =>
|
38
36
|
Fog::Parsers::Compute::ProfitBricks::CreateDataCenter.new
|
39
37
|
)
|
40
38
|
end
|
data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/create_flavor.rb
RENAMED
@@ -22,14 +22,14 @@ module Fog
|
|
22
22
|
def create_flavor(flavor_name, ram, cores)
|
23
23
|
response = Excon::Response.new
|
24
24
|
response.status = 200
|
25
|
-
|
25
|
+
|
26
26
|
flavor = {
|
27
27
|
'id' => Fog::UUID.uuid,
|
28
28
|
'name' => flavor_name,
|
29
29
|
'ram' => ram,
|
30
30
|
'cores' => cores
|
31
31
|
}
|
32
|
-
|
32
|
+
|
33
33
|
self.data[:flavors] << flavor
|
34
34
|
response.body = { 'createFlavorResponse' => flavor }
|
35
35
|
response
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Create new virtual network interface
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * serverId<~String> - Required,
|
9
|
+
# * lanId - Required,
|
10
|
+
# * options<~Hash>:
|
11
|
+
# * nicName<~String> - Optional, name of the new virtual network interface
|
12
|
+
# * ip<~String> - Optional,
|
13
|
+
# * dhcpActive<~String> - Optional,
|
14
|
+
#
|
15
|
+
# ==== Returns
|
16
|
+
# * response<~Excon::Response>:
|
17
|
+
# * body<~Hash>:
|
18
|
+
# * createNicResponse<~Hash>:
|
19
|
+
# * requestId<~String> - ID of request
|
20
|
+
# * dataCenterId<~String> - UUID of virtual data center
|
21
|
+
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
22
|
+
# * nicId<~String> - UUID of the new virtual network interface
|
23
|
+
#
|
24
|
+
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/CreateNIC.html]
|
25
|
+
def create_nic(server_id, lan_id, options={})
|
26
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
27
|
+
|xml| xml[:ws].createNic {
|
28
|
+
xml.request {
|
29
|
+
xml.serverId(server_id)
|
30
|
+
xml.lanId(lan_id)
|
31
|
+
options.each { |key, value| xml.send(key, value) }
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
request(
|
37
|
+
:expects => [200],
|
38
|
+
:method => 'POST',
|
39
|
+
:body => soap_envelope.to_xml,
|
40
|
+
:parser =>
|
41
|
+
Fog::Parsers::Compute::ProfitBricks::CreateNic.new
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Mock
|
47
|
+
def create_nic(server_id, lan_id, options={})
|
48
|
+
response = Excon::Response.new
|
49
|
+
response.status = 200
|
50
|
+
|
51
|
+
nic_id = Fog::UUID.uuid
|
52
|
+
nic = {
|
53
|
+
'nicId' => nic_id,
|
54
|
+
'lanId' => lan_id,
|
55
|
+
'nicName' => options['nicName'] || '',
|
56
|
+
'internetAccess' => options['internetAccess'] || 'false',
|
57
|
+
'ip' => options['ip'] || nil,
|
58
|
+
'macAddress' => Fog::Mock::random_hex(12),
|
59
|
+
'firewall' => {},
|
60
|
+
'dhcpActive' => options['dhcpActive'] || 'false',
|
61
|
+
'provisioningState' => 'AVAILABLE'
|
62
|
+
}
|
63
|
+
|
64
|
+
self.data[:interfaces] << nic
|
65
|
+
response.body = {
|
66
|
+
'createNicResponse' =>
|
67
|
+
{
|
68
|
+
'requestId' => Fog::Mock::random_numbers(7),
|
69
|
+
'dataCenterId' => Fog::UUID.uuid,
|
70
|
+
'dataCenterVersion' => 1,
|
71
|
+
'nicId' => nic_id
|
72
|
+
}
|
73
|
+
}
|
74
|
+
response
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Create new virtual server
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * dataCenterId<~String> - Required, UUID of virtual data center
|
9
|
+
# * cores<~Integer> - Required, number of CPU cores allocated to virtual server
|
10
|
+
# * ram<~Integer> - Required, amount of memory in GB allocated to virtual server
|
11
|
+
# * options<~Hash>:
|
12
|
+
# * serverName<~String> - Optional, name of the new virtual network interface
|
13
|
+
# * bootFromStorageId<~String> - Optional, defines an existing storage device ID to be set as boot device of the server
|
14
|
+
# * bootFromImageId<~<String> - Optional, defines an existing CD-ROM/DVD image ID to be set as boot device of the server
|
15
|
+
# * internetAccess<~Boolean> - Optional, set to TRUE to connect the server to the Internet via the specified LAN ID
|
16
|
+
# * lanId<~String> - Optional, connects the server to the specified LAN ID
|
17
|
+
# * osType<~String> - Optional, UNKNOWN, WINDOWS, LINUX, OTHER
|
18
|
+
# * availabilityZone<~String> - Optional, AUTO, ZONE_1, ZONE_2
|
19
|
+
# * cpuHotPlug<~Boolean> - Optional, set the server CPU Hot-Plug capability
|
20
|
+
# * ramHotPlug<~Boolean> - Optional, set the server RAM Hot-Plug capability
|
21
|
+
# * nicHotPlug<~Boolean> - Optional, set the server NIC Hot-Plug capability
|
22
|
+
# * nicHotUnPlug<~Boolean> - Optional, set the server NIC Hot-UnPlug capability
|
23
|
+
# * discVirtioHotPlug<~Boolean> - Optional, set the server capabilities to hotplug storages which are connected through VirtIO bustypeSet
|
24
|
+
# * discVirtioHotUnPlug<~Boolean> - Optional, set the server capabilities to hotUnplug storages which are connected through VirtIO bustypeSet
|
25
|
+
#
|
26
|
+
# ==== Returns
|
27
|
+
# * response<~Excon::Response>:
|
28
|
+
# * body<~Hash>:
|
29
|
+
# * createServerResponse<~Hash>:
|
30
|
+
# * requestId<~String> - ID of request
|
31
|
+
# * dataCenterId<~String> - UUID of virtual data center
|
32
|
+
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
33
|
+
# * serverId<~String> - UUID of the new virtual server
|
34
|
+
#
|
35
|
+
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/CreateServer.html]
|
36
|
+
def create_server(data_center_id, cores, ram, options={})
|
37
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
38
|
+
|xml| xml[:ws].createServer {
|
39
|
+
xml.request {
|
40
|
+
xml.dataCenterId(data_center_id)
|
41
|
+
xml.cores(cores)
|
42
|
+
xml.ram(ram)
|
43
|
+
options.each { |key, value| xml.send(key, value) }
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
request(
|
49
|
+
:expects => [200],
|
50
|
+
:method => 'POST',
|
51
|
+
:body => soap_envelope.to_xml,
|
52
|
+
:parser =>
|
53
|
+
Fog::Parsers::Compute::ProfitBricks::CreateServer.new
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class Mock
|
59
|
+
def create_server(data_center_id, cores, ram, options={})
|
60
|
+
server_id = Fog::UUID.uuid
|
61
|
+
|
62
|
+
server = {
|
63
|
+
'serverId' => server_id,
|
64
|
+
'cores' => cores,
|
65
|
+
'ram' => ram,
|
66
|
+
'serverName' => options['serverName'],
|
67
|
+
'internetAccess' => options['internetAccess'] || 'false',
|
68
|
+
#'ips' => options['ips'] || '',
|
69
|
+
'connectedStorages' => options['connectedStorages'] || [],
|
70
|
+
'romDrives' => options['romDrives'] || [],
|
71
|
+
'nics' => options['nics'] || [],
|
72
|
+
'provisioningState' => 'AVAILABLE',
|
73
|
+
'virtualMachineState' => 'RUNNING',
|
74
|
+
'creationTime' => Time.now,
|
75
|
+
'lastModificationTime' => Time.now,
|
76
|
+
'osType' => options['osType'] || 'UNKNOWN',
|
77
|
+
'availabilityZone' => options['availabilityZone'] || 'AUTO',
|
78
|
+
'dataCenterId' => Fog::UUID.uuid,
|
79
|
+
'dataCenterVersion' => 1
|
80
|
+
##'cpuHotPlug' => 'true',
|
81
|
+
##'ramHotPlug' => 'true',
|
82
|
+
##'nicHotPlug' => 'true',
|
83
|
+
##'nicHotUnPlug' => 'true',
|
84
|
+
##'discVirtioHotPlug' => 'true',
|
85
|
+
##'discVirtioHotUnPlug' => 'true'
|
86
|
+
}
|
87
|
+
|
88
|
+
self.data[:servers] << server
|
89
|
+
|
90
|
+
response = Excon::Response.new
|
91
|
+
response.status = 200
|
92
|
+
response.body = {
|
93
|
+
'createServerResponse' => {
|
94
|
+
'requestId' => Fog::Mock::random_numbers(7),
|
95
|
+
'dataCenterId' => Fog::UUID.uuid,
|
96
|
+
'dataCenterVersion' => 1,
|
97
|
+
'serverId' => server_id
|
98
|
+
}
|
99
|
+
}
|
100
|
+
response
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/create_storage.rb
RENAMED
@@ -2,8 +2,6 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class ProfitBricks
|
4
4
|
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/create_storage'
|
6
|
-
|
7
5
|
# Create new virtual storage
|
8
6
|
#
|
9
7
|
# ==== Parameters
|
@@ -39,8 +37,8 @@ module Fog
|
|
39
37
|
:expects => [200],
|
40
38
|
:method => 'POST',
|
41
39
|
:body => soap_envelope.to_xml,
|
42
|
-
:parser =>
|
43
|
-
|
40
|
+
:parser =>
|
41
|
+
Fog::Parsers::Compute::ProfitBricks::CreateStorage.new
|
44
42
|
)
|
45
43
|
end
|
46
44
|
end
|
@@ -49,7 +47,7 @@ module Fog
|
|
49
47
|
def create_storage(data_center_id, size, options={})
|
50
48
|
response = Excon::Response.new
|
51
49
|
response.status = 200
|
52
|
-
|
50
|
+
|
53
51
|
if data_center = self.data[:datacenters].find {
|
54
52
|
|attrib| attrib['dataCenterId'] == data_center_id
|
55
53
|
}
|
@@ -80,7 +78,7 @@ module Fog
|
|
80
78
|
'lastModificationTime' => Time.now,
|
81
79
|
'profitBricksImagePassword' => options['profitBricksImagePassword'] || ''
|
82
80
|
}
|
83
|
-
|
81
|
+
|
84
82
|
self.data[:volumes] << storage
|
85
83
|
response.body = {
|
86
84
|
'createStorageResponse' => {
|
data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/delete_data_center.rb
RENAMED
@@ -2,8 +2,6 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class ProfitBricks
|
4
4
|
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/delete_data_center'
|
6
|
-
|
7
5
|
# Delete virtual data center
|
8
6
|
#
|
9
7
|
# ==== Parameters
|
@@ -29,8 +27,8 @@ module Fog
|
|
29
27
|
:expects => [200],
|
30
28
|
:method => 'POST',
|
31
29
|
:body => soap_envelope.to_xml,
|
32
|
-
:parser =>
|
33
|
-
|
30
|
+
:parser =>
|
31
|
+
Fog::Parsers::Compute::ProfitBricks::DeleteDataCenter.new
|
34
32
|
)
|
35
33
|
rescue Excon::Errors::InternalServerError => error
|
36
34
|
Fog::Errors::NotFound.new(error)
|
@@ -41,7 +39,7 @@ module Fog
|
|
41
39
|
def delete_data_center(data_center_id)
|
42
40
|
response = Excon::Response.new
|
43
41
|
response.status = 200
|
44
|
-
|
42
|
+
|
45
43
|
if data_center = self.data[:datacenters].find {
|
46
44
|
|attrib| attrib['dataCenterId'] == data_center_id
|
47
45
|
}
|
@@ -2,8 +2,6 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class ProfitBricks
|
4
4
|
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/delete_nic'
|
6
|
-
|
7
5
|
# Delete virtual network interface
|
8
6
|
#
|
9
7
|
# ==== Parameters
|
@@ -29,8 +27,8 @@ module Fog
|
|
29
27
|
:expects => [200],
|
30
28
|
:method => 'POST',
|
31
29
|
:body => soap_envelope.to_xml,
|
32
|
-
:parser =>
|
33
|
-
|
30
|
+
:parser =>
|
31
|
+
Fog::Parsers::Compute::ProfitBricks::DeleteNic.new
|
34
32
|
)
|
35
33
|
rescue Excon::Errors::InternalServerError => error
|
36
34
|
Fog::Errors::NotFound.new(error)
|
@@ -41,7 +39,7 @@ module Fog
|
|
41
39
|
def delete_nic(nic_id)
|
42
40
|
response = Excon::Response.new
|
43
41
|
response.status = 200
|
44
|
-
|
42
|
+
|
45
43
|
if nic = self.data[:interfaces].find {
|
46
44
|
|attrib| attrib['nicId'] == nic_id
|
47
45
|
}
|
data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/delete_server.rb
RENAMED
@@ -2,8 +2,6 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class ProfitBricks
|
4
4
|
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/delete_server'
|
6
|
-
|
7
5
|
# Delete virtual server
|
8
6
|
#
|
9
7
|
# ==== Parameters
|
@@ -29,8 +27,8 @@ module Fog
|
|
29
27
|
:expects => [200],
|
30
28
|
:method => 'POST',
|
31
29
|
:body => soap_envelope.to_xml,
|
32
|
-
:parser =>
|
33
|
-
|
30
|
+
:parser =>
|
31
|
+
Fog::Parsers::Compute::ProfitBricks::DeleteServer.new
|
34
32
|
)
|
35
33
|
rescue Excon::Errors::InternalServerError => error
|
36
34
|
Fog::Errors::NotFound.new(error)
|
data/lib/fog/{profitbricks/requests/compute → compute/profit_bricks/requests}/delete_storage.rb
RENAMED
@@ -2,8 +2,6 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class ProfitBricks
|
4
4
|
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/delete_storage'
|
6
|
-
|
7
5
|
# Delete a virtual storage
|
8
6
|
#
|
9
7
|
# ==== Parameters
|
@@ -29,8 +27,8 @@ module Fog
|
|
29
27
|
:expects => [200],
|
30
28
|
:method => 'POST',
|
31
29
|
:body => soap_envelope.to_xml,
|
32
|
-
:parser =>
|
33
|
-
|
30
|
+
:parser =>
|
31
|
+
Fog::Parsers::Compute::ProfitBricks::DeleteStorage.new
|
34
32
|
)
|
35
33
|
rescue Excon::Errors::InternalServerError => error
|
36
34
|
Fog::Errors::NotFound.new(error)
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Disconnect virtual storage
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * serverId<~String> - UUID of virtual server
|
9
|
+
# * storageId<~String> - UUID of virtual storage
|
10
|
+
#
|
11
|
+
# ==== Returns
|
12
|
+
# * response<~Excon::Response>:
|
13
|
+
# * body<~Hash>:
|
14
|
+
# * disconnectStorageToServerResponse<~Hash>:
|
15
|
+
# * requestId<~String> - ID of request
|
16
|
+
# * dataCenterId<~String> - UUID of virtual data center
|
17
|
+
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
18
|
+
#
|
19
|
+
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/DisconnectStorage.html]
|
20
|
+
def disconnect_storage_from_server(storage_id, server_id)
|
21
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
22
|
+
|xml| xml[:ws].disconnectStorageFromServer {
|
23
|
+
xml.serverId(server_id)
|
24
|
+
xml.storageId(storage_id)
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
request(
|
29
|
+
:expects => [200],
|
30
|
+
:method => 'POST',
|
31
|
+
:body => soap_envelope.to_xml,
|
32
|
+
:parser =>
|
33
|
+
Fog::Parsers::Compute::ProfitBricks::DisconnectStorageFromServer.new
|
34
|
+
)
|
35
|
+
rescue Excon::Errors::InternalServerError => error
|
36
|
+
Fog::Errors::NotFound.new(error)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
def disconnect_storage_from_server(storage_id, server_id)
|
42
|
+
|
43
|
+
if storage = self.data[:volumes].find {
|
44
|
+
|attrib| attrib['storageId'] == storage_id
|
45
|
+
}
|
46
|
+
else
|
47
|
+
raise Fog::Errors::NotFound.new(
|
48
|
+
'The requested storage resource could not be found'
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
if server = self.data[:servers].find {
|
53
|
+
|attrib| attrib['serverId'] == server_id
|
54
|
+
}['connectedStorages'].delete(storage)
|
55
|
+
else
|
56
|
+
raise Fog::Errors::NotFound.new(
|
57
|
+
'The requested server resource could not be found'
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
response = Excon::Response.new
|
62
|
+
response.status = 200
|
63
|
+
response.body =
|
64
|
+
{ 'disconnectStorageFromServerResponse' =>
|
65
|
+
{
|
66
|
+
'requestId' => Fog::Mock::random_numbers(7),
|
67
|
+
'dataCenterId' => Fog::UUID.uuid,
|
68
|
+
'dataCenterVersion' => 1
|
69
|
+
}
|
70
|
+
}
|
71
|
+
response
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|