fog-packet 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +51 -0
  3. data/.rubocop.yml +38 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +21 -0
  6. data/README.md +1176 -0
  7. data/Rakefile +24 -0
  8. data/fog-packet.gemspec +24 -0
  9. data/lib/fog-packet.rb +26 -0
  10. data/lib/fog/compute/packet/compute.rb +313 -0
  11. data/lib/fog/compute/packet/models/bandwidth.rb +14 -0
  12. data/lib/fog/compute/packet/models/batch.rb +18 -0
  13. data/lib/fog/compute/packet/models/batches.rb +27 -0
  14. data/lib/fog/compute/packet/models/bgp_session.rb +35 -0
  15. data/lib/fog/compute/packet/models/bgp_sessions.rb +22 -0
  16. data/lib/fog/compute/packet/models/capacities.rb +27 -0
  17. data/lib/fog/compute/packet/models/capacity.rb +29 -0
  18. data/lib/fog/compute/packet/models/device.rb +136 -0
  19. data/lib/fog/compute/packet/models/devices.rb +22 -0
  20. data/lib/fog/compute/packet/models/email.rb +50 -0
  21. data/lib/fog/compute/packet/models/email_verification.rb +18 -0
  22. data/lib/fog/compute/packet/models/emails.rb +17 -0
  23. data/lib/fog/compute/packet/models/event.rb +23 -0
  24. data/lib/fog/compute/packet/models/events.rb +17 -0
  25. data/lib/fog/compute/packet/models/facilities.rb +17 -0
  26. data/lib/fog/compute/packet/models/facility.rb +22 -0
  27. data/lib/fog/compute/packet/models/hardware_reservation.rb +66 -0
  28. data/lib/fog/compute/packet/models/hardware_reservations.rb +22 -0
  29. data/lib/fog/compute/packet/models/invitation.rb +36 -0
  30. data/lib/fog/compute/packet/models/invitations.rb +22 -0
  31. data/lib/fog/compute/packet/models/ip.rb +60 -0
  32. data/lib/fog/compute/packet/models/ips.rb +22 -0
  33. data/lib/fog/compute/packet/models/license.rb +55 -0
  34. data/lib/fog/compute/packet/models/licenses.rb +22 -0
  35. data/lib/fog/compute/packet/models/membership.rb +38 -0
  36. data/lib/fog/compute/packet/models/memberships.rb +22 -0
  37. data/lib/fog/compute/packet/models/notification.rb +31 -0
  38. data/lib/fog/compute/packet/models/notifications.rb +22 -0
  39. data/lib/fog/compute/packet/models/operating_system.rb +23 -0
  40. data/lib/fog/compute/packet/models/operating_systems.rb +17 -0
  41. data/lib/fog/compute/packet/models/organization.rb +71 -0
  42. data/lib/fog/compute/packet/models/organizations.rb +22 -0
  43. data/lib/fog/compute/packet/models/payment_method.rb +63 -0
  44. data/lib/fog/compute/packet/models/payment_methods.rb +22 -0
  45. data/lib/fog/compute/packet/models/plan.rb +23 -0
  46. data/lib/fog/compute/packet/models/plans.rb +17 -0
  47. data/lib/fog/compute/packet/models/project.rb +47 -0
  48. data/lib/fog/compute/packet/models/projects.rb +22 -0
  49. data/lib/fog/compute/packet/models/session.rb +22 -0
  50. data/lib/fog/compute/packet/models/sessions.rb +26 -0
  51. data/lib/fog/compute/packet/models/snapshot.rb +33 -0
  52. data/lib/fog/compute/packet/models/snapshots.rb +22 -0
  53. data/lib/fog/compute/packet/models/spot_market_price.rb +15 -0
  54. data/lib/fog/compute/packet/models/spot_market_prices.rb +22 -0
  55. data/lib/fog/compute/packet/models/ssh_key.rb +51 -0
  56. data/lib/fog/compute/packet/models/ssh_keys.rb +22 -0
  57. data/lib/fog/compute/packet/models/transfer_request.rb +34 -0
  58. data/lib/fog/compute/packet/models/transfer_requests.rb +27 -0
  59. data/lib/fog/compute/packet/models/two_factor_auth.rb +18 -0
  60. data/lib/fog/compute/packet/models/user.rb +56 -0
  61. data/lib/fog/compute/packet/models/users.rb +22 -0
  62. data/lib/fog/compute/packet/models/virtual_network.rb +76 -0
  63. data/lib/fog/compute/packet/models/virtual_networks.rb +17 -0
  64. data/lib/fog/compute/packet/models/volume.rb +96 -0
  65. data/lib/fog/compute/packet/models/volumes.rb +23 -0
  66. data/lib/fog/compute/packet/models/vpn.rb +16 -0
  67. data/lib/fog/compute/packet/models/vpns.rb +27 -0
  68. data/lib/fog/compute/packet/requests/accept_invitation.rb +43 -0
  69. data/lib/fog/compute/packet/requests/accept_transfer_request.rb +26 -0
  70. data/lib/fog/compute/packet/requests/assign_ip.rb +32 -0
  71. data/lib/fog/compute/packet/requests/assign_port.rb +25 -0
  72. data/lib/fog/compute/packet/requests/attach_volume.rb +41 -0
  73. data/lib/fog/compute/packet/requests/bond_ports.rb +25 -0
  74. data/lib/fog/compute/packet/requests/create_batch.rb +43 -0
  75. data/lib/fog/compute/packet/requests/create_bgp_session.rb +37 -0
  76. data/lib/fog/compute/packet/requests/create_device.rb +212 -0
  77. data/lib/fog/compute/packet/requests/create_email.rb +38 -0
  78. data/lib/fog/compute/packet/requests/create_license.rb +46 -0
  79. data/lib/fog/compute/packet/requests/create_organization.rb +87 -0
  80. data/lib/fog/compute/packet/requests/create_payment_method.rb +63 -0
  81. data/lib/fog/compute/packet/requests/create_project.rb +72 -0
  82. data/lib/fog/compute/packet/requests/create_snapshot.rb +25 -0
  83. data/lib/fog/compute/packet/requests/create_ssh_key.rb +44 -0
  84. data/lib/fog/compute/packet/requests/create_virtual_network.rb +49 -0
  85. data/lib/fog/compute/packet/requests/create_volume.rb +70 -0
  86. data/lib/fog/compute/packet/requests/decline_invitation.rb +43 -0
  87. data/lib/fog/compute/packet/requests/decline_transfer_request.rb +26 -0
  88. data/lib/fog/compute/packet/requests/delete_bgp_session.rb +25 -0
  89. data/lib/fog/compute/packet/requests/delete_device.rb +25 -0
  90. data/lib/fog/compute/packet/requests/delete_email.rb +25 -0
  91. data/lib/fog/compute/packet/requests/delete_license.rb +25 -0
  92. data/lib/fog/compute/packet/requests/delete_membership.rb +25 -0
  93. data/lib/fog/compute/packet/requests/delete_organization.rb +25 -0
  94. data/lib/fog/compute/packet/requests/delete_payment_method.rb +25 -0
  95. data/lib/fog/compute/packet/requests/delete_project.rb +25 -0
  96. data/lib/fog/compute/packet/requests/delete_session.rb +27 -0
  97. data/lib/fog/compute/packet/requests/delete_snapshot.rb +25 -0
  98. data/lib/fog/compute/packet/requests/delete_ssh_key.rb +25 -0
  99. data/lib/fog/compute/packet/requests/delete_virtual_network.rb +25 -0
  100. data/lib/fog/compute/packet/requests/delete_volume.rb +25 -0
  101. data/lib/fog/compute/packet/requests/detach_volume.rb +36 -0
  102. data/lib/fog/compute/packet/requests/disable_two_factor_auth.rb +27 -0
  103. data/lib/fog/compute/packet/requests/disable_vpn.rb +25 -0
  104. data/lib/fog/compute/packet/requests/disbond_ports.rb +25 -0
  105. data/lib/fog/compute/packet/requests/enable_two_factor_auth.rb +26 -0
  106. data/lib/fog/compute/packet/requests/enable_vpn.rb +25 -0
  107. data/lib/fog/compute/packet/requests/get_bandwidth.rb +31 -0
  108. data/lib/fog/compute/packet/requests/get_batch.rb +38 -0
  109. data/lib/fog/compute/packet/requests/get_bgp_session.rb +37 -0
  110. data/lib/fog/compute/packet/requests/get_capacity.rb +165 -0
  111. data/lib/fog/compute/packet/requests/get_device.rb +189 -0
  112. data/lib/fog/compute/packet/requests/get_email.rb +32 -0
  113. data/lib/fog/compute/packet/requests/get_hardware_reservation.rb +193 -0
  114. data/lib/fog/compute/packet/requests/get_invitation.rb +43 -0
  115. data/lib/fog/compute/packet/requests/get_ip.rb +60 -0
  116. data/lib/fog/compute/packet/requests/get_license.rb +37 -0
  117. data/lib/fog/compute/packet/requests/get_membership.rb +40 -0
  118. data/lib/fog/compute/packet/requests/get_notification.rb +40 -0
  119. data/lib/fog/compute/packet/requests/get_organization.rb +61 -0
  120. data/lib/fog/compute/packet/requests/get_payment_method.rb +56 -0
  121. data/lib/fog/compute/packet/requests/get_project.rb +67 -0
  122. data/lib/fog/compute/packet/requests/get_ssh_key.rb +38 -0
  123. data/lib/fog/compute/packet/requests/get_transfer_request.rb +38 -0
  124. data/lib/fog/compute/packet/requests/get_user.rb +56 -0
  125. data/lib/fog/compute/packet/requests/get_volume.rb +60 -0
  126. data/lib/fog/compute/packet/requests/get_vpn.rb +29 -0
  127. data/lib/fog/compute/packet/requests/list_batches.rb +33 -0
  128. data/lib/fog/compute/packet/requests/list_bgp_sessions.rb +32 -0
  129. data/lib/fog/compute/packet/requests/list_devices.rb +33 -0
  130. data/lib/fog/compute/packet/requests/list_events.rb +33 -0
  131. data/lib/fog/compute/packet/requests/list_facilities.rb +57 -0
  132. data/lib/fog/compute/packet/requests/list_hardware_reservations.rb +216 -0
  133. data/lib/fog/compute/packet/requests/list_invitations.rb +48 -0
  134. data/lib/fog/compute/packet/requests/list_ips.rb +65 -0
  135. data/lib/fog/compute/packet/requests/list_licenses.rb +42 -0
  136. data/lib/fog/compute/packet/requests/list_memberships.rb +45 -0
  137. data/lib/fog/compute/packet/requests/list_notifications.rb +45 -0
  138. data/lib/fog/compute/packet/requests/list_operating_systems.rb +66 -0
  139. data/lib/fog/compute/packet/requests/list_organizations.rb +81 -0
  140. data/lib/fog/compute/packet/requests/list_payment_methods.rb +76 -0
  141. data/lib/fog/compute/packet/requests/list_plans.rb +92 -0
  142. data/lib/fog/compute/packet/requests/list_projects.rb +87 -0
  143. data/lib/fog/compute/packet/requests/list_sessions.rb +40 -0
  144. data/lib/fog/compute/packet/requests/list_snapshots.rb +40 -0
  145. data/lib/fog/compute/packet/requests/list_spotmarketprices.rb +173 -0
  146. data/lib/fog/compute/packet/requests/list_spotmarketprices_history.rb +42 -0
  147. data/lib/fog/compute/packet/requests/list_ssh_keys.rb +50 -0
  148. data/lib/fog/compute/packet/requests/list_transfer_requests.rb +43 -0
  149. data/lib/fog/compute/packet/requests/list_users.rb +61 -0
  150. data/lib/fog/compute/packet/requests/list_virtual_networks.rb +62 -0
  151. data/lib/fog/compute/packet/requests/list_volumes.rb +65 -0
  152. data/lib/fog/compute/packet/requests/move_hardware_reservation.rb +43 -0
  153. data/lib/fog/compute/packet/requests/poweroff_device.rb +194 -0
  154. data/lib/fog/compute/packet/requests/poweron_device.rb +194 -0
  155. data/lib/fog/compute/packet/requests/reboot_device.rb +194 -0
  156. data/lib/fog/compute/packet/requests/request_email_verification.rb +25 -0
  157. data/lib/fog/compute/packet/requests/reserve_ip.rb +37 -0
  158. data/lib/fog/compute/packet/requests/session_login.rb +25 -0
  159. data/lib/fog/compute/packet/requests/transfer_project.rb +43 -0
  160. data/lib/fog/compute/packet/requests/unassign_ip.rb +24 -0
  161. data/lib/fog/compute/packet/requests/unassign_port.rb +25 -0
  162. data/lib/fog/compute/packet/requests/update_device.rb +201 -0
  163. data/lib/fog/compute/packet/requests/update_email.rb +37 -0
  164. data/lib/fog/compute/packet/requests/update_license.rb +42 -0
  165. data/lib/fog/compute/packet/requests/update_membership.rb +43 -0
  166. data/lib/fog/compute/packet/requests/update_notification.rb +40 -0
  167. data/lib/fog/compute/packet/requests/update_organization.rb +85 -0
  168. data/lib/fog/compute/packet/requests/update_payment_method.rb +63 -0
  169. data/lib/fog/compute/packet/requests/update_project.rb +71 -0
  170. data/lib/fog/compute/packet/requests/update_ssh_key.rb +43 -0
  171. data/lib/fog/compute/packet/requests/update_user.rb +65 -0
  172. data/lib/fog/compute/packet/requests/update_volume.rb +66 -0
  173. data/lib/fog/compute/packet/requests/validate_capacity.rb +38 -0
  174. data/lib/fog/compute/packet/requests/verify_email.rb +36 -0
  175. data/tests/packet/models/test_batches.rb +45 -0
  176. data/tests/packet/models/test_bgp_sessions.rb +52 -0
  177. data/tests/packet/models/test_capacity.rb +40 -0
  178. data/tests/packet/models/test_devices.rb +93 -0
  179. data/tests/packet/models/test_email_verification.rb +25 -0
  180. data/tests/packet/models/test_emails.rb +45 -0
  181. data/tests/packet/models/test_facilities.rb +18 -0
  182. data/tests/packet/models/test_hardware_reservations.rb +38 -0
  183. data/tests/packet/models/test_invitations.rb +41 -0
  184. data/tests/packet/models/test_ips.rb +52 -0
  185. data/tests/packet/models/test_licenses.rb +56 -0
  186. data/tests/packet/models/test_memberships.rb +41 -0
  187. data/tests/packet/models/test_notifications.rb +35 -0
  188. data/tests/packet/models/test_operating_systems.rb +19 -0
  189. data/tests/packet/models/test_organizations.rb +67 -0
  190. data/tests/packet/models/test_payment_methods.rb +61 -0
  191. data/tests/packet/models/test_plans.rb +19 -0
  192. data/tests/packet/models/test_projects.rb +41 -0
  193. data/tests/packet/models/test_sessions.rb +34 -0
  194. data/tests/packet/models/test_snapshots.rb +43 -0
  195. data/tests/packet/models/test_spotmarketprices.rb +28 -0
  196. data/tests/packet/models/test_ssh_keys.rb +58 -0
  197. data/tests/packet/models/test_transfer_requests.rb +49 -0
  198. data/tests/packet/models/test_two_factor_auth.rb +29 -0
  199. data/tests/packet/models/test_users.rb +47 -0
  200. data/tests/packet/models/test_virtual_networks.rb +81 -0
  201. data/tests/packet/models/test_volumes.rb +70 -0
  202. data/tests/packet/models/test_vpns.rb +37 -0
  203. data/tests/packet/requests/test_batches.rb +45 -0
  204. data/tests/packet/requests/test_bgp_sessions.rb +64 -0
  205. data/tests/packet/requests/test_capacity.rb +40 -0
  206. data/tests/packet/requests/test_devices.rb +104 -0
  207. data/tests/packet/requests/test_email_verification.rb +25 -0
  208. data/tests/packet/requests/test_emails.rb +51 -0
  209. data/tests/packet/requests/test_facilities.rb +19 -0
  210. data/tests/packet/requests/test_hardware_reservations.rb +38 -0
  211. data/tests/packet/requests/test_invitations.rb +40 -0
  212. data/tests/packet/requests/test_ips.rb +66 -0
  213. data/tests/packet/requests/test_licenses.rb +56 -0
  214. data/tests/packet/requests/test_memberships.rb +43 -0
  215. data/tests/packet/requests/test_notifications.rb +40 -0
  216. data/tests/packet/requests/test_operating_systems.rb +19 -0
  217. data/tests/packet/requests/test_organizations.rb +64 -0
  218. data/tests/packet/requests/test_payment_methods.rb +60 -0
  219. data/tests/packet/requests/test_plans.rb +21 -0
  220. data/tests/packet/requests/test_projects.rb +40 -0
  221. data/tests/packet/requests/test_sessions.rb +34 -0
  222. data/tests/packet/requests/test_snapshots.rb +57 -0
  223. data/tests/packet/requests/test_sportmarketprices.rb +29 -0
  224. data/tests/packet/requests/test_ssh_keys.rb +60 -0
  225. data/tests/packet/requests/test_transfer_requests.rb +46 -0
  226. data/tests/packet/requests/test_two_factor_auth.rb +29 -0
  227. data/tests/packet/requests/test_users.rb +48 -0
  228. data/tests/packet/requests/test_virtual_networks.rb +100 -0
  229. data/tests/packet/requests/test_volumes.rb +95 -0
  230. data/tests/packet/requests/test_vpns.rb +38 -0
  231. data/tests/test_helper.rb +4 -0
  232. metadata +345 -0
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def disable_two_factor_auth(type)
7
+ url = "/user/otp/" + type
8
+
9
+ request(
10
+ :expects => [204],
11
+ :method => "DELETE",
12
+ :path => url
13
+ )
14
+ end
15
+ end
16
+
17
+ # Mock
18
+ class Mock
19
+ def disable_two_factor_auth(_type)
20
+ response = Excon::Response.new
21
+ response.status = 204
22
+ response
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def disable_vpn
7
+ request(
8
+ :expects => [204],
9
+ :method => "DELETE",
10
+ :path => "/user/vpn"
11
+ )
12
+ end
13
+ end
14
+
15
+ # Mock
16
+ class Mock
17
+ def disable_vpn
18
+ response = Excon::Response.new
19
+ response.status = 204
20
+ response
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def disbond_ports(port_id, bulk_disable)
7
+ request(
8
+ :expects => [200],
9
+ :method => "POST",
10
+ :path => "/ports/" + port_id + "/disbond?bulk_disable=" + (bulk_disable ? "true" : "false")
11
+ )
12
+ end
13
+ end
14
+
15
+ # Mock
16
+ class Mock
17
+ def disbond_ports(_port_id, _bulk_disable)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def enable_two_factor_auth(type)
7
+ url = "/user/otp/" + type
8
+ request(
9
+ :expects => [200],
10
+ :method => "POST",
11
+ :path => url
12
+ )
13
+ end
14
+ end
15
+
16
+ # Mock
17
+ class Mock
18
+ def enable_two_factor_auth(_type)
19
+ response = Excon::Response.new
20
+ response.status = 200
21
+ response
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def enable_vpn
7
+ request(
8
+ :expects => [201],
9
+ :method => "POST",
10
+ :path => "/user/vpn"
11
+ )
12
+ end
13
+ end
14
+
15
+ # Mock
16
+ class Mock
17
+ def enable_vpn
18
+ response = Excon::Response.new
19
+ response.status = 201
20
+ response
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def get_bandwidth(device_id, params)
7
+ request(
8
+ :expects => [201],
9
+ :method => "GET",
10
+ :path => "/devices/" + device_id + "/bandwidth",
11
+ :params => params
12
+ )
13
+ end
14
+ end
15
+
16
+ # Mock
17
+ class Mock
18
+ def get_bandwidth(_device_id, _params = {})
19
+ response = Excon::Response.new
20
+ response.status = 200
21
+ response.body = {
22
+ "bandwidth" => [{
23
+ "datapoints" => []
24
+ }]
25
+ }
26
+ response
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def get_batch(id)
7
+ request(
8
+ :expects => [200],
9
+ :method => "GET",
10
+ :path => "/batches/" + id
11
+ )
12
+ end
13
+ end
14
+
15
+ # Mock
16
+ class Mock
17
+ def get_batch(id)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = {
21
+ "id" => id,
22
+ "error_messages" => [],
23
+ "quantity" => 1,
24
+ "state" => "completed",
25
+ "created_at" => "2018-04-03T11:47:52Z",
26
+ "updated_at" => "2018-04-03T11:47:55Z",
27
+ "devices" => [],
28
+ "project" => {
29
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
30
+ }
31
+ }
32
+
33
+ response
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,37 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def get_bgp_session(session_id)
7
+ request(
8
+ :expects => [200],
9
+ :method => "GET",
10
+ :path => "/bgp/sessions/" + session_id
11
+ )
12
+ end
13
+ end
14
+
15
+ # Mock
16
+ class Mock
17
+ def get_bgp_session(session_id)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = {
21
+ "id" => session_id,
22
+ "status" => "unknown",
23
+ "learned_routes" => [],
24
+ "switch_name" => "esr1.d12.ewr1.packet.net",
25
+ "created_at" => "2018-04-05T21:06:08Z",
26
+ "device" => {
27
+ "href" => "/devices/"
28
+ },
29
+ "address_family" => "ipv4",
30
+ "href" => "/bgp/sessions/ae312253-bae6-4de3-b522-411c2372e29e"
31
+ }
32
+ response
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,165 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def get_capacity
7
+ request(
8
+ :expects => [200],
9
+ :method => "GET",
10
+ :path => "/capacity"
11
+ )
12
+ end
13
+ end
14
+
15
+ # Mock
16
+ class Mock
17
+ def get_capacity
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = {
21
+ "capacity" => {
22
+ "ams1" => {
23
+ "baremetal_2a" => {
24
+ "level" => "unavailable"
25
+ },
26
+ "baremetal_2a2" => {
27
+ "level" => "unavailable"
28
+ },
29
+ "baremetal_1" => {
30
+ "level" => "unavailable"
31
+ },
32
+ "baremetal_3" => {
33
+ "level" => "limited"
34
+ },
35
+ "baremetal_2" => {
36
+ "level" => "limited"
37
+ },
38
+ "baremetal_0" => {
39
+ "level" => "normal"
40
+ }
41
+ },
42
+ "atl1" => {
43
+ "baremetal_1e" => {
44
+ "level" => "normal"
45
+ }
46
+ },
47
+ "dfw1" => {
48
+ "baremetal_1e" => {
49
+ "level" => "limited"
50
+ }
51
+ },
52
+ "ewr1" => {
53
+ "baremetal_2a" => {
54
+ "level" => "limited"
55
+ },
56
+ "baremetal_2a2" => {
57
+ "level" => "limited"
58
+ },
59
+ "baremetal_1" => {
60
+ "level" => "normal"
61
+ },
62
+ "baremetal_3" => {
63
+ "level" => "limited"
64
+ },
65
+ "baremetal_2" => {
66
+ "level" => "limited"
67
+ },
68
+ "baremetal_s" => {
69
+ "level" => "normal"
70
+ },
71
+ "baremetal_0" => {
72
+ "level" => "normal"
73
+ }
74
+ },
75
+ "fra1" => {
76
+ "baremetal_1e" => {
77
+ "level" => "limited"
78
+ }
79
+ },
80
+ "hkg1" => {
81
+ "baremetal_1e" => {
82
+ "level" => "normal"
83
+ }
84
+ },
85
+ "iad1" => {
86
+ "baremetal_1e" => {
87
+ "level" => "limited"
88
+ }
89
+ },
90
+ "lax1" => {
91
+ "baremetal_1e" => {
92
+ "level" => "limited"
93
+ }
94
+ },
95
+ "nrt1" => {
96
+ "baremetal_2a" => {
97
+ "level" => "limited"
98
+ },
99
+ "baremetal_2a2" => {
100
+ "level" => "unavailable"
101
+ },
102
+ "baremetal_1" => {
103
+ "level" => "limited"
104
+ },
105
+ "baremetal_2" => {
106
+ "level" => "limited"
107
+ },
108
+ "baremetal_0" => {
109
+ "level" => "normal"
110
+ }
111
+ },
112
+ "ord1" => {
113
+ "baremetal_1e" => {
114
+ "level" => "normal"
115
+ }
116
+ },
117
+ "sea1" => {
118
+ "baremetal_1e" => {
119
+ "level" => "normal"
120
+ }
121
+ },
122
+ "sin1" => {
123
+ "baremetal_1e" => {
124
+ "level" => "limited"
125
+ }
126
+ },
127
+ "sjc1" => {
128
+ "baremetal_2a" => {
129
+ "level" => "limited"
130
+ },
131
+ "baremetal_2a2" => {
132
+ "level" => "unavailable"
133
+ },
134
+ "baremetal_1" => {
135
+ "level" => "normal"
136
+ },
137
+ "baremetal_3" => {
138
+ "level" => "limited"
139
+ },
140
+ "baremetal_2" => {
141
+ "level" => "limited"
142
+ },
143
+ "baremetal_0" => {
144
+ "level" => "normal"
145
+ }
146
+ },
147
+ "syd1" => {
148
+ "baremetal_1e" => {
149
+ "level" => "limited"
150
+ }
151
+ },
152
+ "yyz1" => {
153
+ "baremetal_1e" => {
154
+ "level" => "limited"
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ response
161
+ end
162
+ end
163
+ end
164
+ end
165
+ end
@@ -0,0 +1,189 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def get_device(device_id)
7
+ request(
8
+ :expects => [200],
9
+ :method => "GET",
10
+ :path => "/devices/" + device_id
11
+ )
12
+ end
13
+ end
14
+
15
+ # Mock
16
+ class Mock
17
+ def get_device(device_id)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = {
21
+ "id" => device_id,
22
+ "short_id" => "8f65b7eb",
23
+ "hostname" => "test01",
24
+ "description" => nil,
25
+ "state" => "active",
26
+ "tags" => [],
27
+ "image_url" => nil,
28
+ "billing_cycle" => "hourly",
29
+ "user" => "core",
30
+ "iqn" => "iqn.2018-03.net.packet:device.8f65b7eb",
31
+ "locked" => false,
32
+ "bonding_mode" => 5,
33
+ "created_at" => "2018-03-07T14:13:27Z",
34
+ "updated_at" => "2018-03-07T14:13:29.697Z",
35
+ "ipxe_script_url" => nil,
36
+ "always_pxe" => false,
37
+ "storage" => nil,
38
+ "provisioning_percentage" => 0.0,
39
+ "operating_system" => {
40
+ "id" => "d61c3912-8422-4daf-835e-854efa0062e4",
41
+ "slug" => "coreos_stable",
42
+ "name" => "Container Linux (CoreOS) - Stable",
43
+ "distro" => "coreos",
44
+ "version" => "stable",
45
+ "provisionable_on" => [
46
+ "m2.xlarge.x86"
47
+ ],
48
+ "default_cidr_size" => 31
49
+ },
50
+ "facility" => {
51
+ "id" => "e1e9c52e-a0bc-4117-b996-0fc94843ea09",
52
+ "name" => "Parsippany, NJ",
53
+ "code" => "ewr1",
54
+ "features" =>
55
+ [
56
+ "baremetal"
57
+ ],
58
+ "address" => nil,
59
+ "ip_ranges" => [
60
+ "2604:1380::/36"
61
+ ]
62
+ },
63
+ "project" =>
64
+ {
65
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
66
+ },
67
+ "ssh_keys" => [
68
+ {
69
+ "href" => "/ssh-keys/38f2f61a-e0d7-4753-bebb-b580da2d43ac"
70
+ },
71
+ {
72
+ "href" => "/ssh-keys/084a5dec-30be-415a-8937-9c615932e459"
73
+ },
74
+ {
75
+ "href" => "/ssh-keys/a8d6cc17-7d9d-4fb9-8190-afdb301b67df"
76
+ },
77
+ {
78
+ "href" => "/ssh-keys/eacfb002-45e1-4047-a0d5-cd9d8bab19ed"
79
+ },
80
+ {
81
+ "href" => "/ssh-keys/61905e3c-aa23-4ad3-922d-63cbd29060f9"
82
+ },
83
+ {
84
+ "href" => "/ssh-keys/a3d8bebe-574f-427d-80ee-bc2ba17f7074"
85
+ }
86
+ ],
87
+ "project_lite" => {
88
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
89
+ },
90
+ "volumes" => [],
91
+ "ip_addresses" => [],
92
+ "plan" => {
93
+ "id" => "e69c0169-4726-46ea-98f1-939c9e8a3607",
94
+ "slug" => "baremetal_0",
95
+ "name" => "Type 0",
96
+ "description" => 'Our Type 0 configuration is a general use "cloud killer" server, with a Intel Atom 2.4Ghz processor and 8GB of RAM.',
97
+ "line" => "baremetal",
98
+ "specs" => {
99
+ "cpus" => [
100
+ {
101
+ "count" => 1,
102
+ "type" => "Intel Atom C2550 @ 2.4Ghz"
103
+ }
104
+ ],
105
+ "memory" => {
106
+ "total" => "8GB"
107
+ },
108
+ "drives" => [
109
+ {
110
+ "count" => 1,
111
+ "size" => "80GB",
112
+ "type" => "SSD"
113
+ }
114
+ ],
115
+ "nics" => [
116
+ {
117
+ "count" => 2,
118
+ "type" => "1Gbps"
119
+ }
120
+ ],
121
+ "features" => {
122
+ "raid" => false,
123
+ "txt" => true
124
+ }
125
+ },
126
+ "available_in" => [
127
+ {
128
+ "href" => "/facilities/8ea03255-89f9-4e62-9d3f-8817db82ceed"
129
+ },
130
+ {
131
+ "href" => "/facilities/2b70eb8f-fa18-47c0-aba7-222a842362fd"
132
+ },
133
+ { "href" => "/facilities/8e6470b3-b75e-47d1-bb93-45b225750975" },
134
+ {
135
+ "href" => "/facilities/e1e9c52e-a0bc-4117-b996-0fc94843ea09"
136
+ }
137
+ ], "pricing" => {
138
+ "hour" => 0.07
139
+ }
140
+ },
141
+ "userdata" => "",
142
+ "switch_uuid" => "6ce8785a",
143
+ "provisioning_events" => [
144
+ {
145
+ "id" => nil,
146
+ "type" => "provisioning.101",
147
+ "body" => "Provisioning started",
148
+ "state" => nil,
149
+ "created_at" => nil,
150
+ "relationships" => [],
151
+ "ip" => nil,
152
+ "modified_by" => nil,
153
+ "interpolated" => "Provisioning started"
154
+ },
155
+ {
156
+ "id" => nil,
157
+ "type" => "provisioning.102",
158
+ "body" => "Network configured",
159
+ "state" => nil,
160
+ "created_at" => nil,
161
+ "relationships" => [],
162
+ "ip" => nil,
163
+ "modified_by" => nil,
164
+ "interpolated" => "Network configured"
165
+ },
166
+ "network_ports" => [
167
+ {
168
+ "id" => "8eb55ecb-73ed-4ff7-b933-3f7fe2ae1a4e",
169
+ "type" => "NetworkBondPort",
170
+ "name" => "eth1",
171
+ "data" => {
172
+ "bonded" => true
173
+ },
174
+ "hardware" => {
175
+ "href" => "/hardware/da6b785b-1b7d-4ed5-b61b-e09ec1bac16d"
176
+ },
177
+ "virtual_networks" => [],
178
+ "connected_port" => nil,
179
+ "href" => "/ports/8eb55ecb-73ed-4ff7-b933-3f7fe2ae1a4e"
180
+ }
181
+ ], "href" => "/devices/8f65b7eb-80a5-4df0-a87d-030d1b0d3b77"
182
+ ]
183
+ }
184
+ response
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end