fog-profitbricks 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.rubocop.yml +21 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +25 -0
  7. data/CONTRIBUTING.md +18 -0
  8. data/CONTRIBUTORS.md +2 -0
  9. data/Gemfile +4 -0
  10. data/LICENSE.md +20 -0
  11. data/README.md +29 -0
  12. data/Rakefile +21 -0
  13. data/examples/pb_demo.rb +53 -0
  14. data/fog-profitbricks.gemspec +31 -0
  15. data/gemfiles/Gemfile.1.8.7 +7 -0
  16. data/gemfiles/Gemfile.1.9.2+ +6 -0
  17. data/lib/fog/bin/profitbricks.rb +29 -0
  18. data/lib/fog/profitbricks.rb +13 -0
  19. data/lib/fog/profitbricks/compute.rb +215 -0
  20. data/lib/fog/profitbricks/core.rb +18 -0
  21. data/lib/fog/profitbricks/models/compute/datacenter.rb +59 -0
  22. data/lib/fog/profitbricks/models/compute/datacenters.rb +24 -0
  23. data/lib/fog/profitbricks/models/compute/flavor.rb +27 -0
  24. data/lib/fog/profitbricks/models/compute/flavors.rb +24 -0
  25. data/lib/fog/profitbricks/models/compute/image.rb +30 -0
  26. data/lib/fog/profitbricks/models/compute/images.rb +23 -0
  27. data/lib/fog/profitbricks/models/compute/interface.rb +64 -0
  28. data/lib/fog/profitbricks/models/compute/interfaces.rb +24 -0
  29. data/lib/fog/profitbricks/models/compute/region.rb +15 -0
  30. data/lib/fog/profitbricks/models/compute/regions.rb +24 -0
  31. data/lib/fog/profitbricks/models/compute/server.rb +107 -0
  32. data/lib/fog/profitbricks/models/compute/servers.rb +23 -0
  33. data/lib/fog/profitbricks/models/compute/volume.rb +74 -0
  34. data/lib/fog/profitbricks/models/compute/volumes.rb +24 -0
  35. data/lib/fog/profitbricks/parsers/base.rb +49 -0
  36. data/lib/fog/profitbricks/parsers/compute/clear_data_center.rb +22 -0
  37. data/lib/fog/profitbricks/parsers/compute/connect_storage_to_server.rb +22 -0
  38. data/lib/fog/profitbricks/parsers/compute/create_data_center.rb +22 -0
  39. data/lib/fog/profitbricks/parsers/compute/create_nic.rb +22 -0
  40. data/lib/fog/profitbricks/parsers/compute/create_server.rb +22 -0
  41. data/lib/fog/profitbricks/parsers/compute/create_storage.rb +22 -0
  42. data/lib/fog/profitbricks/parsers/compute/delete_data_center.rb +20 -0
  43. data/lib/fog/profitbricks/parsers/compute/delete_nic.rb +22 -0
  44. data/lib/fog/profitbricks/parsers/compute/delete_server.rb +22 -0
  45. data/lib/fog/profitbricks/parsers/compute/delete_storage.rb +22 -0
  46. data/lib/fog/profitbricks/parsers/compute/disconnect_storage_from_server.rb +22 -0
  47. data/lib/fog/profitbricks/parsers/compute/get_all_data_centers.rb +26 -0
  48. data/lib/fog/profitbricks/parsers/compute/get_all_images.rb +30 -0
  49. data/lib/fog/profitbricks/parsers/compute/get_all_nic.rb +30 -0
  50. data/lib/fog/profitbricks/parsers/compute/get_all_servers.rb +56 -0
  51. data/lib/fog/profitbricks/parsers/compute/get_all_storages.rb +33 -0
  52. data/lib/fog/profitbricks/parsers/compute/get_data_center.rb +23 -0
  53. data/lib/fog/profitbricks/parsers/compute/get_data_center_state.rb +20 -0
  54. data/lib/fog/profitbricks/parsers/compute/get_image.rb +26 -0
  55. data/lib/fog/profitbricks/parsers/compute/get_nic.rb +27 -0
  56. data/lib/fog/profitbricks/parsers/compute/get_server.rb +55 -0
  57. data/lib/fog/profitbricks/parsers/compute/get_storage.rb +30 -0
  58. data/lib/fog/profitbricks/parsers/compute/reset_server.rb +20 -0
  59. data/lib/fog/profitbricks/parsers/compute/set_internet_access.rb +22 -0
  60. data/lib/fog/profitbricks/parsers/compute/update_data_center.rb +22 -0
  61. data/lib/fog/profitbricks/parsers/compute/update_nic.rb +22 -0
  62. data/lib/fog/profitbricks/parsers/compute/update_server.rb +22 -0
  63. data/lib/fog/profitbricks/parsers/compute/update_storage.rb +22 -0
  64. data/lib/fog/profitbricks/requests/compute/clear_data_center.rb +53 -0
  65. data/lib/fog/profitbricks/requests/compute/connect_storage_to_server.rb +85 -0
  66. data/lib/fog/profitbricks/requests/compute/create_data_center.rb +64 -0
  67. data/lib/fog/profitbricks/requests/compute/create_flavor.rb +40 -0
  68. data/lib/fog/profitbricks/requests/compute/create_nic.rb +81 -0
  69. data/lib/fog/profitbricks/requests/compute/create_server.rb +107 -0
  70. data/lib/fog/profitbricks/requests/compute/create_storage.rb +98 -0
  71. data/lib/fog/profitbricks/requests/compute/delete_data_center.rb +62 -0
  72. data/lib/fog/profitbricks/requests/compute/delete_nic.rb +66 -0
  73. data/lib/fog/profitbricks/requests/compute/delete_server.rb +66 -0
  74. data/lib/fog/profitbricks/requests/compute/delete_storage.rb +66 -0
  75. data/lib/fog/profitbricks/requests/compute/disconnect_storage_from_server.rb +78 -0
  76. data/lib/fog/profitbricks/requests/compute/get_all_data_centers.rb +32 -0
  77. data/lib/fog/profitbricks/requests/compute/get_all_flavors.rb +77 -0
  78. data/lib/fog/profitbricks/requests/compute/get_all_images.rb +67 -0
  79. data/lib/fog/profitbricks/requests/compute/get_all_locations.rb +44 -0
  80. data/lib/fog/profitbricks/requests/compute/get_all_nic.rb +55 -0
  81. data/lib/fog/profitbricks/requests/compute/get_all_servers.rb +58 -0
  82. data/lib/fog/profitbricks/requests/compute/get_all_storages.rb +58 -0
  83. data/lib/fog/profitbricks/requests/compute/get_data_center.rb +40 -0
  84. data/lib/fog/profitbricks/requests/compute/get_data_center_state.rb +43 -0
  85. data/lib/fog/profitbricks/requests/compute/get_flavor.rb +82 -0
  86. data/lib/fog/profitbricks/requests/compute/get_image.rb +71 -0
  87. data/lib/fog/profitbricks/requests/compute/get_location.rb +48 -0
  88. data/lib/fog/profitbricks/requests/compute/get_nic.rb +65 -0
  89. data/lib/fog/profitbricks/requests/compute/get_server.rb +100 -0
  90. data/lib/fog/profitbricks/requests/compute/get_storage.rb +65 -0
  91. data/lib/fog/profitbricks/requests/compute/reset_server.rb +51 -0
  92. data/lib/fog/profitbricks/requests/compute/set_internet_access.rb +61 -0
  93. data/lib/fog/profitbricks/requests/compute/start_server.rb +59 -0
  94. data/lib/fog/profitbricks/requests/compute/stop_server.rb +59 -0
  95. data/lib/fog/profitbricks/requests/compute/update_data_center.rb +55 -0
  96. data/lib/fog/profitbricks/requests/compute/update_nic.rb +76 -0
  97. data/lib/fog/profitbricks/requests/compute/update_server.rb +81 -0
  98. data/lib/fog/profitbricks/requests/compute/update_storage.rb +75 -0
  99. data/lib/fog/profitbricks/version.rb +5 -0
  100. data/spec/minitest_helper.rb +33 -0
  101. data/tests/helper.rb +19 -0
  102. data/tests/helpers/formats_helper.rb +23 -0
  103. data/tests/helpers/mock_helper.rb +8 -0
  104. data/tests/profitbricks/requests/compute/flavor_tests.rb +43 -0
  105. data/tests/profitbricks/requests/compute/image_tests.rb +50 -0
  106. data/tests/profitbricks/requests/compute/interface_tests.rb +101 -0
  107. data/tests/profitbricks/requests/compute/location_tests.rb +33 -0
  108. data/tests/profitbricks/requests/compute/server_tests.rb +246 -0
  109. metadata +293 -0
@@ -0,0 +1,22 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module ProfitBricks
5
+ class UpdateStorage < Fog::Parsers::ProfitBricks::Base
6
+ def reset
7
+ @response = { 'updateStorageResponse' => {} }
8
+ end
9
+
10
+ def end_element(name)
11
+ case name
12
+ when 'requestId', 'dataCenterId'
13
+ @response['updateStorageResponse'][name] = value
14
+ when 'dataCenterVersion'
15
+ @response['updateStorageResponse'][name] = value.to_i
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,53 @@
1
+ module Fog
2
+ module Compute
3
+ class ProfitBricks
4
+ class Real
5
+ require "fog/profitbricks/parsers/compute/clear_data_center"
6
+
7
+ # Clear all objects within a virtual data center
8
+ #
9
+ # ==== Parameters
10
+ # * dataCenterId<~String> - Required, UUID of virtual data center
11
+ #
12
+ # ==== Returns
13
+ # * response<~Excon::Response>:
14
+ # * body<~Hash>:
15
+ # * clearDataCenterResponse<~Hash>:
16
+ # * requestId<~String> - ID of request
17
+ # * dataCenterId<~String> - UUID of virtual data center
18
+ # * dataCenterVersion<~Integer> - Version of the virtual data center
19
+ #
20
+ # {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/ClearDataCenter.html]
21
+ def clear_data_center(data_center_id)
22
+ soap_envelope = Fog::ProfitBricks.construct_envelope {
23
+ |xml| xml[:ws].clearDataCenter {
24
+ xml.dataCenterId(data_center_id)
25
+ }
26
+ }
27
+
28
+ request(
29
+ :expects => [200],
30
+ :method => "POST",
31
+ :body => soap_envelope.to_xml,
32
+ :parser => Fog::Parsers::Compute::ProfitBricks::ClearDataCenter.new
33
+ )
34
+ end
35
+ end
36
+
37
+ class Mock
38
+ def clear_data_center(data_center_id)
39
+ response = Excon::Response.new
40
+ response.status = 200
41
+ response.body = {
42
+ "clearDataCenterResponse" => {
43
+ "requestId" => Fog::Mock::random_numbers(7),
44
+ "dataCenterId" => Fog::UUID.uuid,
45
+ "dataCenterVersion" => 1,
46
+ }
47
+ }
48
+ response
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,85 @@
1
+ module Fog
2
+ module Compute
3
+ class ProfitBricks
4
+ class Real
5
+ require 'fog/profitbricks/parsers/compute/connect_storage_to_server'
6
+
7
+ # Connect virtual storage
8
+ #
9
+ # ==== Parameters
10
+ # * storageId<~String> - Required, UUID of virtual storage
11
+ # * serverId<~String> - Required,
12
+ # * options<~Hash>:
13
+ # * busType<~String> - Optional, VIRTIO, IDE
14
+ # * deviceNumber<~Integer> - Optional,
15
+ #
16
+ # ==== Returns
17
+ # * response<~Excon::Response>:
18
+ # * body<~Hash>:
19
+ # * connectStorageToServerResponse<~Hash>:
20
+ # * requestId<~String> - ID of request
21
+ # * dataCenterId<~String> - UUID of virtual data center
22
+ # * dataCenterVersion<~Integer> - Version of the virtual data center
23
+ #
24
+ # {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/ConnectStorage.html]
25
+ def connect_storage_to_server(storage_id, server_id, options={})
26
+ soap_envelope = Fog::ProfitBricks.construct_envelope {
27
+ |xml| xml[:ws].connectStorageToServer {
28
+ xml.request {
29
+ xml.storageId(storage_id)
30
+ xml.serverId(server_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::ConnectStorageToServer.new
42
+ )
43
+ rescue Excon::Errors::InternalServerError => error
44
+ Fog::Errors::NotFound.new(error)
45
+ end
46
+ end
47
+
48
+ class Mock
49
+ def connect_storage_to_server(storage_id, server_id, options={})
50
+
51
+ if storage = self.data[:volumes].find {
52
+ |attrib| attrib['storageId'] == storage_id
53
+ }
54
+ else
55
+ raise Fog::Errors::NotFound.new(
56
+ 'The requested volume could not be found'
57
+ )
58
+ end
59
+
60
+ if server = self.data[:servers].find {
61
+ |attrib| attrib['serverId'] == server_id
62
+ }
63
+ server['connectedStorages'] << storage
64
+ else
65
+ raise Fog::Errors::NotFound.new(
66
+ 'The requested server could not be found'
67
+ )
68
+ end
69
+
70
+ response = Excon::Response.new
71
+ response.status = 200
72
+ response.body =
73
+ { 'connectStorageToServerResponse' =>
74
+ {
75
+ 'requestId' => Fog::Mock::random_numbers(7),
76
+ 'dataCenterId' => Fog::UUID.uuid,
77
+ 'dataCenterVersion' => 1
78
+ }
79
+ }
80
+ response
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,64 @@
1
+ module Fog
2
+ module Compute
3
+ class ProfitBricks
4
+ class Real
5
+ require 'fog/profitbricks/parsers/compute/create_data_center'
6
+
7
+ # Create a new virtual data center
8
+ #
9
+ # ==== Parameters
10
+ # dataCenterName<~String> - Name of the new virtual data center
11
+ # location<~String> - Location to create the new data center ("de/fkb", "de/fra", or "us/las")
12
+ #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * createDataCenterResponse<~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
+ # * location<~String> - Location of virtual data center
21
+ #
22
+ # {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/CreateDataCenter.html]
23
+ def create_data_center(data_center_name='', location='')
24
+ soap_envelope = Fog::ProfitBricks.construct_envelope {
25
+ |xml| xml[:ws].createDataCenter {
26
+ xml.request {
27
+ xml.dataCenterName(data_center_name)
28
+ xml.location(location)
29
+ }
30
+ }
31
+ }
32
+
33
+ request(
34
+ :expects => [200],
35
+ :method => 'POST',
36
+ :body => soap_envelope.to_xml,
37
+ :parser =>
38
+ Fog::Parsers::Compute::ProfitBricks::CreateDataCenter.new
39
+ )
40
+ end
41
+ end
42
+
43
+ class Mock
44
+ def create_data_center(data_center_name='', location='')
45
+
46
+ data_center = {
47
+ 'requestId' => Fog::Mock::random_numbers(7),
48
+ 'dataCenterId' => Fog::UUID.uuid,
49
+ 'dataCenterName' => data_center_name || '',
50
+ 'location' => location || '',
51
+ 'dataCenterVersion' => 1,
52
+ 'provisioningState' => 'AVAILABLE'
53
+ }
54
+
55
+ self.data[:datacenters] << data_center
56
+ response = Excon::Response.new
57
+ response.status = 200
58
+ response.body = { 'createDataCenterResponse' => data_center }
59
+ response
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,40 @@
1
+ module Fog
2
+ module Compute
3
+ class ProfitBricks
4
+ class Real
5
+ # Not a real API method; will only return flavor object.
6
+ def create_flavor(flavor_name, cores, ram)
7
+ response = Excon::Response.new
8
+ response.status = 200
9
+ response.body = {
10
+ 'createFlavorResponse' => {
11
+ 'id' => Fog::UUID.uuid,
12
+ 'name' => flavor_name,
13
+ 'cores' => cores,
14
+ 'ram' => ram,
15
+ }
16
+ }
17
+ response
18
+ end
19
+ end
20
+
21
+ class Mock
22
+ def create_flavor(flavor_name, ram, cores)
23
+ response = Excon::Response.new
24
+ response.status = 200
25
+
26
+ flavor = {
27
+ 'id' => Fog::UUID.uuid,
28
+ 'name' => flavor_name,
29
+ 'ram' => ram,
30
+ 'cores' => cores
31
+ }
32
+
33
+ self.data[:flavors] << flavor
34
+ response.body = { 'createFlavorResponse' => flavor }
35
+ response
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,81 @@
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
@@ -0,0 +1,107 @@
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