fog-profitbricks 0.0.5 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +1465 -4
  4. data/Rakefile +3 -0
  5. data/examples/pb_demo.rb +83 -35
  6. data/fog-profitbricks.gemspec +10 -10
  7. data/gemfiles/Gemfile.1.8.7 +0 -1
  8. data/lib/fog/profitbricks.rb +4 -23
  9. data/lib/fog/profitbricks/compute.rb +1082 -1
  10. data/lib/fog/profitbricks/helpers/compute/data_helper.rb +12 -0
  11. data/lib/fog/profitbricks/models/base.rb +37 -0
  12. data/lib/fog/profitbricks/models/compute/datacenter.rb +64 -0
  13. data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/datacenters.rb +9 -4
  14. data/lib/fog/profitbricks/models/compute/firewall_rule.rb +101 -0
  15. data/lib/fog/profitbricks/models/compute/firewall_rules.rb +40 -0
  16. data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/flavor.rb +0 -0
  17. data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/flavors.rb +0 -0
  18. data/lib/fog/profitbricks/models/compute/image.rb +72 -0
  19. data/lib/fog/profitbricks/models/compute/images.rb +28 -0
  20. data/lib/fog/profitbricks/models/compute/ip_block.rb +58 -0
  21. data/lib/fog/profitbricks/models/compute/ip_blocks.rb +30 -0
  22. data/lib/fog/profitbricks/models/compute/lan.rb +89 -0
  23. data/lib/fog/profitbricks/models/compute/lans.rb +36 -0
  24. data/lib/fog/profitbricks/models/compute/load_balancer.rb +126 -0
  25. data/lib/fog/profitbricks/models/compute/load_balancers.rb +34 -0
  26. data/lib/fog/profitbricks/models/compute/location.rb +18 -0
  27. data/lib/fog/profitbricks/models/compute/locations.rb +28 -0
  28. data/lib/fog/profitbricks/models/compute/nic.rb +111 -0
  29. data/lib/fog/profitbricks/models/compute/nics.rb +38 -0
  30. data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/region.rb +0 -0
  31. data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/regions.rb +0 -0
  32. data/lib/fog/profitbricks/models/compute/request.rb +24 -0
  33. data/lib/fog/profitbricks/models/compute/requests.rb +37 -0
  34. data/lib/fog/profitbricks/models/compute/server.rb +263 -0
  35. data/lib/fog/profitbricks/models/compute/servers.rb +32 -0
  36. data/lib/fog/profitbricks/models/compute/snapshot.rb +81 -0
  37. data/lib/fog/profitbricks/models/compute/snapshots.rb +28 -0
  38. data/lib/fog/profitbricks/models/compute/volume.rb +123 -0
  39. data/lib/fog/profitbricks/models/compute/volumes.rb +33 -0
  40. data/lib/fog/profitbricks/requests/compute/associate_nic_to_load_balancer.rb +104 -0
  41. data/lib/fog/profitbricks/requests/compute/attach_cdrom.rb +88 -0
  42. data/lib/fog/profitbricks/requests/compute/attach_volume.rb +89 -0
  43. data/lib/fog/profitbricks/requests/compute/create_datacenter.rb +89 -0
  44. data/lib/fog/profitbricks/requests/compute/create_firewall_rule.rb +103 -0
  45. data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/create_flavor.rb +0 -0
  46. data/lib/fog/profitbricks/requests/compute/create_ip_block.rb +81 -0
  47. data/lib/fog/profitbricks/requests/compute/create_lan.rb +160 -0
  48. data/lib/fog/profitbricks/requests/compute/create_load_balancer.rb +87 -0
  49. data/lib/fog/profitbricks/requests/compute/create_nic.rb +124 -0
  50. data/lib/fog/profitbricks/requests/compute/create_server.rb +257 -0
  51. data/lib/fog/profitbricks/requests/compute/create_volume.rb +133 -0
  52. data/lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb +113 -0
  53. data/lib/fog/profitbricks/requests/compute/delete_datacenter.rb +43 -0
  54. data/lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb +47 -0
  55. data/lib/fog/profitbricks/requests/compute/delete_image.rb +43 -0
  56. data/lib/fog/profitbricks/requests/compute/delete_ip_block.rb +43 -0
  57. data/lib/fog/profitbricks/requests/compute/delete_lan.rb +44 -0
  58. data/lib/fog/profitbricks/requests/compute/delete_load_balancer.rb +44 -0
  59. data/lib/fog/profitbricks/requests/compute/delete_nic.rb +46 -0
  60. data/lib/fog/profitbricks/requests/compute/delete_server.rb +48 -0
  61. data/lib/fog/profitbricks/requests/compute/delete_snapshot.rb +43 -0
  62. data/lib/fog/profitbricks/requests/compute/delete_volume.rb +44 -0
  63. data/lib/fog/profitbricks/requests/compute/detach_cdrom.rb +52 -0
  64. data/lib/fog/profitbricks/requests/compute/detach_volume.rb +53 -0
  65. data/lib/fog/profitbricks/requests/compute/get_all_datacenters.rb +59 -0
  66. data/lib/fog/profitbricks/requests/compute/get_all_firewall_rules.rb +76 -0
  67. data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/get_all_flavors.rb +0 -0
  68. data/lib/fog/profitbricks/requests/compute/get_all_images.rb +66 -0
  69. data/lib/fog/profitbricks/requests/compute/get_all_ip_blocks.rb +56 -0
  70. data/lib/fog/profitbricks/requests/compute/get_all_lans.rb +120 -0
  71. data/lib/fog/profitbricks/requests/compute/get_all_load_balanced_nics.rb +100 -0
  72. data/lib/fog/profitbricks/requests/compute/get_all_load_balancers.rb +117 -0
  73. data/lib/fog/profitbricks/requests/compute/get_all_locations.rb +44 -0
  74. data/lib/fog/profitbricks/requests/compute/get_all_nic.rb +102 -0
  75. data/lib/fog/profitbricks/requests/compute/get_all_requests.rb +43 -0
  76. data/lib/fog/profitbricks/requests/compute/get_all_servers.rb +134 -0
  77. data/lib/fog/profitbricks/requests/compute/get_all_snapshots.rb +66 -0
  78. data/lib/fog/profitbricks/requests/compute/get_all_volumes.rb +78 -0
  79. data/lib/fog/profitbricks/requests/compute/get_attached_cdrom.rb +78 -0
  80. data/lib/fog/profitbricks/requests/compute/get_attached_volume.rb +79 -0
  81. data/lib/fog/profitbricks/requests/compute/get_datacenter.rb +65 -0
  82. data/lib/fog/profitbricks/requests/compute/get_firewall_rule.rb +71 -0
  83. data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/get_flavor.rb +0 -0
  84. data/lib/fog/profitbricks/requests/compute/get_image.rb +71 -0
  85. data/lib/fog/profitbricks/requests/compute/get_ip_block.rb +58 -0
  86. data/lib/fog/profitbricks/requests/compute/get_lan.rb +120 -0
  87. data/lib/fog/profitbricks/requests/compute/get_load_balanced_nic.rb +99 -0
  88. data/lib/fog/profitbricks/requests/compute/get_load_balancer.rb +116 -0
  89. data/lib/fog/profitbricks/requests/compute/get_location.rb +49 -0
  90. data/lib/fog/profitbricks/requests/compute/get_nic.rb +98 -0
  91. data/lib/fog/profitbricks/requests/compute/get_request.rb +61 -0
  92. data/lib/fog/profitbricks/requests/compute/get_request_status.rb +50 -0
  93. data/lib/fog/profitbricks/requests/compute/get_server.rb +133 -0
  94. data/lib/fog/profitbricks/requests/compute/get_snapshot.rb +70 -0
  95. data/lib/fog/profitbricks/requests/compute/get_volume.rb +73 -0
  96. data/lib/fog/profitbricks/requests/compute/list_attached_cdroms.rb +74 -0
  97. data/lib/fog/profitbricks/requests/compute/list_attached_volumes.rb +75 -0
  98. data/lib/fog/profitbricks/requests/compute/reboot_server.rb +47 -0
  99. data/lib/fog/profitbricks/requests/compute/remove_nic_association.rb +44 -0
  100. data/lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb +61 -0
  101. data/lib/fog/profitbricks/requests/compute/start_server.rb +49 -0
  102. data/lib/fog/profitbricks/requests/compute/stop_server.rb +50 -0
  103. data/lib/fog/profitbricks/requests/compute/update_datacenter.rb +73 -0
  104. data/lib/fog/profitbricks/requests/compute/update_firewall_rule.rb +87 -0
  105. data/lib/fog/profitbricks/requests/compute/update_image.rb +90 -0
  106. data/lib/fog/profitbricks/requests/compute/update_lan.rb +126 -0
  107. data/lib/fog/profitbricks/requests/compute/update_load_balancer.rb +70 -0
  108. data/lib/fog/profitbricks/requests/compute/update_nic.rb +107 -0
  109. data/lib/fog/profitbricks/requests/compute/update_server.rb +147 -0
  110. data/lib/fog/profitbricks/requests/compute/update_snapshot.rb +90 -0
  111. data/lib/fog/profitbricks/requests/compute/update_volume.rb +82 -0
  112. data/lib/fog/profitbricks/version.rb +1 -1
  113. data/tests/profitbricks/requests/compute/composite_create_tests.rb +241 -0
  114. data/tests/profitbricks/requests/compute/location_tests.rb +24 -12
  115. data/tests/profitbricks/requests/compute/nic_tests.rb +290 -0
  116. data/tests/profitbricks/requests/compute/request_tests.rb +52 -0
  117. data/tests/profitbricks/requests/compute/server_tests.rb +398 -175
  118. metadata +140 -133
  119. data/lib/fog/compute/profit_bricks.rb +0 -217
  120. data/lib/fog/compute/profit_bricks/models/datacenter.rb +0 -60
  121. data/lib/fog/compute/profit_bricks/models/image.rb +0 -27
  122. data/lib/fog/compute/profit_bricks/models/images.rb +0 -22
  123. data/lib/fog/compute/profit_bricks/models/interface.rb +0 -61
  124. data/lib/fog/compute/profit_bricks/models/interfaces.rb +0 -23
  125. data/lib/fog/compute/profit_bricks/models/server.rb +0 -104
  126. data/lib/fog/compute/profit_bricks/models/servers.rb +0 -22
  127. data/lib/fog/compute/profit_bricks/models/volume.rb +0 -71
  128. data/lib/fog/compute/profit_bricks/models/volumes.rb +0 -23
  129. data/lib/fog/compute/profit_bricks/requests/clear_data_center.rb +0 -51
  130. data/lib/fog/compute/profit_bricks/requests/connect_storage_to_server.rb +0 -83
  131. data/lib/fog/compute/profit_bricks/requests/create_data_center.rb +0 -62
  132. data/lib/fog/compute/profit_bricks/requests/create_nic.rb +0 -79
  133. data/lib/fog/compute/profit_bricks/requests/create_server.rb +0 -105
  134. data/lib/fog/compute/profit_bricks/requests/create_storage.rb +0 -96
  135. data/lib/fog/compute/profit_bricks/requests/delete_data_center.rb +0 -60
  136. data/lib/fog/compute/profit_bricks/requests/delete_nic.rb +0 -64
  137. data/lib/fog/compute/profit_bricks/requests/delete_server.rb +0 -64
  138. data/lib/fog/compute/profit_bricks/requests/delete_storage.rb +0 -64
  139. data/lib/fog/compute/profit_bricks/requests/disconnect_storage_from_server.rb +0 -76
  140. data/lib/fog/compute/profit_bricks/requests/get_all_data_centers.rb +0 -31
  141. data/lib/fog/compute/profit_bricks/requests/get_all_images.rb +0 -65
  142. data/lib/fog/compute/profit_bricks/requests/get_all_locations.rb +0 -44
  143. data/lib/fog/compute/profit_bricks/requests/get_all_nic.rb +0 -53
  144. data/lib/fog/compute/profit_bricks/requests/get_all_servers.rb +0 -57
  145. data/lib/fog/compute/profit_bricks/requests/get_all_storages.rb +0 -56
  146. data/lib/fog/compute/profit_bricks/requests/get_data_center.rb +0 -38
  147. data/lib/fog/compute/profit_bricks/requests/get_data_center_state.rb +0 -42
  148. data/lib/fog/compute/profit_bricks/requests/get_image.rb +0 -69
  149. data/lib/fog/compute/profit_bricks/requests/get_location.rb +0 -48
  150. data/lib/fog/compute/profit_bricks/requests/get_nic.rb +0 -63
  151. data/lib/fog/compute/profit_bricks/requests/get_server.rb +0 -98
  152. data/lib/fog/compute/profit_bricks/requests/get_storage.rb +0 -63
  153. data/lib/fog/compute/profit_bricks/requests/reset_server.rb +0 -49
  154. data/lib/fog/compute/profit_bricks/requests/set_internet_access.rb +0 -59
  155. data/lib/fog/compute/profit_bricks/requests/start_server.rb +0 -58
  156. data/lib/fog/compute/profit_bricks/requests/stop_server.rb +0 -58
  157. data/lib/fog/compute/profit_bricks/requests/update_data_center.rb +0 -54
  158. data/lib/fog/compute/profit_bricks/requests/update_nic.rb +0 -74
  159. data/lib/fog/compute/profit_bricks/requests/update_server.rb +0 -79
  160. data/lib/fog/compute/profit_bricks/requests/update_storage.rb +0 -73
  161. data/lib/fog/models/profit_bricks/base.rb +0 -11
  162. data/lib/fog/parsers/compute.rb +0 -37
  163. data/lib/fog/parsers/compute/profit_bricks/base.rb +0 -51
  164. data/lib/fog/parsers/compute/profit_bricks/clear_data_center.rb +0 -22
  165. data/lib/fog/parsers/compute/profit_bricks/connect_storage_to_server.rb +0 -22
  166. data/lib/fog/parsers/compute/profit_bricks/create_data_center.rb +0 -22
  167. data/lib/fog/parsers/compute/profit_bricks/create_nic.rb +0 -22
  168. data/lib/fog/parsers/compute/profit_bricks/create_server.rb +0 -22
  169. data/lib/fog/parsers/compute/profit_bricks/create_storage.rb +0 -22
  170. data/lib/fog/parsers/compute/profit_bricks/delete_data_center.rb +0 -20
  171. data/lib/fog/parsers/compute/profit_bricks/delete_nic.rb +0 -22
  172. data/lib/fog/parsers/compute/profit_bricks/delete_server.rb +0 -22
  173. data/lib/fog/parsers/compute/profit_bricks/delete_storage.rb +0 -22
  174. data/lib/fog/parsers/compute/profit_bricks/disconnect_storage_from_server.rb +0 -22
  175. data/lib/fog/parsers/compute/profit_bricks/get_all_data_centers.rb +0 -26
  176. data/lib/fog/parsers/compute/profit_bricks/get_all_images.rb +0 -30
  177. data/lib/fog/parsers/compute/profit_bricks/get_all_nic.rb +0 -30
  178. data/lib/fog/parsers/compute/profit_bricks/get_all_servers.rb +0 -57
  179. data/lib/fog/parsers/compute/profit_bricks/get_all_storages.rb +0 -33
  180. data/lib/fog/parsers/compute/profit_bricks/get_data_center.rb +0 -23
  181. data/lib/fog/parsers/compute/profit_bricks/get_data_center_state.rb +0 -20
  182. data/lib/fog/parsers/compute/profit_bricks/get_image.rb +0 -26
  183. data/lib/fog/parsers/compute/profit_bricks/get_nic.rb +0 -27
  184. data/lib/fog/parsers/compute/profit_bricks/get_server.rb +0 -57
  185. data/lib/fog/parsers/compute/profit_bricks/get_storage.rb +0 -30
  186. data/lib/fog/parsers/compute/profit_bricks/reset_server.rb +0 -20
  187. data/lib/fog/parsers/compute/profit_bricks/set_internet_access.rb +0 -22
  188. data/lib/fog/parsers/compute/profit_bricks/update_data_center.rb +0 -22
  189. data/lib/fog/parsers/compute/profit_bricks/update_nic.rb +0 -22
  190. data/lib/fog/parsers/compute/profit_bricks/update_server.rb +0 -22
  191. data/lib/fog/parsers/compute/profit_bricks/update_storage.rb +0 -22
  192. data/lib/fog/profitbricks/storage.rb +0 -1
  193. data/tests/profitbricks/requests/compute/image_tests.rb +0 -50
  194. data/tests/profitbricks/requests/compute/interface_tests.rb +0 -101
@@ -1,57 +0,0 @@
1
- module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- # Retrieve list of virtual servers
6
- #
7
- # ==== Parameters
8
- # * N/A
9
- #
10
- # ==== Returns
11
- # * response<~Excon::Response>:
12
- # * body<~Hash>:
13
- # * getServerResponse<~Array>:
14
- # * <~Hash>:
15
- # * dataCenterId<~String> - UUID of virtual data center
16
- # * dataCenterVersion<~Integer> - Version of the virtual data center
17
- # * serverId<~String> - UUID of the new virtual server
18
- # * serverName<~String> -
19
- # * cores<~Integer> -
20
- # * ram<~Integer> -
21
- # * connectedStorages<~Array> -
22
- # * nics<~Array> -
23
- # * ips<~String> -
24
- # * internetAccess<~Boolean> -
25
- # * provisioningState<~String> -
26
- # * virtualMachineState<~String> -
27
- # * creationTime<~Time> -
28
- # * lastModificationTime<~Time> -
29
- # * osType<~String> - UNKNOWN, WINDOWS, LINUX, OTHER
30
- # * availabilityZone<~String> - AUTO, ZONE_1, ZONE_2
31
- #
32
- # {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/GetAllServers.html]
33
- def get_all_servers
34
- soap_envelope = Fog::ProfitBricks.construct_envelope {
35
- |xml| xml[:ws].getAllServers
36
- }
37
-
38
- request(
39
- :expects => [200],
40
- :method => "POST",
41
- :body => soap_envelope.to_xml,
42
- :parser => Fog::Parsers::Compute::ProfitBricks::GetAllServers.new
43
- )
44
- end
45
- end
46
-
47
- class Mock
48
- def get_all_servers
49
- response = Excon::Response.new
50
- response.status = 200
51
- response.body = { "getAllServersResponse" => self.data[:servers] }
52
- response
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,56 +0,0 @@
1
- module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- # Returns all virtual storage information
6
- #
7
- # ==== Parameters
8
- # * N/A
9
- #
10
- # ==== Returns
11
- # * response<~Excon::Response>:
12
- # * body<~Hash>:
13
- # * getAllStorages<~Hash>:
14
- # * dataCenterId<~String> - UUID of the virtual data center
15
- # * dataCenterVersion<~Integer> - Version of the virtual data center
16
- # * storageId<~String> - UUID of the virtual storage
17
- # * size<~Integer> - Size of the virtual storage in GB
18
- # * storageName<~String> - Name of the virtual storage
19
- # * mountImage<~Hash>:
20
- # * imageId<~String> -
21
- # * imageName<~String> -
22
- # * serverIds<~String> - List of servers connected to the virtual storage by UUID
23
- # * provisioningState<~String> - Current provisioning state of virtual storage
24
- # * creationTime<~Time> - Time when virtual storage was created
25
- # * lastModificationTime<~Time> - Time when the virtual storage was last modified
26
- #
27
- # {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/GetAllStorages.html]
28
- def get_all_storages
29
- soap_envelope = Fog::ProfitBricks.construct_envelope {
30
- |xml| xml[:ws].getAllStorages
31
- }
32
-
33
- request(
34
- :expects => [200],
35
- :method => 'POST',
36
- :body => soap_envelope.to_xml,
37
- :parser =>
38
- Fog::Parsers::Compute::ProfitBricks::GetAllStorages.new
39
- )
40
- end
41
- end
42
-
43
- class Mock
44
- def get_all_storages
45
- data = self.data[:volumes]
46
- response = Excon::Response.new
47
- response.status = 200
48
- response.body = {
49
- 'getAllStoragesResponse' => self.data[:volumes]
50
- }
51
- response
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,38 +0,0 @@
1
- module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- def get_data_center(data_center_id)
6
- soap_envelope = Fog::ProfitBricks.construct_envelope do |xml|
7
- xml[:ws].getDataCenter { xml.dataCenterId(data_center_id) }
8
- end
9
-
10
- request(
11
- :expects => [200],
12
- :method => "POST",
13
- :body => soap_envelope.to_xml,
14
- :parser => Fog::Parsers::Compute::ProfitBricks::GetDataCenter.new
15
- )
16
- rescue Excon::Errors::InternalServerError => error
17
- Fog::Errors::NotFound.new(error)
18
- end
19
- end
20
-
21
- class Mock
22
- def get_data_center(data_center_id)
23
- if dc = self.data[:datacenters].find {
24
- |attrib| attrib["dataCenterId"] == data_center_id
25
- }
26
- else
27
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
28
- end
29
-
30
- response = Excon::Response.new
31
- response.status = 200
32
- response.body = { "getDataCenterResponse" => dc }
33
- response
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,42 +0,0 @@
1
- module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- def get_data_center_state(data_center_id)
6
- soap_envelope = Fog::ProfitBricks.construct_envelope {
7
- |xml| xml[:ws].getDataCenterState {
8
- xml.dataCenterId(data_center_id)
9
- }
10
- }
11
-
12
- request(
13
- :expects => [200],
14
- :method => 'POST',
15
- :body => soap_envelope.to_xml,
16
- :parser =>
17
- Fog::Parsers::Compute::ProfitBricks::GetDataCenterState.new
18
- )
19
- end
20
- end
21
-
22
- class Mock
23
- def get_data_center_state(data_center_id)
24
- if data = self.data[:datacenters]
25
- dc = self.data[:datacenters].find {
26
- |attrib| attrib['dataCenterId'] == data_center_id
27
- }
28
-
29
- response = Excon::Response.new
30
- response.status = 200
31
- response.body = { 'getDataCenterStateResponse' =>
32
- { 'return' => dc['provisioningState'] }
33
- }
34
- response
35
- else
36
- raise Fog::Compute::NotFound
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,69 +0,0 @@
1
- module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- # Displays a list of all available images.
6
- #
7
- # ==== Parameters
8
- # * imageId<~String> - Name of the new virtual data center
9
- #
10
- # ==== Returns
11
- # * response<~Excon::Response>:
12
- # * body<~Hash>:
13
- # * getAllImagesResponse<~Hash>:
14
- # * imageId<~String> - Identifer of the image
15
- # * imageName<~String> - Name of the image
16
- # * imageSize<~Integer> - Size of the image (in MB?)
17
- # * imageType<~String> - Image type HDD or CD-ROM/DVD (ISO) image
18
- # * writeable<~String> - Image is writable (TRUE/FALSE)
19
- # * bootable<~String> - Image is bootable
20
- # * cpuHotplug<~String> -Image supports CPU Hot-Plugging
21
- # * cpuHotUnplug<~String> -
22
- # * ramHotPlug<~String> - Image supports memory Hot-Plugging
23
- # * ramHotUnPlug<~String> -
24
- # * discVirtioHotPlug<~String> -
25
- # * discVirtioHotUnplug<~String> -
26
- # * nicHotPlug<~String> -
27
- # * nicHotUnplug<~String> -
28
- # * serverIds<~String> - List all servers by ID on which the image is used
29
- # * location<~String> - Location where the image has been uploaded
30
- # * osType<~String> - OS type of an image (WINDOWS, LINUX, OTHER, UNKNOWN)
31
- # * public<~String> - Shows if image is publicly available or private
32
- #
33
- # {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/APIDocumentation.html?GetImages.html]
34
- def get_image(image_id)
35
- soap_envelope = Fog::ProfitBricks.construct_envelope do |xml|
36
- xml[:ws].getImage {
37
- xml.imageId(image_id)
38
- }
39
- end
40
-
41
- request(
42
- :expects => [200],
43
- :method => "POST",
44
- :body => soap_envelope.to_xml,
45
- :parser => Fog::Parsers::Compute::ProfitBricks::GetImage.new
46
- )
47
- rescue Excon::Errors::InternalServerError => error
48
- Fog::Errors::NotFound.new(error)
49
- end
50
- end
51
-
52
- class Mock
53
- def get_image(image_id)
54
- if data_center = self.data[:images].find {
55
- |attrib| attrib["imageId"] == image_id
56
- }
57
- else
58
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
59
- end
60
-
61
- response = Excon::Response.new
62
- response.status = 200
63
- response.body = { "getImageResponse" => data_center }
64
- response
65
- end
66
- end
67
- end
68
- end
69
- end
@@ -1,48 +0,0 @@
1
- module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- def get_location(location_id)
6
- response = Excon::Response.new
7
- response.status = 200
8
- response.body = {
9
- "getLocationResponse" => [
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
- ].find { |location| location["locationId"] == location_id } || raise(Fog::Errors::NotFound)
26
- }
27
- response
28
- end
29
- end
30
-
31
- class Mock
32
- def get_location(location_id)
33
- if location = self.data[:regions].find {
34
- |attrib| attrib["locationId"] == location_id
35
- }
36
- else
37
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
38
- end
39
-
40
- response = Excon::Response.new
41
- response.status = 200
42
- response.body = { "getLocationResponse" => location }
43
- response
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,63 +0,0 @@
1
- module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- # Return virtual NIC information
6
- #
7
- # ==== Parameters
8
- # * N/A
9
- #
10
- # ==== Returns
11
- # * response<~Excon::Response>:
12
- # * body<~Hash>:
13
- # * getNicResponse<~Hash>:
14
- # * nicId<~String> - UUID of the network interface
15
- # * nicName<~String> - Name of the network interface
16
- # * lanId<~Integer> -
17
- # * internetAccess<~Boolean> -
18
- # * serverId<~String> -
19
- # * ips<~String> -
20
- # * macAddress<~String> -
21
- # * firewall<~Hash>:
22
- # * ...
23
- # * dhcpActive<~Boolean> -
24
- # * gatewayIp<~String> -
25
- # * provisioningState<~String> - INACTIVE, INPROCESS, AVAILABLE, DELETED, ERROR
26
- #
27
- # {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/GetNIC.html]
28
- def get_nic(nic_id)
29
- soap_envelope = Fog::ProfitBricks.construct_envelope do |xml|
30
- xml[:ws].getNic {
31
- xml.nicId(nic_id)
32
- }
33
- end
34
-
35
- request(
36
- :expects => [200],
37
- :method => "POST",
38
- :body => soap_envelope.to_xml,
39
- :parser => Fog::Parsers::Compute::ProfitBricks::GetNic.new
40
- )
41
- rescue Excon::Errors::InternalServerError => error
42
- Fog::Errors::NotFound.new(error)
43
- end
44
- end
45
-
46
- class Mock
47
- def get_nic(nic_id)
48
- if nic = self.data[:interfaces].find {
49
- |attrib| attrib["nicId"] == nic_id
50
- }
51
- else
52
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
53
- end
54
-
55
- response = Excon::Response.new
56
- response.status = 200
57
- response.body = { "getNicResponse" => nic }
58
- response
59
- end
60
- end
61
- end
62
- end
63
- end
@@ -1,98 +0,0 @@
1
- module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- # Create new virtual server
6
- #
7
- # ==== Parameters
8
- # * serverId<~String> - UUID of a virtual server
9
- #
10
- # ==== Returns
11
- # * response<~Excon::Response>:
12
- # * body<~Hash>:
13
- # * getServerResponse<~Hash>:
14
- # * requestId<~String> - ID of request
15
- # * dataCenterId<~String> - UUID of virtual data center
16
- # * dataCenterVersion<~Integer> - Version of the virtual data center
17
- # * serverId<~String> - UUID of the new virtual server
18
- # * serverName<~String> -
19
- # * cores<~Integer> -
20
- # * ram<~Integer> -
21
- # * internetAccess<~String> -
22
- # * ips<~String> -
23
- # * connectedStorages<~Array>:
24
- # * bootDevice<~Integer> -
25
- # * busType<~String> - VIRTIO|IDE
26
- # * deviceNumber<~Integer> -
27
- # * size<~Integer> -
28
- # * storageId<~String> -
29
- # * storageName<~String> -
30
- # * nics<~Array>:
31
- # * dataCenterId<~String> -
32
- # * dataCenterVersion<~Integer> -
33
- # * nicId<~String> -
34
- # * lanId<~Integer> -
35
- # * internetAccess<~String> -
36
- # * serverId<~String> -
37
- # * ips<~String> -
38
- # * macAddress<~String> -
39
- # * firewall<~Hash>:
40
- # * active<~String> -
41
- # * firewallId<~String> -
42
- # * nicId<~String> -
43
- # * provisioningState<~String> -
44
- # * dhcpActive<~String> -
45
- # * provisioningState<~String> -
46
- # * provisioningState<~String> -
47
- # * virtualMachineState<~String> -
48
- # * creationTime<~Time> -
49
- # * lastModificationTime<~Time> -
50
- # * osType<~String> -
51
- # * availabilityZone<~String> -
52
- # * cpuHotPlug<~String> -
53
- # * ramHotPlug<~String> -
54
- # * nicHotPlug<~String> -
55
- # * nicHotUnPlug<~String> -
56
- # * discVirtioHotPlug<~String> -
57
- # * discVirtioHotUnPlug<~String> -
58
- #
59
- # {ProfitBricks API Documentation}[http://www.profitbricks.com/apidoc/APIDocumentation.html?getServer.html]
60
- def get_server(server_id)
61
- soap_envelope = Fog::ProfitBricks.construct_envelope do |xml|
62
- xml[:ws].getServer {
63
- xml.serverId(server_id)
64
- }
65
- end
66
-
67
- request(
68
- :expects => [200],
69
- :method => "POST",
70
- :body => soap_envelope.to_xml,
71
- :parser => Fog::Parsers::Compute::ProfitBricks::GetServer.new
72
- )
73
- rescue Excon::Errors::InternalServerError => error
74
- Fog::Errors::NotFound.new(error)
75
- end
76
- end
77
-
78
- class Mock
79
- def get_server(server_id)
80
-
81
- if server = self.data[:servers].find {
82
- |attrib| attrib["serverId"] == server_id
83
- }
84
- else
85
- raise Fog::Errors::NotFound.new("The server resource could not be found")
86
- end
87
-
88
- server["requestId"] = Fog::Mock::random_numbers(7)
89
-
90
- response = Excon::Response.new
91
- response.status = 200
92
- response.body = { "getServerResponse" => server }
93
- response
94
- end
95
- end
96
- end
97
- end
98
- end