fog-profitbricks 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.rubocop.yml +21 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +25 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +2 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +29 -0
- data/Rakefile +21 -0
- data/examples/pb_demo.rb +53 -0
- data/fog-profitbricks.gemspec +31 -0
- data/gemfiles/Gemfile.1.8.7 +7 -0
- data/gemfiles/Gemfile.1.9.2+ +6 -0
- data/lib/fog/bin/profitbricks.rb +29 -0
- data/lib/fog/profitbricks.rb +13 -0
- data/lib/fog/profitbricks/compute.rb +215 -0
- data/lib/fog/profitbricks/core.rb +18 -0
- data/lib/fog/profitbricks/models/compute/datacenter.rb +59 -0
- data/lib/fog/profitbricks/models/compute/datacenters.rb +24 -0
- data/lib/fog/profitbricks/models/compute/flavor.rb +27 -0
- data/lib/fog/profitbricks/models/compute/flavors.rb +24 -0
- data/lib/fog/profitbricks/models/compute/image.rb +30 -0
- data/lib/fog/profitbricks/models/compute/images.rb +23 -0
- data/lib/fog/profitbricks/models/compute/interface.rb +64 -0
- data/lib/fog/profitbricks/models/compute/interfaces.rb +24 -0
- data/lib/fog/profitbricks/models/compute/region.rb +15 -0
- data/lib/fog/profitbricks/models/compute/regions.rb +24 -0
- data/lib/fog/profitbricks/models/compute/server.rb +107 -0
- data/lib/fog/profitbricks/models/compute/servers.rb +23 -0
- data/lib/fog/profitbricks/models/compute/volume.rb +74 -0
- data/lib/fog/profitbricks/models/compute/volumes.rb +24 -0
- data/lib/fog/profitbricks/parsers/base.rb +49 -0
- data/lib/fog/profitbricks/parsers/compute/clear_data_center.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/connect_storage_to_server.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/create_data_center.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/create_nic.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/create_server.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/create_storage.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/delete_data_center.rb +20 -0
- data/lib/fog/profitbricks/parsers/compute/delete_nic.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/delete_server.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/delete_storage.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/disconnect_storage_from_server.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/get_all_data_centers.rb +26 -0
- data/lib/fog/profitbricks/parsers/compute/get_all_images.rb +30 -0
- data/lib/fog/profitbricks/parsers/compute/get_all_nic.rb +30 -0
- data/lib/fog/profitbricks/parsers/compute/get_all_servers.rb +56 -0
- data/lib/fog/profitbricks/parsers/compute/get_all_storages.rb +33 -0
- data/lib/fog/profitbricks/parsers/compute/get_data_center.rb +23 -0
- data/lib/fog/profitbricks/parsers/compute/get_data_center_state.rb +20 -0
- data/lib/fog/profitbricks/parsers/compute/get_image.rb +26 -0
- data/lib/fog/profitbricks/parsers/compute/get_nic.rb +27 -0
- data/lib/fog/profitbricks/parsers/compute/get_server.rb +55 -0
- data/lib/fog/profitbricks/parsers/compute/get_storage.rb +30 -0
- data/lib/fog/profitbricks/parsers/compute/reset_server.rb +20 -0
- data/lib/fog/profitbricks/parsers/compute/set_internet_access.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/update_data_center.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/update_nic.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/update_server.rb +22 -0
- data/lib/fog/profitbricks/parsers/compute/update_storage.rb +22 -0
- data/lib/fog/profitbricks/requests/compute/clear_data_center.rb +53 -0
- data/lib/fog/profitbricks/requests/compute/connect_storage_to_server.rb +85 -0
- data/lib/fog/profitbricks/requests/compute/create_data_center.rb +64 -0
- data/lib/fog/profitbricks/requests/compute/create_flavor.rb +40 -0
- data/lib/fog/profitbricks/requests/compute/create_nic.rb +81 -0
- data/lib/fog/profitbricks/requests/compute/create_server.rb +107 -0
- data/lib/fog/profitbricks/requests/compute/create_storage.rb +98 -0
- data/lib/fog/profitbricks/requests/compute/delete_data_center.rb +62 -0
- data/lib/fog/profitbricks/requests/compute/delete_nic.rb +66 -0
- data/lib/fog/profitbricks/requests/compute/delete_server.rb +66 -0
- data/lib/fog/profitbricks/requests/compute/delete_storage.rb +66 -0
- data/lib/fog/profitbricks/requests/compute/disconnect_storage_from_server.rb +78 -0
- data/lib/fog/profitbricks/requests/compute/get_all_data_centers.rb +32 -0
- data/lib/fog/profitbricks/requests/compute/get_all_flavors.rb +77 -0
- data/lib/fog/profitbricks/requests/compute/get_all_images.rb +67 -0
- data/lib/fog/profitbricks/requests/compute/get_all_locations.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/get_all_nic.rb +55 -0
- data/lib/fog/profitbricks/requests/compute/get_all_servers.rb +58 -0
- data/lib/fog/profitbricks/requests/compute/get_all_storages.rb +58 -0
- data/lib/fog/profitbricks/requests/compute/get_data_center.rb +40 -0
- data/lib/fog/profitbricks/requests/compute/get_data_center_state.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/get_flavor.rb +82 -0
- data/lib/fog/profitbricks/requests/compute/get_image.rb +71 -0
- data/lib/fog/profitbricks/requests/compute/get_location.rb +48 -0
- data/lib/fog/profitbricks/requests/compute/get_nic.rb +65 -0
- data/lib/fog/profitbricks/requests/compute/get_server.rb +100 -0
- data/lib/fog/profitbricks/requests/compute/get_storage.rb +65 -0
- data/lib/fog/profitbricks/requests/compute/reset_server.rb +51 -0
- data/lib/fog/profitbricks/requests/compute/set_internet_access.rb +61 -0
- data/lib/fog/profitbricks/requests/compute/start_server.rb +59 -0
- data/lib/fog/profitbricks/requests/compute/stop_server.rb +59 -0
- data/lib/fog/profitbricks/requests/compute/update_data_center.rb +55 -0
- data/lib/fog/profitbricks/requests/compute/update_nic.rb +76 -0
- data/lib/fog/profitbricks/requests/compute/update_server.rb +81 -0
- data/lib/fog/profitbricks/requests/compute/update_storage.rb +75 -0
- data/lib/fog/profitbricks/version.rb +5 -0
- data/spec/minitest_helper.rb +33 -0
- data/tests/helper.rb +19 -0
- data/tests/helpers/formats_helper.rb +23 -0
- data/tests/helpers/mock_helper.rb +8 -0
- data/tests/profitbricks/requests/compute/flavor_tests.rb +43 -0
- data/tests/profitbricks/requests/compute/image_tests.rb +50 -0
- data/tests/profitbricks/requests/compute/interface_tests.rb +101 -0
- data/tests/profitbricks/requests/compute/location_tests.rb +33 -0
- data/tests/profitbricks/requests/compute/server_tests.rb +246 -0
- metadata +293 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class ProfitBricks
|
|
4
|
+
class Real
|
|
5
|
+
def get_all_flavors()
|
|
6
|
+
response = Excon::Response.new
|
|
7
|
+
response.status = 200
|
|
8
|
+
response.body = {
|
|
9
|
+
'getAllFlavorsResponse' => [
|
|
10
|
+
{
|
|
11
|
+
'flavorId' => '00db4c8f-5e83-49b0-a70b-ac4aad786163',
|
|
12
|
+
'flavorName' => 'Micro',
|
|
13
|
+
'ram' => 1024,
|
|
14
|
+
'cores' => 1
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
'flavorId' => 'dc64957b-be9d-431e-91cd-9e217f94d3de',
|
|
18
|
+
'flavorName' => 'Small',
|
|
19
|
+
'ram' => 2048,
|
|
20
|
+
'cores' => 1
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
'flavorId' => 'b37d000e-b347-4592-b572-df13ef8f68e1',
|
|
24
|
+
'flavorName' => 'Medium',
|
|
25
|
+
'ram' => 4096,
|
|
26
|
+
'cores' => 2
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
'flavorId' => 'a5a4389f-54b6-4f47-b6e8-1c5c55976b94',
|
|
30
|
+
'flavorName' => 'Large',
|
|
31
|
+
'ram' => 7168,
|
|
32
|
+
'cores' => 4
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
'flavorId' => '0052db40-f1dd-4ecf-a711-5980081b7059',
|
|
36
|
+
'flavorName' => 'Extra Large',
|
|
37
|
+
'ram' => 14336,
|
|
38
|
+
'cores' => 8
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
'flavorId' => '8b2b835d-be09-48cf-aae2-7e35aafe92d6',
|
|
42
|
+
'flavorName' => 'Memory Intensive Small',
|
|
43
|
+
'ram' => 16384,
|
|
44
|
+
'cores' => 2
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
'flavorId' => '45c28f8b-6a67-4f69-8c94-231d371da2b6',
|
|
48
|
+
'flavorName' => 'Memory Intensive Medium',
|
|
49
|
+
'ram' => 28672,
|
|
50
|
+
'cores' => 4
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
'flavorId' => '1d22436d-d958-4151-b144-43a8e180c4c4',
|
|
54
|
+
'flavorName' => 'Memory Intensive Large',
|
|
55
|
+
'ram' => 57344,
|
|
56
|
+
'cores' => 8
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
response
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class Mock
|
|
65
|
+
def get_all_flavors
|
|
66
|
+
data = self.data[:flavors]
|
|
67
|
+
response = Excon::Response.new
|
|
68
|
+
response.status = 200
|
|
69
|
+
response.body = {
|
|
70
|
+
'getAllFlavorsResponse' => self.data[:flavors]
|
|
71
|
+
}
|
|
72
|
+
response
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class ProfitBricks
|
|
4
|
+
class Real
|
|
5
|
+
require 'fog/profitbricks/parsers/compute/get_all_images'
|
|
6
|
+
|
|
7
|
+
# Displays a list of all available images.
|
|
8
|
+
#
|
|
9
|
+
# ==== Parameters
|
|
10
|
+
# * N/A
|
|
11
|
+
#
|
|
12
|
+
# ==== Returns
|
|
13
|
+
# * response<~Excon::Response>:
|
|
14
|
+
# * body<~Hash>:
|
|
15
|
+
# * getAllImagesResponse<~Hash>:
|
|
16
|
+
# * imageId<~String> - Identifer of the image
|
|
17
|
+
# * imageName<~String> - Name of the image
|
|
18
|
+
# * imageSize<~Integer> - Size of the image
|
|
19
|
+
# * imageType<~String> - Image type HDD or CD-ROM/DVD (ISO) image
|
|
20
|
+
# * writeable<~String> - Image is writable (TRUE/FALSE)
|
|
21
|
+
# * bootable<~String> - Image is bootable
|
|
22
|
+
# * cpuHotplug<~String> -Image supports CPU Hot-Plugging
|
|
23
|
+
# * cpuHotUnplug<~String> -
|
|
24
|
+
# * ramHotPlug<~String> - Image supports memory Hot-Plugging
|
|
25
|
+
# * ramHotUnPlug<~String> -
|
|
26
|
+
# * discVirtioHotPlug<~String> -
|
|
27
|
+
# * discVirtioHotUnplug<~String> -
|
|
28
|
+
# * nicHotPlug<~String> -
|
|
29
|
+
# * nicHotUnplug<~String> -
|
|
30
|
+
# * serverIds<~String> - List all servers by ID on which the image is used
|
|
31
|
+
# * location<~String> - Location where the image has been uploaded
|
|
32
|
+
# * osType<~String> - OS type of an image (WINDOWS, LINUX, OTHER, UNKNOWN)
|
|
33
|
+
# * public<~String> - Shows if image is publicly available or private
|
|
34
|
+
#
|
|
35
|
+
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/APIDocumentation.html?GetAllImages.html]
|
|
36
|
+
def get_all_images()
|
|
37
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
|
38
|
+
|xml| xml[:ws].getAllImages
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
request(
|
|
42
|
+
:expects => [200],
|
|
43
|
+
:method => 'POST',
|
|
44
|
+
:body => soap_envelope.to_xml,
|
|
45
|
+
:parser =>
|
|
46
|
+
Fog::Parsers::Compute::ProfitBricks::GetAllImages.new
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class Mock
|
|
52
|
+
def get_all_images()
|
|
53
|
+
if data = self.data[:images]
|
|
54
|
+
response = Excon::Response.new
|
|
55
|
+
response.status = 200
|
|
56
|
+
response.body = {
|
|
57
|
+
'getAllImagesResponse' => self.data[:images]
|
|
58
|
+
}
|
|
59
|
+
response
|
|
60
|
+
else
|
|
61
|
+
raise Fog::Compute::NotFound
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class ProfitBricks
|
|
4
|
+
class Real
|
|
5
|
+
def get_all_locations(options={})
|
|
6
|
+
response = Excon::Response.new
|
|
7
|
+
response.status = 200
|
|
8
|
+
response.body = {
|
|
9
|
+
'getAllLocationsResponse' => [
|
|
10
|
+
{
|
|
11
|
+
'locationId' => 'c0420cc0-90e8-4f4b-8860-df0a07d18047',
|
|
12
|
+
'locationName' => 'de/fkb',
|
|
13
|
+
'country' => 'DEU'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
'locationId' => '68c4099a-d9d8-4683-bdc2-12789aacfa2a',
|
|
17
|
+
'locationName' => 'de/fra',
|
|
18
|
+
'country' => 'DEU'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
'locationId' => 'e102ba74-6764-47f3-8896-246141da8ada',
|
|
22
|
+
'locationName' => 'us/las',
|
|
23
|
+
'country' => 'USA'
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
response
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class Mock
|
|
32
|
+
def get_all_locations(options={})
|
|
33
|
+
data = self.data[:regions]
|
|
34
|
+
response = Excon::Response.new
|
|
35
|
+
response.status = 200
|
|
36
|
+
response.body = {
|
|
37
|
+
'getAllLocationsResponse' => self.data[:regions]
|
|
38
|
+
}
|
|
39
|
+
response
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class ProfitBricks
|
|
4
|
+
class Real
|
|
5
|
+
require 'fog/profitbricks/parsers/compute/get_all_nic'
|
|
6
|
+
|
|
7
|
+
# Returns all virtual NICs
|
|
8
|
+
#
|
|
9
|
+
# ==== Parameters
|
|
10
|
+
# * N/A
|
|
11
|
+
#
|
|
12
|
+
# ==== Returns
|
|
13
|
+
# * response<~Excon::Response>:
|
|
14
|
+
# * body<~Hash>:
|
|
15
|
+
# * getAllNicResponse<~Hash>:
|
|
16
|
+
# * nicId<~String> - UUID of the network interface
|
|
17
|
+
# * nicName<~String> - Name of the network interface
|
|
18
|
+
# * lanId<~Integer> -
|
|
19
|
+
# * internetAccess<~Boolean> -
|
|
20
|
+
# * serverId<~String> -
|
|
21
|
+
# * ips<~String> -
|
|
22
|
+
# * macAddress<~String> -
|
|
23
|
+
# * firewall<~Hash>:
|
|
24
|
+
# * ...
|
|
25
|
+
# * dhcpActive<~Boolean> -
|
|
26
|
+
# * gatewayIp<~String> -
|
|
27
|
+
# * provisioningState<~String> - INACTIVE, INPROCESS, AVAILABLE, DELETED, ERROR
|
|
28
|
+
#
|
|
29
|
+
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/GetAllNIC.html]
|
|
30
|
+
def get_all_nic
|
|
31
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
|
32
|
+
|xml| xml[:ws].getAllNic
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
request(
|
|
36
|
+
:expects => [200],
|
|
37
|
+
:method => 'POST',
|
|
38
|
+
:body => soap_envelope.to_xml,
|
|
39
|
+
:parser =>
|
|
40
|
+
Fog::Parsers::Compute::ProfitBricks::GetAllNic.new
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class Mock
|
|
46
|
+
def get_all_nic
|
|
47
|
+
response = Excon::Response.new
|
|
48
|
+
response.status = 200
|
|
49
|
+
response.body = { 'getAllNicResponse' => self.data[:interfaces] }
|
|
50
|
+
response
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class ProfitBricks
|
|
4
|
+
class Real
|
|
5
|
+
require "fog/profitbricks/parsers/compute/get_all_servers"
|
|
6
|
+
# Retrieve list of virtual servers
|
|
7
|
+
#
|
|
8
|
+
# ==== Parameters
|
|
9
|
+
# * N/A
|
|
10
|
+
#
|
|
11
|
+
# ==== Returns
|
|
12
|
+
# * response<~Excon::Response>:
|
|
13
|
+
# * body<~Hash>:
|
|
14
|
+
# * getServerResponse<~Array>:
|
|
15
|
+
# * <~Hash>:
|
|
16
|
+
# * dataCenterId<~String> - UUID of virtual data center
|
|
17
|
+
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
|
18
|
+
# * serverId<~String> - UUID of the new virtual server
|
|
19
|
+
# * serverName<~String> -
|
|
20
|
+
# * cores<~Integer> -
|
|
21
|
+
# * ram<~Integer> -
|
|
22
|
+
# * connectedStorages<~Array> -
|
|
23
|
+
# * nics<~Array> -
|
|
24
|
+
# * ips<~String> -
|
|
25
|
+
# * internetAccess<~Boolean> -
|
|
26
|
+
# * provisioningState<~String> -
|
|
27
|
+
# * virtualMachineState<~String> -
|
|
28
|
+
# * creationTime<~Time> -
|
|
29
|
+
# * lastModificationTime<~Time> -
|
|
30
|
+
# * osType<~String> - UNKNOWN, WINDOWS, LINUX, OTHER
|
|
31
|
+
# * availabilityZone<~String> - AUTO, ZONE_1, ZONE_2
|
|
32
|
+
#
|
|
33
|
+
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/GetAllServers.html]
|
|
34
|
+
def get_all_servers
|
|
35
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
|
36
|
+
|xml| xml[:ws].getAllServers
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
request(
|
|
40
|
+
:expects => [200],
|
|
41
|
+
:method => "POST",
|
|
42
|
+
:body => soap_envelope.to_xml,
|
|
43
|
+
:parser => Fog::Parsers::Compute::ProfitBricks::GetAllServers.new
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
class Mock
|
|
49
|
+
def get_all_servers
|
|
50
|
+
response = Excon::Response.new
|
|
51
|
+
response.status = 200
|
|
52
|
+
response.body = { "getAllServersResponse" => self.data[:servers] }
|
|
53
|
+
response
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class ProfitBricks
|
|
4
|
+
class Real
|
|
5
|
+
require 'fog/profitbricks/parsers/compute/get_all_storages'
|
|
6
|
+
|
|
7
|
+
# Returns all virtual storage information
|
|
8
|
+
#
|
|
9
|
+
# ==== Parameters
|
|
10
|
+
# * N/A
|
|
11
|
+
#
|
|
12
|
+
# ==== Returns
|
|
13
|
+
# * response<~Excon::Response>:
|
|
14
|
+
# * body<~Hash>:
|
|
15
|
+
# * getAllStorages<~Hash>:
|
|
16
|
+
# * dataCenterId<~String> - UUID of the virtual data center
|
|
17
|
+
# * dataCenterVersion<~Integer> - Version of the virtual data center
|
|
18
|
+
# * storageId<~String> - UUID of the virtual storage
|
|
19
|
+
# * size<~Integer> - Size of the virtual storage in GB
|
|
20
|
+
# * storageName<~String> - Name of the virtual storage
|
|
21
|
+
# * mountImage<~Hash>:
|
|
22
|
+
# * imageId<~String> -
|
|
23
|
+
# * imageName<~String> -
|
|
24
|
+
# * serverIds<~String> - List of servers connected to the virtual storage by UUID
|
|
25
|
+
# * provisioningState<~String> - Current provisioning state of virtual storage
|
|
26
|
+
# * creationTime<~Time> - Time when virtual storage was created
|
|
27
|
+
# * lastModificationTime<~Time> - Time when the virtual storage was last modified
|
|
28
|
+
#
|
|
29
|
+
# {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/GetAllStorages.html]
|
|
30
|
+
def get_all_storages
|
|
31
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
|
32
|
+
|xml| xml[:ws].getAllStorages
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
request(
|
|
36
|
+
:expects => [200],
|
|
37
|
+
:method => 'POST',
|
|
38
|
+
:body => soap_envelope.to_xml,
|
|
39
|
+
:parser =>
|
|
40
|
+
Fog::Parsers::Compute::ProfitBricks::GetAllStorages.new
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class Mock
|
|
46
|
+
def get_all_storages
|
|
47
|
+
data = self.data[:volumes]
|
|
48
|
+
response = Excon::Response.new
|
|
49
|
+
response.status = 200
|
|
50
|
+
response.body = {
|
|
51
|
+
'getAllStoragesResponse' => self.data[:volumes]
|
|
52
|
+
}
|
|
53
|
+
response
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class ProfitBricks
|
|
4
|
+
class Real
|
|
5
|
+
require "fog/profitbricks/parsers/compute/get_data_center"
|
|
6
|
+
|
|
7
|
+
def get_data_center(data_center_id)
|
|
8
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope do |xml|
|
|
9
|
+
xml[:ws].getDataCenter { xml.dataCenterId(data_center_id) }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
request(
|
|
13
|
+
:expects => [200],
|
|
14
|
+
:method => "POST",
|
|
15
|
+
:body => soap_envelope.to_xml,
|
|
16
|
+
:parser => Fog::Parsers::Compute::ProfitBricks::GetDataCenter.new
|
|
17
|
+
)
|
|
18
|
+
rescue Excon::Errors::InternalServerError => error
|
|
19
|
+
Fog::Errors::NotFound.new(error)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class Mock
|
|
24
|
+
def get_data_center(data_center_id)
|
|
25
|
+
if dc = self.data[:datacenters].find {
|
|
26
|
+
|attrib| attrib["dataCenterId"] == data_center_id
|
|
27
|
+
}
|
|
28
|
+
else
|
|
29
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
response = Excon::Response.new
|
|
33
|
+
response.status = 200
|
|
34
|
+
response.body = { "getDataCenterResponse" => dc }
|
|
35
|
+
response
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class ProfitBricks
|
|
4
|
+
class Real
|
|
5
|
+
require 'fog/profitbricks/parsers/compute/get_data_center_state'
|
|
6
|
+
def get_data_center_state(data_center_id)
|
|
7
|
+
soap_envelope = Fog::ProfitBricks.construct_envelope {
|
|
8
|
+
|xml| xml[:ws].getDataCenterState {
|
|
9
|
+
xml.dataCenterId(data_center_id)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
request(
|
|
14
|
+
:expects => [200],
|
|
15
|
+
:method => 'POST',
|
|
16
|
+
:body => soap_envelope.to_xml,
|
|
17
|
+
:parser =>
|
|
18
|
+
Fog::Parsers::Compute::ProfitBricks::GetDataCenterState.new
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class Mock
|
|
24
|
+
def get_data_center_state(data_center_id)
|
|
25
|
+
if data = self.data[:datacenters]
|
|
26
|
+
dc = self.data[:datacenters].find {
|
|
27
|
+
|attrib| attrib['dataCenterId'] == data_center_id
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
response = Excon::Response.new
|
|
31
|
+
response.status = 200
|
|
32
|
+
response.body = { 'getDataCenterStateResponse' =>
|
|
33
|
+
{ 'return' => dc['provisioningState'] }
|
|
34
|
+
}
|
|
35
|
+
response
|
|
36
|
+
else
|
|
37
|
+
raise Fog::Compute::NotFound
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|