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
@@ -1,81 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class ProfitBricks
|
4
|
-
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/create_nic'
|
6
|
-
|
7
|
-
# Create new virtual network interface
|
8
|
-
#
|
9
|
-
# ==== Parameters
|
10
|
-
# * serverId<~String> - Required,
|
11
|
-
# * lanId - Required,
|
12
|
-
# * options<~Hash>:
|
13
|
-
# * nicName<~String> - Optional, name of the new virtual network interface
|
14
|
-
# * ip<~String> - Optional,
|
15
|
-
# * dhcpActive<~String> - Optional,
|
16
|
-
#
|
17
|
-
# ==== Returns
|
18
|
-
# * response<~Excon::Response>:
|
19
|
-
# * body<~Hash>:
|
20
|
-
# * createNicResponse<~Hash>:
|
21
|
-
# * requestId<~String> - ID of request
|
22
|
-
# * dataCenterId<~String> - UUID of virtual data center
|
23
|
-
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
24
|
-
# * nicId<~String> - UUID of the new virtual network interface
|
25
|
-
#
|
26
|
-
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/CreateNIC.html]
|
27
|
-
def create_nic(server_id, lan_id, options={})
|
28
|
-
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
29
|
-
|xml| xml[:ws].createNic {
|
30
|
-
xml.request {
|
31
|
-
xml.serverId(server_id)
|
32
|
-
xml.lanId(lan_id)
|
33
|
-
options.each { |key, value| xml.send(key, value) }
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
request(
|
39
|
-
:expects => [200],
|
40
|
-
:method => 'POST',
|
41
|
-
:body => soap_envelope.to_xml,
|
42
|
-
:parser =>
|
43
|
-
Fog::Parsers::Compute::ProfitBricks::CreateNic.new
|
44
|
-
)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class Mock
|
49
|
-
def create_nic(server_id, lan_id, options={})
|
50
|
-
response = Excon::Response.new
|
51
|
-
response.status = 200
|
52
|
-
|
53
|
-
nic_id = Fog::UUID.uuid
|
54
|
-
nic = {
|
55
|
-
'nicId' => nic_id,
|
56
|
-
'lanId' => lan_id,
|
57
|
-
'nicName' => options['nicName'] || '',
|
58
|
-
'internetAccess' => options['internetAccess'] || 'false',
|
59
|
-
'ip' => options['ip'] || nil,
|
60
|
-
'macAddress' => Fog::Mock::random_hex(12),
|
61
|
-
'firewall' => {},
|
62
|
-
'dhcpActive' => options['dhcpActive'] || 'false',
|
63
|
-
'provisioningState' => 'AVAILABLE'
|
64
|
-
}
|
65
|
-
|
66
|
-
self.data[:interfaces] << nic
|
67
|
-
response.body = {
|
68
|
-
'createNicResponse' =>
|
69
|
-
{
|
70
|
-
'requestId' => Fog::Mock::random_numbers(7),
|
71
|
-
'dataCenterId' => Fog::UUID.uuid,
|
72
|
-
'dataCenterVersion' => 1,
|
73
|
-
'nicId' => nic_id
|
74
|
-
}
|
75
|
-
}
|
76
|
-
response
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class ProfitBricks
|
4
|
-
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/create_server'
|
6
|
-
|
7
|
-
# Create new virtual server
|
8
|
-
#
|
9
|
-
# ==== Parameters
|
10
|
-
# * dataCenterId<~String> - Required, UUID of virtual data center
|
11
|
-
# * cores<~Integer> - Required, number of CPU cores allocated to virtual server
|
12
|
-
# * ram<~Integer> - Required, amount of memory in GB allocated to virtual server
|
13
|
-
# * options<~Hash>:
|
14
|
-
# * serverName<~String> - Optional, name of the new virtual network interface
|
15
|
-
# * bootFromStorageId<~String> - Optional, defines an existing storage device ID to be set as boot device of the server
|
16
|
-
# * bootFromImageId<~<String> - Optional, defines an existing CD-ROM/DVD image ID to be set as boot device of the server
|
17
|
-
# * internetAccess<~Boolean> - Optional, set to TRUE to connect the server to the Internet via the specified LAN ID
|
18
|
-
# * lanId<~String> - Optional, connects the server to the specified LAN ID
|
19
|
-
# * osType<~String> - Optional, UNKNOWN, WINDOWS, LINUX, OTHER
|
20
|
-
# * availabilityZone<~String> - Optional, AUTO, ZONE_1, ZONE_2
|
21
|
-
# * cpuHotPlug<~Boolean> - Optional, set the server CPU Hot-Plug capability
|
22
|
-
# * ramHotPlug<~Boolean> - Optional, set the server RAM Hot-Plug capability
|
23
|
-
# * nicHotPlug<~Boolean> - Optional, set the server NIC Hot-Plug capability
|
24
|
-
# * nicHotUnPlug<~Boolean> - Optional, set the server NIC Hot-UnPlug capability
|
25
|
-
# * discVirtioHotPlug<~Boolean> - Optional, set the server capabilities to hotplug storages which are connected through VirtIO bustypeSet
|
26
|
-
# * discVirtioHotUnPlug<~Boolean> - Optional, set the server capabilities to hotUnplug storages which are connected through VirtIO bustypeSet
|
27
|
-
#
|
28
|
-
# ==== Returns
|
29
|
-
# * response<~Excon::Response>:
|
30
|
-
# * body<~Hash>:
|
31
|
-
# * createServerResponse<~Hash>:
|
32
|
-
# * requestId<~String> - ID of request
|
33
|
-
# * dataCenterId<~String> - UUID of virtual data center
|
34
|
-
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
35
|
-
# * serverId<~String> - UUID of the new virtual server
|
36
|
-
#
|
37
|
-
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/CreateServer.html]
|
38
|
-
def create_server(data_center_id, cores, ram, options={})
|
39
|
-
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
40
|
-
|xml| xml[:ws].createServer {
|
41
|
-
xml.request {
|
42
|
-
xml.dataCenterId(data_center_id)
|
43
|
-
xml.cores(cores)
|
44
|
-
xml.ram(ram)
|
45
|
-
options.each { |key, value| xml.send(key, value) }
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
request(
|
51
|
-
:expects => [200],
|
52
|
-
:method => 'POST',
|
53
|
-
:body => soap_envelope.to_xml,
|
54
|
-
:parser =>
|
55
|
-
Fog::Parsers::Compute::ProfitBricks::CreateServer.new
|
56
|
-
)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
class Mock
|
61
|
-
def create_server(data_center_id, cores, ram, options={})
|
62
|
-
server_id = Fog::UUID.uuid
|
63
|
-
|
64
|
-
server = {
|
65
|
-
'serverId' => server_id,
|
66
|
-
'cores' => cores,
|
67
|
-
'ram' => ram,
|
68
|
-
'serverName' => options['serverName'],
|
69
|
-
'internetAccess' => options['internetAccess'] || 'false',
|
70
|
-
#'ips' => options['ips'] || '',
|
71
|
-
'connectedStorages' => options['connectedStorages'] || [],
|
72
|
-
'romDrives' => options['romDrives'] || [],
|
73
|
-
'nics' => options['nics'] || [],
|
74
|
-
'provisioningState' => 'AVAILABLE',
|
75
|
-
'virtualMachineState' => 'RUNNING',
|
76
|
-
'creationTime' => Time.now,
|
77
|
-
'lastModificationTime' => Time.now,
|
78
|
-
'osType' => options['osType'] || 'UNKNOWN',
|
79
|
-
'availabilityZone' => options['availabilityZone'] || 'AUTO',
|
80
|
-
'dataCenterId' => Fog::UUID.uuid,
|
81
|
-
'dataCenterVersion' => 1
|
82
|
-
##'cpuHotPlug' => 'true',
|
83
|
-
##'ramHotPlug' => 'true',
|
84
|
-
##'nicHotPlug' => 'true',
|
85
|
-
##'nicHotUnPlug' => 'true',
|
86
|
-
##'discVirtioHotPlug' => 'true',
|
87
|
-
##'discVirtioHotUnPlug' => 'true'
|
88
|
-
}
|
89
|
-
|
90
|
-
self.data[:servers] << server
|
91
|
-
|
92
|
-
response = Excon::Response.new
|
93
|
-
response.status = 200
|
94
|
-
response.body = {
|
95
|
-
'createServerResponse' => {
|
96
|
-
'requestId' => Fog::Mock::random_numbers(7),
|
97
|
-
'dataCenterId' => Fog::UUID.uuid,
|
98
|
-
'dataCenterVersion' => 1,
|
99
|
-
'serverId' => server_id
|
100
|
-
}
|
101
|
-
}
|
102
|
-
response
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class ProfitBricks
|
4
|
-
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/disconnect_storage_from_server'
|
6
|
-
|
7
|
-
# Disconnect virtual storage
|
8
|
-
#
|
9
|
-
# ==== Parameters
|
10
|
-
# * serverId<~String> - UUID of virtual server
|
11
|
-
# * storageId<~String> - UUID of virtual storage
|
12
|
-
#
|
13
|
-
# ==== Returns
|
14
|
-
# * response<~Excon::Response>:
|
15
|
-
# * body<~Hash>:
|
16
|
-
# * disconnectStorageToServerResponse<~Hash>:
|
17
|
-
# * requestId<~String> - ID of request
|
18
|
-
# * dataCenterId<~String> - UUID of virtual data center
|
19
|
-
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
20
|
-
#
|
21
|
-
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/DisconnectStorage.html]
|
22
|
-
def disconnect_storage_from_server(storage_id, server_id)
|
23
|
-
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
24
|
-
|xml| xml[:ws].disconnectStorageFromServer {
|
25
|
-
xml.serverId(server_id)
|
26
|
-
xml.storageId(storage_id)
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
request(
|
31
|
-
:expects => [200],
|
32
|
-
:method => 'POST',
|
33
|
-
:body => soap_envelope.to_xml,
|
34
|
-
:parser =>
|
35
|
-
Fog::Parsers::Compute::ProfitBricks::DisconnectStorageFromServer.new
|
36
|
-
)
|
37
|
-
rescue Excon::Errors::InternalServerError => error
|
38
|
-
Fog::Errors::NotFound.new(error)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class Mock
|
43
|
-
def disconnect_storage_from_server(storage_id, server_id)
|
44
|
-
|
45
|
-
if storage = self.data[:volumes].find {
|
46
|
-
|attrib| attrib['storageId'] == storage_id
|
47
|
-
}
|
48
|
-
else
|
49
|
-
raise Fog::Errors::NotFound.new(
|
50
|
-
'The requested storage resource could not be found'
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
if server = self.data[:servers].find {
|
55
|
-
|attrib| attrib['serverId'] == server_id
|
56
|
-
}['connectedStorages'].delete(storage)
|
57
|
-
else
|
58
|
-
raise Fog::Errors::NotFound.new(
|
59
|
-
'The requested server resource could not be found'
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
response = Excon::Response.new
|
64
|
-
response.status = 200
|
65
|
-
response.body =
|
66
|
-
{ 'disconnectStorageFromServerResponse' =>
|
67
|
-
{
|
68
|
-
'requestId' => Fog::Mock::random_numbers(7),
|
69
|
-
'dataCenterId' => Fog::UUID.uuid,
|
70
|
-
'dataCenterVersion' => 1
|
71
|
-
}
|
72
|
-
}
|
73
|
-
response
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class ProfitBricks
|
4
|
-
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/set_internet_access'
|
6
|
-
|
7
|
-
# Connect an existing NIC to a public LAN to get internet access
|
8
|
-
#
|
9
|
-
# ==== Parameters
|
10
|
-
# * dataCenterId<~String> -
|
11
|
-
# * lanId<~Integer> -
|
12
|
-
# * internetAccess<~Boolean> -
|
13
|
-
#
|
14
|
-
# ==== Returns
|
15
|
-
# * response<~Excon::Response>:
|
16
|
-
# * body<~Hash>:
|
17
|
-
# * setInternetAccessResponse<~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/SetInternetAccess.html]
|
23
|
-
def set_internet_access(data_center_id, lan_id, internet_access)
|
24
|
-
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
25
|
-
|xml| xml[:ws].setInternetAccess {
|
26
|
-
xml.dataCenterId(data_center_id)
|
27
|
-
xml.lanId(lan_id)
|
28
|
-
xml.internetAccess(internet_access)
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
request(
|
33
|
-
:expects => [200],
|
34
|
-
:method => 'POST',
|
35
|
-
:body => soap_envelope.to_xml,
|
36
|
-
:parser =>
|
37
|
-
Fog::Parsers::Compute::ProfitBricks::SetInternetAccess.new
|
38
|
-
)
|
39
|
-
rescue Excon::Errors::InternalServerError => error
|
40
|
-
Fog::Errors::NotFound.new(error)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
class Mock
|
45
|
-
def set_internet_access(data_center_id, lan_id, internet_access)
|
46
|
-
response = Excon::Response.new
|
47
|
-
response.status = 200
|
48
|
-
response.body = {
|
49
|
-
'setInternetAccessResponse' =>
|
50
|
-
{
|
51
|
-
'requestId' => Fog::Mock::random_numbers(7),
|
52
|
-
'dataCenterId' => Fog::UUID.uuid,
|
53
|
-
'dataCenterVersion' => 1
|
54
|
-
}
|
55
|
-
}
|
56
|
-
response
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class ProfitBricks
|
4
|
-
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/update_nic'
|
6
|
-
|
7
|
-
# Update a virtual NIC
|
8
|
-
#
|
9
|
-
# ==== Parameters
|
10
|
-
# * nicId<~String> - Required,
|
11
|
-
# * options<~Hash>:
|
12
|
-
# * lanId<~Integer> - Optional,
|
13
|
-
# * nicName<~String> - Optional, name of the new virtual network interface
|
14
|
-
# * ip<~String> - Optional,
|
15
|
-
# * dhcpActive<~Boolean> - Optional,
|
16
|
-
#
|
17
|
-
# ==== Returns
|
18
|
-
# * response<~Excon::Response>:
|
19
|
-
# * body<~Hash>:
|
20
|
-
# * updateNicResponse<~Hash>:
|
21
|
-
# * requestId<~String> - ID of request
|
22
|
-
# * dataCenterId<~String> - UUID of virtual data center
|
23
|
-
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
24
|
-
#
|
25
|
-
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/UpdateNIC.html]
|
26
|
-
def update_nic(nic_id, options={})
|
27
|
-
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
28
|
-
|xml| xml[:ws].updateNic {
|
29
|
-
xml.request {
|
30
|
-
xml.nicId(nic_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::UpdateNic.new
|
42
|
-
)
|
43
|
-
rescue Excon::Errors::InternalServerError => error
|
44
|
-
Fog::Errors::NotFound.new(error)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class Mock
|
49
|
-
def update_nic(nic_id, options={})
|
50
|
-
|
51
|
-
if nic = self.data[:interfaces].find {
|
52
|
-
|attrib| attrib['nicId'] == nic_id
|
53
|
-
}
|
54
|
-
options.each do |key, value|
|
55
|
-
nic[key] = value
|
56
|
-
end
|
57
|
-
else
|
58
|
-
raise Fog::Errors::NotFound.new('The requested NIC could not be found')
|
59
|
-
end
|
60
|
-
|
61
|
-
response = Excon::Response.new
|
62
|
-
response.status = 200
|
63
|
-
response.body = {
|
64
|
-
'updateNicResponse' =>
|
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
|
@@ -1,81 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class ProfitBricks
|
4
|
-
class Real
|
5
|
-
require 'fog/profitbricks/parsers/compute/update_server'
|
6
|
-
|
7
|
-
# Update a virtual server
|
8
|
-
#
|
9
|
-
# ==== Parameters
|
10
|
-
# * serverId<~String> - Required, UUID of virtual server
|
11
|
-
# * options<~Hash>:
|
12
|
-
# * serverName<~String> - Optional,
|
13
|
-
# * cores<~Integer> - Optional,
|
14
|
-
# * ram<~Integer> Optional, Memory in MB
|
15
|
-
# * bootFromStorageId<~String> - Optional, UUID of boot storage
|
16
|
-
# * bootFromImageId<~String> -
|
17
|
-
# * osType<~String> - Optional, UNKNOWN, WINDOWS, LINUX, OTHER
|
18
|
-
# * availabilityZone<~String> - Optional, AUTO, ZONE_1, ZONE_2
|
19
|
-
#
|
20
|
-
# ==== Returns
|
21
|
-
# * response<~Excon::Response>:
|
22
|
-
# * body<~Hash>:
|
23
|
-
# * updateServerResponse<~Hash>:
|
24
|
-
# * requestId<~String> - ID of request
|
25
|
-
# * dataCenterId<~String> - UUID of virtual data center
|
26
|
-
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
27
|
-
#
|
28
|
-
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/UpdateServer.html]
|
29
|
-
def update_server(server_id, options={})
|
30
|
-
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
31
|
-
|xml| xml[:ws].updateServer {
|
32
|
-
xml.request {
|
33
|
-
xml.serverId(server_id)
|
34
|
-
options.each { |key, value| xml.send(key, value) }
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
request(
|
40
|
-
:expects => [200],
|
41
|
-
:method => 'POST',
|
42
|
-
:body => soap_envelope.to_xml,
|
43
|
-
:parser =>
|
44
|
-
Fog::Parsers::Compute::ProfitBricks::UpdateServer.new
|
45
|
-
)
|
46
|
-
rescue Excon::Errors::InternalServerError => error
|
47
|
-
Fog::Errors::NotFound.new(error)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class Mock
|
52
|
-
def update_server(server_id, options={})
|
53
|
-
|
54
|
-
if server = self.data[:servers].find {
|
55
|
-
|attrib| attrib['serverId'] == server_id
|
56
|
-
}
|
57
|
-
options.each do |key, value|
|
58
|
-
server[key] = value
|
59
|
-
end
|
60
|
-
else
|
61
|
-
raise Fog::Errors::NotFound.new(
|
62
|
-
'The requested server resource could not be found'
|
63
|
-
)
|
64
|
-
end
|
65
|
-
|
66
|
-
response = Excon::Response.new
|
67
|
-
response.status = 200
|
68
|
-
response.body = {
|
69
|
-
'updateServerResponse' =>
|
70
|
-
{
|
71
|
-
'requestId' => Fog::Mock::random_numbers(7),
|
72
|
-
'dataCenterId' => Fog::UUID.uuid,
|
73
|
-
'dataCenterVersion' => 1
|
74
|
-
}
|
75
|
-
}
|
76
|
-
response
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|