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,61 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def list_users(params = {})
7
+ request(
8
+ :expects => [200],
9
+ :method => "GET",
10
+ :path => "/users",
11
+ :params => params
12
+ )
13
+ end
14
+ end
15
+
16
+ # Mock
17
+ class Mock
18
+ def list_users(_params = {})
19
+ response = Excon::Response.new
20
+ response.status = 200
21
+ response.body = {
22
+ "users" => [
23
+ {
24
+ "id" => "2dce124f-3220-495c-907e-5bbbd4dda77c",
25
+ "short_id" => "2dce124f",
26
+ "first_name" => "Jane",
27
+ "last_name" => "Doe",
28
+ "full_name" => "Jane Doe",
29
+ "email" => "jdoe@example.net",
30
+ "social_accounts" => {
31
+ "linkedin" => "https://example.net"
32
+ },
33
+ "created_at" => "2018-02-20T19:55:57Z",
34
+ "updated_at" => "2018-03-28T11:32:25Z",
35
+ "default_organization_id" => "602c17ec-f996-4d94-a6a8-20d6356e6c2a",
36
+ "avatar_url" => "https://www.gravatar.com/avatar/0bf989eabc6c8c214e11072b7500e4b2?d=mm",
37
+ "avatar_thumb_url" => "https://www.gravatar.com/avatar/0bf989eabc6c8c214e11072b7500e4b2?d=mm",
38
+ "timezone" => "America/New_York",
39
+ "verification_stage" => "verified",
40
+ "two_factor_auth" => "",
41
+ "max_projects" => 2,
42
+ "vpn" => false,
43
+ "last_login_at" => "2018-03-28T11:36:34Z",
44
+ "emails" => [
45
+ {
46
+ "href" => "/emails/973a189d-5dda-4b69-a038-526472a1b6d4"
47
+ }
48
+ ],
49
+ "href" => "/users/2dce124f-3220-495c-907e-5bbbd4dda77c",
50
+ "phone_number" => "+123456789012",
51
+ "restricted" => false
52
+ }
53
+ ]
54
+ }
55
+
56
+ response
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,62 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def list_virtual_networks(project_id, params)
7
+ request(
8
+ :expects => [200],
9
+ :method => "GET",
10
+ :path => "/projects/" + project_id + "/virtual-networks",
11
+ :params => params
12
+ )
13
+ end
14
+ end
15
+
16
+ # Mock
17
+ class Mock
18
+ def list_virtual_networks(_project_id, _params = {})
19
+ response = Excon::Response.new
20
+ response.status = 200
21
+ response.body = {
22
+ "virtual_networks" => [
23
+ {
24
+ "id" => "699c3c36-0cf6-4552-ad43-a1845c04a838",
25
+ "description" => "test",
26
+ "vxlan" => 1022,
27
+ "created_at" => "2018-03-12T22:16:39Z",
28
+ "internet_gateway" => nil,
29
+ "facility" => {
30
+ "href" => "/facilities/e1e9c52e-a0bc-4117-b996-0fc94843ea09"
31
+ },
32
+ "instances" => [],
33
+ "assigned_to" => {
34
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
35
+ },
36
+ "facility_code" => "ewr1", "href" => "/virtual-networks/699c3c36-0cf6-4552-ad43-a1845c04a838"
37
+ }, {
38
+ "id" => "ee424aad-539d-4a4a-877e-fbbd1417e235",
39
+ "description" => "test",
40
+ "vxlan" => 1026,
41
+ "created_at" => "2018-03-12T22:29:56Z",
42
+ "internet_gateway" => nil,
43
+ "facility" =>
44
+ {
45
+ "href" => "/facilities/e1e9c52e-a0bc-4117-b996-0fc94843ea09"
46
+ },
47
+ "instances" => [],
48
+ "assigned_to" => {
49
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
50
+ },
51
+ "facility_code" => "ewr1",
52
+ "href" => "/virtual-networks/ee424aad-539d-4a4a-877e-fbbd1417e235"
53
+ }
54
+ ]
55
+ }
56
+
57
+ response
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,65 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def list_volumes(project_id, params = {})
7
+ request(
8
+ :expects => [200],
9
+ :method => "GET",
10
+ :path => "/projects/" + project_id + "/storage",
11
+ :params => params
12
+ )
13
+ end
14
+ end
15
+
16
+ # Mock
17
+ class Mock
18
+ def list_volumes(_project_id, _params = {})
19
+ response = Excon::Response.new
20
+ response.status = 200
21
+ response.body = {
22
+ "volumes" => [
23
+ {
24
+ "id" => "87728148-3155-4992-a730-8d1e6aca8a32",
25
+ "name" => "volume-870f9650",
26
+ "description" => "test description",
27
+ "size" => 20,
28
+ "locked" => false,
29
+ "billing_cycle" => "hourly",
30
+ "state" => "active",
31
+ "created_at" => "2018-03-08T12:49:30Z",
32
+ "updated_at" => "2018-03-08T12:49:30.682Z",
33
+ "access" => {},
34
+ "project" => {
35
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
36
+ },
37
+ "facility" => {
38
+ "href" => "/facilities/e1e9c52e-a0bc-4117-b996-0fc94843ea09"
39
+ },
40
+ "snapshot_policies" => [],
41
+ "attachments" => [],
42
+ "snapshots" => [],
43
+ "plan" => {
44
+ "id" => "87728148-3155-4992-a730-8d1e6aca8a32",
45
+ "slug" => "storage_1",
46
+ "name" => "Standard",
47
+ "description" => "TBD",
48
+ "line" => "storage",
49
+ "specs" => {},
50
+ "available_in" => [],
51
+ "pricing" => {
52
+ "hour" => 0.000104
53
+ }
54
+ },
55
+ "href" => "/storage/870f9650-19ea-48bd-84c5-ddf97471c1c1"
56
+ }
57
+ ]
58
+ }
59
+
60
+ response
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,43 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def move_hardware_reservation(reservation_id, project_id)
7
+ request(
8
+ :expects => [200],
9
+ :method => "POST",
10
+ :path => "/hardware-reservations/" + reservation_id + "/move/" + project_id
11
+ )
12
+ end
13
+ end
14
+
15
+ # Mock
16
+ class Mock
17
+ def move_hardware_reservation(_reservation_id, _project_id)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = {
21
+ "id" => "string",
22
+ "roles" => [
23
+ "owner"
24
+ ],
25
+ "invitee" => "jane.doe@example.net",
26
+ "nonce" => "NjxZAa3VYc3qvGhPejakYy4nKkt6S7Ay",
27
+ "created_at" => "2018-04-10T21:13:24Z",
28
+ "updated_at" => "2018-04-10T21:16:10Z",
29
+ "invited_by" => {
30
+ "href" => "/users/2dce124f-3220-495c-907e-5bbbd4dda77c"
31
+ },
32
+ "invitable" => {
33
+ "href" => "/organizations/6c17df6c-8769-4d98-b01f-f2848b6489a1"
34
+ },
35
+ "href" => "/invitations/02797cf6-c36c-474b-9558-37463f2aee26"
36
+ }
37
+
38
+ response
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,194 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def poweroff_device(device_id)
7
+ action = {
8
+ "type" => "power_off"
9
+ }
10
+
11
+ request(
12
+ :expects => [201],
13
+ :method => "POST",
14
+ :path => "/devices/" + device_id + "/actions",
15
+ :body => Fog::JSON.encode(action)
16
+ )
17
+ end
18
+ end
19
+
20
+ # Mock
21
+ class Mock
22
+ def poweroff_device(device_id)
23
+ response = Excon::Response.new
24
+ response.status = 202
25
+ response.body = {
26
+ "id" => device_id,
27
+ "short_id" => "8f65b7eb",
28
+ "hostname" => "test01",
29
+ "description" => nil,
30
+ "state" => "active",
31
+ "tags" => [],
32
+ "image_url" => nil,
33
+ "billing_cycle" => "hourly",
34
+ "user" => "core",
35
+ "iqn" => "iqn.2018-03.net.packet:device.8f65b7eb",
36
+ "locked" => false,
37
+ "bonding_mode" => 5,
38
+ "created_at" => "2018-03-07T14:13:27Z",
39
+ "updated_at" => "2018-03-07T14:13:29.697Z",
40
+ "ipxe_script_url" => nil,
41
+ "always_pxe" => false,
42
+ "storage" => nil,
43
+ "provisioning_percentage" => 0.0,
44
+ "operating_system" => {
45
+ "id" => "d61c3912-8422-4daf-835e-854efa0062e4",
46
+ "slug" => "coreos_stable",
47
+ "name" => "Container Linux (CoreOS) - Stable",
48
+ "distro" => "coreos",
49
+ "version" => "stable",
50
+ "provisionable_on" => [
51
+ "m2.xlarge.x86"
52
+ ],
53
+ "default_cidr_size" => 31
54
+ },
55
+ "facility" => {
56
+ "id" => "e1e9c52e-a0bc-4117-b996-0fc94843ea09",
57
+ "name" => "Parsippany, NJ",
58
+ "code" => "ewr1",
59
+ "features" =>
60
+ [
61
+ "baremetal"
62
+ ],
63
+ "address" => nil,
64
+ "ip_ranges" => [
65
+ "2604:1380::/36"
66
+ ]
67
+ },
68
+ "project" =>
69
+ {
70
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
71
+ },
72
+ "ssh_keys" => [
73
+ {
74
+ "href" => "/ssh-keys/38f2f61a-e0d7-4753-bebb-b580da2d43ac"
75
+ },
76
+ {
77
+ "href" => "/ssh-keys/084a5dec-30be-415a-8937-9c615932e459"
78
+ },
79
+ {
80
+ "href" => "/ssh-keys/a8d6cc17-7d9d-4fb9-8190-afdb301b67df"
81
+ },
82
+ {
83
+ "href" => "/ssh-keys/eacfb002-45e1-4047-a0d5-cd9d8bab19ed"
84
+ },
85
+ {
86
+ "href" => "/ssh-keys/61905e3c-aa23-4ad3-922d-63cbd29060f9"
87
+ },
88
+ {
89
+ "href" => "/ssh-keys/a3d8bebe-574f-427d-80ee-bc2ba17f7074"
90
+ }
91
+ ],
92
+ "project_lite" => {
93
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
94
+ },
95
+ "volumes" => [],
96
+ "ip_addresses" => [],
97
+ "plan" => {
98
+ "id" => "e69c0169-4726-46ea-98f1-939c9e8a3607",
99
+ "slug" => "baremetal_0",
100
+ "name" => "Type 0",
101
+ "description" => 'Our Type 0 configuration is a general use "cloud killer" server, with a Intel Atom 2.4Ghz processor and 8GB of RAM.',
102
+ "line" => "baremetal",
103
+ "specs" => {
104
+ "cpus" => [
105
+ {
106
+ "count" => 1,
107
+ "type" => "Intel Atom C2550 @ 2.4Ghz"
108
+ }
109
+ ],
110
+ "memory" => {
111
+ "total" => "8GB"
112
+ },
113
+ "drives" => [
114
+ {
115
+ "count" => 1,
116
+ "size" => "80GB",
117
+ "type" => "SSD"
118
+ }
119
+ ],
120
+ "nics" => [
121
+ {
122
+ "count" => 2,
123
+ "type" => "1Gbps"
124
+ }
125
+ ],
126
+ "features" => {
127
+ "raid" => false,
128
+ "txt" => true
129
+ }
130
+ },
131
+ "available_in" => [
132
+ {
133
+ "href" => "/facilities/8ea03255-89f9-4e62-9d3f-8817db82ceed"
134
+ },
135
+ {
136
+ "href" => "/facilities/2b70eb8f-fa18-47c0-aba7-222a842362fd"
137
+ },
138
+ { "href" => "/facilities/8e6470b3-b75e-47d1-bb93-45b225750975" },
139
+ {
140
+ "href" => "/facilities/e1e9c52e-a0bc-4117-b996-0fc94843ea09"
141
+ }
142
+ ], "pricing" => {
143
+ "hour" => 0.07
144
+ }
145
+ },
146
+ "userdata" => "",
147
+ "switch_uuid" => "6ce8785a",
148
+ "provisioning_events" => [
149
+ {
150
+ "id" => nil,
151
+ "type" => "provisioning.101",
152
+ "body" => "Provisioning started",
153
+ "state" => nil,
154
+ "created_at" => nil,
155
+ "relationships" => [],
156
+ "ip" => nil,
157
+ "modified_by" => nil,
158
+ "interpolated" => "Provisioning started"
159
+ },
160
+ {
161
+ "id" => nil,
162
+ "type" => "provisioning.102",
163
+ "body" => "Network configured",
164
+ "state" => nil,
165
+ "created_at" => nil,
166
+ "relationships" => [],
167
+ "ip" => nil,
168
+ "modified_by" => nil,
169
+ "interpolated" => "Network configured"
170
+ },
171
+ "network_ports" => [
172
+ {
173
+ "id" => "8eb55ecb-73ed-4ff7-b933-3f7fe2ae1a4e",
174
+ "type" => "NetworkBondPort",
175
+ "name" => "bond0",
176
+ "data" => {
177
+ "bonded" => true
178
+ },
179
+ "hardware" => {
180
+ "href" => "/hardware/da6b785b-1b7d-4ed5-b61b-e09ec1bac16d"
181
+ },
182
+ "virtual_networks" => [],
183
+ "connected_port" => nil,
184
+ "href" => "/ports/8eb55ecb-73ed-4ff7-b933-3f7fe2ae1a4e"
185
+ }
186
+ ], "href" => "/devices/8f65b7eb-80a5-4df0-a87d-030d1b0d3b77"
187
+ ]
188
+ }
189
+ response
190
+ end
191
+ end
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,194 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Real
5
+ class Real
6
+ def poweron_device(device_id)
7
+ action = {
8
+ "type" => "power_on"
9
+ }
10
+
11
+ request(
12
+ :expects => [201],
13
+ :method => "POST",
14
+ :path => "/devices/" + device_id + "/actions",
15
+ :body => Fog::JSON.encode(action)
16
+ )
17
+ end
18
+ end
19
+
20
+ # Mock
21
+ class Mock
22
+ def poweron_device(device_id)
23
+ response = Excon::Response.new
24
+ response.status = 202
25
+ response.body = {
26
+ "id" => device_id,
27
+ "short_id" => "8f65b7eb",
28
+ "hostname" => "test01",
29
+ "description" => nil,
30
+ "state" => "active",
31
+ "tags" => [],
32
+ "image_url" => nil,
33
+ "billing_cycle" => "hourly",
34
+ "user" => "core",
35
+ "iqn" => "iqn.2018-03.net.packet:device.8f65b7eb",
36
+ "locked" => false,
37
+ "bonding_mode" => 5,
38
+ "created_at" => "2018-03-07T14:13:27Z",
39
+ "updated_at" => "2018-03-07T14:13:29.697Z",
40
+ "ipxe_script_url" => nil,
41
+ "always_pxe" => false,
42
+ "storage" => nil,
43
+ "provisioning_percentage" => 0.0,
44
+ "operating_system" => {
45
+ "id" => "d61c3912-8422-4daf-835e-854efa0062e4",
46
+ "slug" => "coreos_stable",
47
+ "name" => "Container Linux (CoreOS) - Stable",
48
+ "distro" => "coreos",
49
+ "version" => "stable",
50
+ "provisionable_on" => [
51
+ "m2.xlarge.x86"
52
+ ],
53
+ "default_cidr_size" => 31
54
+ },
55
+ "facility" => {
56
+ "id" => "e1e9c52e-a0bc-4117-b996-0fc94843ea09",
57
+ "name" => "Parsippany, NJ",
58
+ "code" => "ewr1",
59
+ "features" =>
60
+ [
61
+ "baremetal"
62
+ ],
63
+ "address" => nil,
64
+ "ip_ranges" => [
65
+ "2604:1380::/36"
66
+ ]
67
+ },
68
+ "project" =>
69
+ {
70
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
71
+ },
72
+ "ssh_keys" => [
73
+ {
74
+ "href" => "/ssh-keys/38f2f61a-e0d7-4753-bebb-b580da2d43ac"
75
+ },
76
+ {
77
+ "href" => "/ssh-keys/084a5dec-30be-415a-8937-9c615932e459"
78
+ },
79
+ {
80
+ "href" => "/ssh-keys/a8d6cc17-7d9d-4fb9-8190-afdb301b67df"
81
+ },
82
+ {
83
+ "href" => "/ssh-keys/eacfb002-45e1-4047-a0d5-cd9d8bab19ed"
84
+ },
85
+ {
86
+ "href" => "/ssh-keys/61905e3c-aa23-4ad3-922d-63cbd29060f9"
87
+ },
88
+ {
89
+ "href" => "/ssh-keys/a3d8bebe-574f-427d-80ee-bc2ba17f7074"
90
+ }
91
+ ],
92
+ "project_lite" => {
93
+ "href" => "/projects/93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
94
+ },
95
+ "volumes" => [],
96
+ "ip_addresses" => [],
97
+ "plan" => {
98
+ "id" => "e69c0169-4726-46ea-98f1-939c9e8a3607",
99
+ "slug" => "baremetal_0",
100
+ "name" => "Type 0",
101
+ "description" => 'Our Type 0 configuration is a general use "cloud killer" server, with a Intel Atom 2.4Ghz processor and 8GB of RAM.',
102
+ "line" => "baremetal",
103
+ "specs" => {
104
+ "cpus" => [
105
+ {
106
+ "count" => 1,
107
+ "type" => "Intel Atom C2550 @ 2.4Ghz"
108
+ }
109
+ ],
110
+ "memory" => {
111
+ "total" => "8GB"
112
+ },
113
+ "drives" => [
114
+ {
115
+ "count" => 1,
116
+ "size" => "80GB",
117
+ "type" => "SSD"
118
+ }
119
+ ],
120
+ "nics" => [
121
+ {
122
+ "count" => 2,
123
+ "type" => "1Gbps"
124
+ }
125
+ ],
126
+ "features" => {
127
+ "raid" => false,
128
+ "txt" => true
129
+ }
130
+ },
131
+ "available_in" => [
132
+ {
133
+ "href" => "/facilities/8ea03255-89f9-4e62-9d3f-8817db82ceed"
134
+ },
135
+ {
136
+ "href" => "/facilities/2b70eb8f-fa18-47c0-aba7-222a842362fd"
137
+ },
138
+ { "href" => "/facilities/8e6470b3-b75e-47d1-bb93-45b225750975" },
139
+ {
140
+ "href" => "/facilities/e1e9c52e-a0bc-4117-b996-0fc94843ea09"
141
+ }
142
+ ], "pricing" => {
143
+ "hour" => 0.07
144
+ }
145
+ },
146
+ "userdata" => "",
147
+ "switch_uuid" => "6ce8785a",
148
+ "provisioning_events" => [
149
+ {
150
+ "id" => nil,
151
+ "type" => "provisioning.101",
152
+ "body" => "Provisioning started",
153
+ "state" => nil,
154
+ "created_at" => nil,
155
+ "relationships" => [],
156
+ "ip" => nil,
157
+ "modified_by" => nil,
158
+ "interpolated" => "Provisioning started"
159
+ },
160
+ {
161
+ "id" => nil,
162
+ "type" => "provisioning.102",
163
+ "body" => "Network configured",
164
+ "state" => nil,
165
+ "created_at" => nil,
166
+ "relationships" => [],
167
+ "ip" => nil,
168
+ "modified_by" => nil,
169
+ "interpolated" => "Network configured"
170
+ },
171
+ "network_ports" => [
172
+ {
173
+ "id" => "8eb55ecb-73ed-4ff7-b933-3f7fe2ae1a4e",
174
+ "type" => "NetworkBondPort",
175
+ "name" => "bond0",
176
+ "data" => {
177
+ "bonded" => true
178
+ },
179
+ "hardware" => {
180
+ "href" => "/hardware/da6b785b-1b7d-4ed5-b61b-e09ec1bac16d"
181
+ },
182
+ "virtual_networks" => [],
183
+ "connected_port" => nil,
184
+ "href" => "/ports/8eb55ecb-73ed-4ff7-b933-3f7fe2ae1a4e"
185
+ }
186
+ ], "href" => "/devices/8f65b7eb-80a5-4df0-a87d-030d1b0d3b77"
187
+ ]
188
+ }
189
+ response
190
+ end
191
+ end
192
+ end
193
+ end
194
+ end