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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3ac4e3d4eb0976acbdd67ffb1c6417d15ccf1f11a9f78a6d4186f8753f3198ad
4
+ data.tar.gz: 51ad88a8acb1c02f918f3416ed36a240cc2f9a85f4b0a8e9a03e9fb3d14fcc8b
5
+ SHA512:
6
+ metadata.gz: db8b6ec93cb71160daf8a1beeade65d2f6c4b2005875dcf707c4e6d869d6bcca5e20a0cf52e88bbd751b8d4ad41cb1d275b8e6e1e3878d3eb1c8a012ee327e60
7
+ data.tar.gz: 102910dc373d3e7e522ae32a77b7f7f8c362fa852bb12431d0514237216c87ad0a91385c991f37202e30585dd77ab6f0df290ac1f8a99ad14f147f537af00caf
data/.gitignore ADDED
@@ -0,0 +1,51 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+ .idea
13
+
14
+ # Used by dotenv library to load environment variables.
15
+ # .env
16
+
17
+ ## Specific to RubyMotion:
18
+ .dat*
19
+ .repl_history
20
+ build/
21
+ *.bridgesupport
22
+ build-iPhoneOS/
23
+ build-iPhoneSimulator/
24
+
25
+ ## Specific to RubyMotion (use of CocoaPods):
26
+ #
27
+ # We recommend against adding the Pods directory to your .gitignore. However
28
+ # you should judge for yourself, the pros and cons are mentioned at:
29
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
30
+ #
31
+ # vendor/Pods/
32
+
33
+ ## Documentation cache and generated files:
34
+ /.yardoc/
35
+ /_yardoc/
36
+ /doc/
37
+ /rdoc/
38
+
39
+ ## Environment normalization:
40
+ /.bundle/
41
+ /vendor/bundle
42
+ /lib/bundler/man/
43
+
44
+ # for a library or gem, you might want to ignore these files since the code is
45
+ # intended to run in multiple environments; otherwise, check them in:
46
+ Gemfile.lock
47
+ # .ruby-version
48
+ # .ruby-gemset
49
+
50
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
51
+ .rvmrc
data/.rubocop.yml ADDED
@@ -0,0 +1,38 @@
1
+ Metrics/LineLength:
2
+ Enabled: false
3
+
4
+ Metrics/MethodLength:
5
+ Enabled: false
6
+
7
+ Metrics/AbcSize:
8
+ Enabled: false
9
+
10
+ Metrics/ClassLength:
11
+ Enabled: false
12
+
13
+ Metrics/CyclomaticComplexity:
14
+ Enabled: false
15
+
16
+ Metrics/PerceivedComplexity:
17
+ Enabled: false
18
+
19
+ Style/EachWithObject:
20
+ Enabled: false
21
+
22
+ Style/FormatString:
23
+ Enabled: false
24
+
25
+ Style/GuardClause:
26
+ Enabled: false
27
+
28
+ Style/HashSyntax:
29
+ EnforcedStyle: hash_rockets
30
+
31
+ Style/SignalException:
32
+ EnforcedStyle: only_raise
33
+
34
+ Style/StringLiterals:
35
+ EnforcedStyle: double_quotes
36
+
37
+ Layout/IndentationWidth:
38
+ Width: 2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in fog-packet.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 StackPointCloud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,1176 @@
1
+ # fog-packet
2
+ Packet provider for Fog
3
+
4
+ ## Table of Contents
5
+
6
+ - [Requirements](#requirements)
7
+ - [Installation](#installation)
8
+ - [Authentication](#authentication)
9
+ - [Operations](#operations)
10
+ * [Devices](#devices)
11
+ * [Volumes](#volumes)
12
+ * [Snapshots](#snapshots)
13
+ * [IP Addresses](#ip-addresses)
14
+ * [Projects](#projects)
15
+ * [Plans](#plans)
16
+ * [Facilities](#facilities)
17
+ * [Users](#users)
18
+ * [Emails](#emails)
19
+ * [VPN](#vpn)
20
+ * [Spot Market Prices](#spot-market-prices)
21
+ * [SSH Keys](#ssh-keys)
22
+ * [Batches](#batches)
23
+ * [BGP Sessions](#bgp-sessions)
24
+ * [Two Factor Authentication](#two-factor-authentication)
25
+ * [Sessions](#sessions)
26
+ * [Notifications](#notifications)
27
+ * [Invitations](#invitations)
28
+ * [UserVerificationTokens](#userverificationtokens)
29
+ * [Licenses](#licenses)
30
+ * [Memberships](#memberships)
31
+ * [Capacity](#capacity)
32
+ * [Payment Methods](#payment-methods)
33
+ * [Project Transfer Requests](#project-transfer-requests)
34
+ * [Hardware Reservations](#hardware-reservations)
35
+ - [Unit Tests](#unit-tests)
36
+ # Requirements
37
+
38
+ 1. Ruby programming language
39
+
40
+ # Installation
41
+
42
+ 1. Clone the repository
43
+ 2. In the root of the repository run:
44
+
45
+ ```
46
+ gem build fog-packet.gemspec
47
+ ```
48
+
49
+ 3. Install the Ruby gem:
50
+
51
+ ```
52
+ gem install fog-packet-0.1.gem
53
+ ```
54
+
55
+ # Authentication
56
+ *NOTE:* At the moment Packet fog provider is not yet part of the fog project the provider will have to be initialized like this:
57
+
58
+ Provide your credentials when creating a compute object:
59
+
60
+ ```
61
+ compute = Fog::Compute::Packet.new(packet_token: ENV['PACKET_TOKEN'])
62
+ ```
63
+
64
+ # Operations:
65
+
66
+ ## Devices
67
+
68
+ ## Create a device
69
+
70
+ Creates a new device and provisions it in our datacenter.
71
+
72
+ ```ruby
73
+ device = compute.devices.create(:project_id => project_id, :facility => "ewr1", :plan => "baremetal_0", :hostname => "test01", :operating_system => "coreos_stable")
74
+ ```
75
+
76
+ Available parameters
77
+
78
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
79
+ |---|---|---|---|
80
+ | project_id | string | Project UUID under which device will be created| Yes |
81
+ | hostname | string | The hostname of the server. | Yes |
82
+ | plan | string | Plan name| Yes |
83
+ | facility | string | Facility code | Yes |
84
+ | operating_system | string || No |
85
+ | description | string | | No* |
86
+ | billing_cycle | string | | No |
87
+ | always_pxe | string | | No |
88
+ | ipxe_script_url | string | | No |
89
+ | userdata | string | | No |
90
+ | locked | string | | No |
91
+ | hardware_reservation_id | string | | No |
92
+ | spot_instance | string | | No |
93
+ | spot_price_max | string | | No |
94
+ | termination_time | string | | No |
95
+ | tags | string | | No |
96
+ | project_ssh_keys | string | | No |
97
+ | user_ssh_keys | string | | No |
98
+ | features | string | | No |
99
+
100
+ ## Retrieve a device
101
+
102
+ Gets details about a specified device
103
+
104
+ ```ruby
105
+ response = compute.devices.get(device_id)
106
+ ```
107
+
108
+ ## Update a device
109
+ Updates a device
110
+ ```ruby
111
+ device.hostname= 'test02'
112
+
113
+ response = device.update
114
+ ```
115
+
116
+ Available parameters
117
+
118
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
119
+ |---|---|---|---|
120
+ | hostname | string | The hostname of the server. | Yes |
121
+ | description | string | | No |
122
+ | billing_cycle | string | | No |
123
+ | always_pxe | string | | No |
124
+ | ipxe_script_url | string | | No |
125
+ | userdata | string | | No |
126
+ | locked | string | | No |
127
+ | spot_instance | string | | No |
128
+
129
+ ## Reboot device
130
+ Reboots the specified device
131
+
132
+ ```ruby
133
+ response = device.reboot
134
+ ```
135
+
136
+ ## Power off device
137
+ Powers off the specified device
138
+
139
+ ```ruby
140
+ response = device.stop
141
+ ```
142
+
143
+ ## Power on device
144
+ Powers on the specified device
145
+
146
+ ```ruby
147
+ response = device.start
148
+ ```
149
+
150
+ ## Delete a device
151
+
152
+ Deletes the specified devices
153
+
154
+ ```ruby
155
+ response = device.destroy
156
+ ```
157
+
158
+ ## Get Device Events
159
+ Returns a list of events pertaining to a specific device.
160
+
161
+ ```ruby
162
+ events = compute.events.all(device_id)
163
+ ```
164
+ ## Get Device Bandwidth
165
+ Retrieve an instance bandwidth for a given period of time.
166
+
167
+ ```ruby
168
+ bandwidth = compute.bandwidth.get(device_id, "2018-03-10", "2018-04-10")
169
+ ```
170
+
171
+ ## Volumes
172
+
173
+ ## Create a volume
174
+ Creates a new volume
175
+
176
+ ```ruby
177
+ volume = compute.volumes.create(:project_id => project_id, :facility => "ewr1", :plan => "storage_1", :size => 20, :description => "test description", :billing_cycle => "hourly")
178
+ ```
179
+
180
+
181
+ Available parameters
182
+
183
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
184
+ |---|---|---|---|
185
+ | facility | string | Facility code | Yes |
186
+ | plan | string | Plan name| Yes |
187
+ | size | int | Volume size| Yes |
188
+ | description | string | | No |
189
+ | billing_cycle | string | | No |
190
+ | snapshot_policies | string | | No |
191
+
192
+
193
+ ## Retrieve a volume
194
+
195
+ Gets a specified volume
196
+
197
+ ```ruby
198
+ response = compute.volumes.get(volume_id)
199
+ ```
200
+
201
+ ## List volumes
202
+ List all volumes in the specified project
203
+
204
+ ```ruby
205
+ response = compute.volumes.all(project_id)
206
+ ```
207
+
208
+ Optional parameters
209
+
210
+ | NAME| TYPE | DESCRIPTION |
211
+ |---|---|---|
212
+ | without_projects | string | |
213
+ | per_page | string | |
214
+ | page | string | |
215
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
216
+
217
+ ## Attach a volume
218
+
219
+ Attaches a volume to the specified device
220
+
221
+ ```ruby
222
+ response = volume.attach(device_id)
223
+ ```
224
+
225
+ ## Detach a volume
226
+
227
+ Detaches a volume from the specified device
228
+
229
+ ```ruby
230
+ response = volume.detach
231
+ ```
232
+
233
+ ## Delete a volume
234
+ Deletes a specified volume
235
+
236
+ ```ruby
237
+ response = volume.destroy
238
+ ```
239
+
240
+ ## Snapshots
241
+
242
+ ## Create a snapshot of a volume
243
+ Creates a snapshot of the specified volume
244
+
245
+ ```ruby
246
+ response = compute.snapshots.create(:storage_id => volume_id)
247
+ ```
248
+
249
+ ## List snapshots
250
+ List all snapshots of the specified volume
251
+
252
+ ```ruby
253
+ response = compute.snapshots.all(volume_id)
254
+ ```
255
+
256
+ Optional parameters
257
+
258
+ | NAME| TYPE | DESCRIPTION |
259
+ |---|---|---|
260
+ | without_projects | string | |
261
+ | per_page | string | |
262
+ | page | string | |
263
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
264
+
265
+
266
+ ## Delete a snapshot
267
+ Deletes the specified snapshot
268
+ ```ruby
269
+ response = snapshot.destroy(volume_id, snapshot_id)
270
+ ```
271
+
272
+ ## IP addresses
273
+
274
+ ## Reserve an IP address
275
+ Reserve an IP address
276
+
277
+ ```ruby
278
+ response = compute.ips.create(:project_id => project_id, :facility => "ewr1", :quantity => 2, :type => "global_ipv4", :comments => "test comment")
279
+ ```
280
+
281
+ Available parameters
282
+
283
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
284
+ |---|---|---|---|
285
+ | facility | string | Facility code | Yes |
286
+ | quatity | int| | Yes |
287
+ | type | string | | Yes |
288
+ | comments | string | | No |
289
+
290
+ ## Get IPs
291
+ Retrives the list of IP addresses under the specified project
292
+
293
+ ```ruby
294
+ response = compute.ips.all(project_id)
295
+ ```
296
+
297
+ Optional parameters
298
+
299
+ | NAME| TYPE | DESCRIPTION |
300
+ |---|---|---|
301
+ | without_projects | string | |
302
+ | per_page | string | |
303
+ | page | string | |
304
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
305
+
306
+ ## Assign an IP address
307
+ Assigns an IP address to the specified devices
308
+
309
+ ```ruby
310
+ response = ip.assign(device_id)
311
+ ```
312
+
313
+ ## Unassign IP address
314
+ Unassigns the specified IP address
315
+
316
+ ```ruby
317
+ response = compute.unassign
318
+ ```
319
+
320
+ ## Projects
321
+
322
+ ## Create a project
323
+
324
+ Creates a new project
325
+
326
+ ```ruby
327
+ response = compute.projects.create(:name => "test01", :payment_method_id => "1234")
328
+ ```
329
+
330
+ Available parameters
331
+
332
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
333
+ |---|---|---|---|
334
+ | name | string | Name of the project| Yes |
335
+ | payment_method_id | string | | No |
336
+
337
+
338
+ ## Retrieve a project
339
+
340
+ Gets project details
341
+
342
+ ```ruby
343
+ response = compute.projects.get(project_id)
344
+
345
+ ```
346
+
347
+ ## Plans
348
+
349
+ ## List plans
350
+ List all available plans of the account
351
+
352
+ ```ruby
353
+ response = compute.plans.all
354
+ ```
355
+
356
+ Optional parameters
357
+
358
+ | NAME| TYPE | DESCRIPTION |
359
+ |---|---|---|
360
+ | without_projects | string | |
361
+ | per_page | string | |
362
+ | page | string | |
363
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
364
+
365
+ ## Facilities
366
+
367
+ ## List facilities
368
+ List all available facilities of the account
369
+
370
+ ```ruby
371
+ response = compute.facilities.all
372
+ ```
373
+
374
+ Optional parameters
375
+
376
+ | NAME| TYPE | DESCRIPTION |
377
+ |---|---|---|
378
+ | without_projects | string | |
379
+ | per_page | string | |
380
+ | page | string | |
381
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
382
+
383
+ ## Users
384
+
385
+ ## List Users
386
+ List all users in the current user’s projects
387
+
388
+ ```ruby
389
+ response = compute.users.all
390
+ ```
391
+
392
+ Optional parameters
393
+
394
+ | NAME| TYPE | DESCRIPTION |
395
+ |---|---|---|
396
+ | without_projects | string | |
397
+ | per_page | string | |
398
+ | page | string | |
399
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
400
+
401
+ ## Retrieve a user
402
+
403
+ Retrieve the currently logged-in user or retrieve a user by user ID.
404
+
405
+ ```ruby
406
+ response = compute.users.get
407
+ ```
408
+
409
+ ```ruby
410
+ response = compute.users.get(user_id)
411
+ ```
412
+
413
+ ## Update a user
414
+
415
+ Updates user information.
416
+
417
+ ```ruby
418
+ user.first_name = "Jane"
419
+ user.last_name = "Doe"
420
+
421
+ response = user.update
422
+ ```
423
+
424
+ Available parameters
425
+
426
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
427
+ |---|---|---|---|
428
+ | first_name | string | First name| |
429
+ | last_name | string | Last name | |
430
+ | phone_number | string | Phone number| |
431
+ | time_zone | string | Time zone of the user| |
432
+ | password | string | | |
433
+ | avatar | string | | |
434
+
435
+ ## Emails
436
+
437
+ ## Create an email
438
+
439
+ Add a new email address to the current user.
440
+
441
+ ```ruby
442
+ email = compute.emails.create(:address => "jdoe@example.net", :default => false)
443
+ ```
444
+
445
+ Available parameters
446
+
447
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
448
+ |---|---|---|---|
449
+ | address | string | Email address | |
450
+ | default | boolean | Indicates if email address is default or not | |
451
+
452
+ ## Retrieve an email
453
+ Provides one of the user’s emails.
454
+
455
+ ```ruby
456
+ response = compute.emails.get(email_id)
457
+ ```
458
+
459
+ ## Update an email
460
+
461
+ Updates the email.
462
+
463
+ ```ruby
464
+ email.default = false
465
+ email.update
466
+ ```
467
+
468
+ Available parameters
469
+
470
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
471
+ |---|---|---|---|
472
+ | address | string | Email address | |
473
+ | default | boolean | Indicates if email address is default or not | |
474
+
475
+ ## Delete an email
476
+
477
+ Deletes the email.
478
+
479
+ ```ruby
480
+ response = email.destroy
481
+ ```
482
+
483
+ Note: Default email cannot be deleted.
484
+
485
+ ## VPN
486
+
487
+ ## Enable VPN
488
+ Turns on vpn for the currently logged-in user.
489
+
490
+ ```ruby
491
+ response = compute.vpns.enable
492
+ ```
493
+
494
+ ## Disable VPN
495
+ Turns off vpn for the currently logged-in user.
496
+
497
+ ```ruby
498
+ response = compute.vpns.disable
499
+ ```
500
+ ## Retrieve VPN
501
+ Returns the client vpn config for the currently logged-in user.
502
+
503
+ ```ruby
504
+ response = compute.vpns.get("nrt1")
505
+ ```
506
+
507
+ Available parameters
508
+
509
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
510
+ |---|---|---|---|
511
+ | facility_code | string | facility code (ewr1, scj1, arm1, nrt1) | Yes |
512
+
513
+
514
+ ## Spot Market Prices
515
+
516
+ ## Get spot market prices
517
+
518
+ Get Packet current spot market prices.
519
+
520
+ ```ruby
521
+ response = compute.spot_market_prices.all
522
+ ```
523
+
524
+ ## Spot Market History
525
+
526
+ Get spot market prices for a given plan and facility in a fixed period of time.
527
+
528
+ ```ruby
529
+ response = compute.spot_market_prices.get("ewr1", "baremetal_0")
530
+ ```
531
+
532
+ Available parameters
533
+
534
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
535
+ |---|---|---|---|
536
+ | facility_code | string | facility code (ewr1, scj1, arm1, nrt1) | Yes |
537
+ | plan | string | plan code | Yes |
538
+
539
+ ## SSH Keys
540
+
541
+ ## Create a SSH Key
542
+
543
+ Creates a SSH Key
544
+
545
+ ```ruby
546
+ response = compute.ssh_keys.create(:label => "test", :key => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDgnV5MOhBqpQLt66KGlMKi...")
547
+ ```
548
+
549
+ Available parameters
550
+
551
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
552
+ |---|---|---|---|
553
+ | label | string | Label for the SSH key | Yes |
554
+ | key | string | Public SSH Key | Yes |
555
+
556
+ ## List SSH Keys
557
+
558
+ Returns a collection of the user’s ssh keys, unless project ID is specified then it returns a collection of the project's ssh keys.
559
+
560
+ ```ruby
561
+ response = compute.ssh_keys.all
562
+ ```
563
+
564
+ ```ruby
565
+ response = compute.ssh_keys.all(project_id)
566
+ ```
567
+
568
+ Optional parameters
569
+
570
+ | NAME| TYPE | DESCRIPTION |
571
+ |---|---|---|
572
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
573
+
574
+ ## Retrieve a SSH key
575
+
576
+ Returns a single ssh key
577
+
578
+ ```ruby
579
+ response = compute.ssh_keys.get(key_id)
580
+ ```
581
+
582
+ ## Update a SSH Key
583
+
584
+ ```ruby
585
+ sshkey.label = "test_jg_01"
586
+ sshkey.key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDgnV5MOhBqpQLt66KGlMKi..."
587
+
588
+ response = sshkey.update
589
+ ```
590
+
591
+ Available parameters
592
+
593
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
594
+ |---|---|---|---|
595
+ | label | string | Label for the SSH key | Yes |
596
+ | key | string | Public SSH Key | Yes |
597
+
598
+ ## Delete a SSH Key
599
+
600
+ Deletes the ssh key.
601
+
602
+ ```ruby
603
+ response = sshkey.destroy
604
+ ```
605
+
606
+ ## Batches
607
+
608
+ ## Create a batch
609
+ Creates a new batch of instances.
610
+
611
+ ```ruby
612
+ batches = [{
613
+ :hostname => "test1",
614
+ :description => "test batch",
615
+ :plan => "baremetal_0",
616
+ :operating_system => "coreos_stable",
617
+ :facility => "ewr1",
618
+ :billing_cycle => "hourly",
619
+ :tags => ["abc"],
620
+ :quantity => 1
621
+ }]
622
+
623
+ response = compute.batches.create(project_id, :batches => batches)
624
+ ```
625
+
626
+ Available parameters
627
+
628
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
629
+ |---|---|---|---|
630
+ | batches | collection | Collection of instances. | Yes |
631
+ | project_id | string | UUID of the project | Yes |
632
+
633
+ ## List batches
634
+ Returns all batches for the given project.
635
+
636
+ ```ruby
637
+ response = compute.batches.all(project_id)
638
+ ```
639
+
640
+ Optional parameters
641
+
642
+ | NAME| TYPE | DESCRIPTION |
643
+ |---|---|---|
644
+ | without_projects | string | |
645
+ | per_page | string | |
646
+ | page | string | |
647
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
648
+
649
+ ## Retrieve a batch
650
+ Returns a batch
651
+
652
+ ```ruby
653
+ response = compute.batches.get(batch_id)
654
+ ```
655
+
656
+ ## BGP Sessions
657
+
658
+ ## Create a BGP Session
659
+ Creates a BGP session.
660
+
661
+ ```ruby
662
+ response = compute.bgp_sessions.create(:device_id => device_id, :address_family => address_family)
663
+ ```
664
+
665
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
666
+ |---|---|---|---|
667
+ | device_id | string | UUID of a device | Yes |
668
+ | address_family | string | Either 'ipv4' or 'ipv6' | Yes |
669
+
670
+ ## List BGP sessions
671
+ Provides a listing of available BGP sessions for the device.
672
+
673
+ ```ruby
674
+ response = compute.bgp_sessions.all(device_id)
675
+ ```
676
+
677
+ ## Retrieve a BGP session
678
+ Returns a BGP session.
679
+
680
+ ```ruby
681
+ response = compute.bgp_sessions.get(session_id)
682
+ ```
683
+
684
+ ## Delete a BGP session
685
+ Deletes the BGP session
686
+
687
+ ```ruby
688
+ response = session.destroy
689
+ ```
690
+
691
+ ## Two Factor Authentication
692
+
693
+ ## Enable two factor authentication
694
+ Enables two factor authentication using authenticator app.
695
+
696
+ ```ruby
697
+ compute.two_factor_auth.enable(type)
698
+ ```
699
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
700
+ |---|---|---|---|
701
+ | type | string | Two factor auth types include authenticator app or sms. | Yes |
702
+
703
+ ## Disable two factor authentication
704
+ Disables two factor authentication.
705
+
706
+ ```ruby
707
+ compute.two_factor_auth.disable(type)
708
+ ```
709
+
710
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
711
+ |---|---|---|---|
712
+ | type | string | Two factor auth types include authenticator app or sms. | Yes |
713
+
714
+ ## Sessions
715
+
716
+ ## Session Login
717
+ Log in
718
+
719
+ ```ruby
720
+ compute.sessions.login(:username => "username",:password => "password")
721
+ ```
722
+
723
+ ## List Sessions
724
+ Returns all session tokens for the current user.
725
+
726
+ ```ruby
727
+ sessions = compute.sessions.all
728
+ ```
729
+
730
+ Optional parameters
731
+
732
+ | NAME| TYPE | DESCRIPTION |
733
+ |---|---|---|
734
+ | without_projects | string | |
735
+ | per_page | string | |
736
+ | page | string | |
737
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
738
+
739
+ ## Delete session
740
+ Destroy users current session unless sessions_id is provided.
741
+
742
+ ```ruby
743
+ compute.sessions.destroy(sessions_id)
744
+ ```
745
+
746
+ ## Notifications
747
+
748
+ ## List notifications
749
+ Returns a collection of the current user’s notification.
750
+
751
+ ```ruby
752
+ compute.notifications.all
753
+ ```
754
+
755
+ Optional parameters
756
+
757
+ | NAME| TYPE | DESCRIPTION |
758
+ |---|---|---|
759
+ | without_projects | string | |
760
+ | per_page | string | |
761
+ | page | string | |
762
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
763
+
764
+ ## Retrieve a notification
765
+ Returns a single notification if the user has access.
766
+
767
+ ```ruby
768
+ compute.notifications.get(notification_id)
769
+ ```
770
+
771
+ ## Update a notification
772
+ Updates a single notification. Currently, the only supported operation is marking a notification as read.
773
+
774
+ ```ruby
775
+ notification.update
776
+ ```
777
+
778
+ ## Invitations
779
+
780
+ ## List Invitations
781
+ Returns all invitations in a project.
782
+
783
+ ```ruby
784
+ compute.invitations.all(project_id)
785
+ ```
786
+
787
+ Optional parameters
788
+
789
+ | NAME| TYPE | DESCRIPTION |
790
+ |---|---|---|
791
+ | without_projects | string | |
792
+ | per_page | string | |
793
+ | page | string | |
794
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
795
+
796
+ ## Retrieve an invite
797
+ Returns a single invitation.
798
+
799
+ ```ruby
800
+ invite = compute.invitations.get(invite_id)
801
+ ```
802
+
803
+ ## Accept invitation
804
+ Accept an invitation.
805
+
806
+ ```ruby
807
+ invite.accept
808
+ ```
809
+
810
+ ## Decline invitation
811
+ Decline an invitation.
812
+
813
+ ```ruby
814
+ invite.decline
815
+ ```
816
+
817
+ ## UserVerificationTokens
818
+
819
+ ## Request email verification
820
+ Creates an email verification request.
821
+
822
+ ```ruby
823
+ compute.email_verification.request(email)
824
+ ```
825
+
826
+ ## Verify email
827
+ Consumes an email verification token and verifies the user associated with it.
828
+
829
+ ```ruby
830
+ compute.email_verification.verify(token)
831
+ ```
832
+
833
+ ## Licenses
834
+
835
+ ## Create a License
836
+ Creates a new license for the given project.
837
+
838
+ ```ruby
839
+ license = {
840
+ :project_id => project_id,
841
+ :description => "test01",
842
+ :size => 1,
843
+ :license_product_id => "blah"
844
+ }
845
+
846
+ license = compute.licenses.create(license)
847
+ ```
848
+
849
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
850
+ |---|---|---|---|
851
+ | project_id | string | UUID of the project | Yes |
852
+ | description | string | | Yes |
853
+ | size | string | | Yes |
854
+ | license_product_id | string | | Yes |
855
+
856
+ ## List Project Licenses
857
+ Provides a collection of licenses for a given project.
858
+
859
+ ```ruby
860
+ compute.licenses.all(project_id)
861
+ ```
862
+
863
+ Optional parameters
864
+
865
+ | NAME| TYPE | DESCRIPTION |
866
+ |---|---|---|
867
+ | without_projects | string | |
868
+ | per_page | string | |
869
+ | page | string | |
870
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
871
+
872
+ ## Retrieve a License
873
+ Returns a license.
874
+
875
+ ```ruby
876
+ license = compute.licenses.get(license_id)
877
+ ```
878
+
879
+ ## Memberships
880
+
881
+ ## List Memberships
882
+ Returns all memberships in a project.
883
+
884
+ ```ruby
885
+ memberships = compute.memberships.all(project_id)
886
+ ```
887
+
888
+ Optional parameters
889
+
890
+ | NAME| TYPE | DESCRIPTION |
891
+ |---|---|---|
892
+ | without_projects | string | |
893
+ | per_page | string | |
894
+ | page | string | |
895
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
896
+
897
+ ## Retrieve a membership
898
+ Returns a single membership.
899
+
900
+ ```ruby
901
+ membership = compute.memberships.get(membership_id)
902
+ ```
903
+
904
+ ## Update a membership
905
+ Updates the membership.
906
+
907
+ ```ruby
908
+ membership.roles = ["owner"]
909
+ membership.update
910
+ ```
911
+ ## Delete a membership
912
+ Deletes the membership.
913
+
914
+ ```ruby
915
+ membership.destroy
916
+ ```
917
+ ## Organizations
918
+
919
+ ## Create an organization
920
+ Creates an organization.
921
+
922
+ ```ruby
923
+ options = {
924
+ :name => "test_org",
925
+ :description => "test organization"
926
+ }
927
+
928
+ response = compute.organizations.create(options)
929
+ ```
930
+
931
+ Available parameters
932
+
933
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
934
+ |---|---|---|---|
935
+ | name | string | Name for the organization | Yes |
936
+ | description | string | | No |
937
+ | website | string | | No |
938
+ | twitter | string | | No |
939
+ | logo | string | | No |
940
+ | address | string | | No |
941
+ | customdata | string | | No |
942
+
943
+ ## Update an organization
944
+ Updates the organization.
945
+
946
+ ```ruby
947
+ org.name = "new name"
948
+ org.description = "new organization"
949
+
950
+ response = org.update
951
+ ```
952
+
953
+ ## Retrieve an organization
954
+ Returns a single organization's details, if the user is authorized to view it.
955
+
956
+ ```ruby
957
+ org = compute.organizations.get(org_id)
958
+ ```
959
+
960
+ ## List organizations
961
+ Returns a list of organizations that are accessible to the current user.
962
+
963
+ ```ruby
964
+ response = compute.organizations.all
965
+ ```
966
+
967
+ Optional parameters
968
+
969
+ | NAME| TYPE | DESCRIPTION |
970
+ |---|---|---|
971
+ | personal | string | |
972
+ | without_projects | string | |
973
+ | per_page | string | |
974
+ | page | string | |
975
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
976
+
977
+
978
+ ## Delete an organization
979
+ Deletes the organization.
980
+
981
+ ```ruby
982
+ response = org.destroy
983
+ ```
984
+
985
+ ## Capacity
986
+
987
+ ## Get capacity
988
+ Returns a list of facilities and plans with their current capacity.
989
+
990
+ ```ruby
991
+ response = compute.capacities.all
992
+ ```
993
+
994
+ ## Validate required capacity
995
+ Validates if a deploy can be fulfilled.
996
+
997
+ ```ruby
998
+ options = {
999
+ :servers => [
1000
+ {
1001
+ :facility => "ewr1",
1002
+ :plan => "baremetal_2a",
1003
+ :quantity => 1
1004
+ },
1005
+ {
1006
+ :facility => "atl1",
1007
+ :plan => "baremetal_1e",
1008
+ :quantity => 1
1009
+ }
1010
+ ]
1011
+ }
1012
+
1013
+ response = compute.capacities.validate(options)
1014
+ ```
1015
+
1016
+ If required capacities are available function will return true otherwise it will return an error with details.
1017
+
1018
+ ## Payment methods
1019
+
1020
+ ## Create a payment method
1021
+ Creates a payment method.
1022
+
1023
+ ```ruby
1024
+ options = {
1025
+ :name => "test",
1026
+ :default => "false",
1027
+ :nonce => "12",
1028
+ :organization_id => "ef114acb-2e50-43b5-83e7-b7c2758f0520"
1029
+ }
1030
+
1031
+ response = compute.payment_methods.create(options)
1032
+ ```
1033
+
1034
+ Available parameters
1035
+
1036
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
1037
+ |---|---|---|---|
1038
+ | organization_id | string | | Yes |
1039
+ | name | string | | Yes |
1040
+ | nonce | string | | Yes |
1041
+ | default | boolean | | No |
1042
+
1043
+
1044
+ ## List payment methods
1045
+ Returns all payment methods of an organization.
1046
+
1047
+ ```ruby
1048
+ payment_methods = compute.payment_methods.all(org_id)
1049
+ ```
1050
+
1051
+ Optional parameters
1052
+
1053
+ | NAME| TYPE | DESCRIPTION |
1054
+ |---|---|---|
1055
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
1056
+
1057
+ ## Retrieve a payment method
1058
+ Returns a payment method.
1059
+
1060
+ ```ruby
1061
+ payment_method = compute.payment_methods.get(payment_method_id)
1062
+ ```
1063
+
1064
+ ## Update payment method
1065
+ Updates the payment method.
1066
+
1067
+ ```ruby
1068
+ payment_method.name = "new name"
1069
+ payment_method.expiration_month = 12
1070
+ payment_method.expiration_year = 2022
1071
+ response = payment_method.update
1072
+ ```
1073
+
1074
+ ## Delete payment method
1075
+ Deletes the payment method.
1076
+
1077
+ ```ruby
1078
+ response = payment_method.destroy
1079
+ ```
1080
+
1081
+ ## Project transfer requests
1082
+
1083
+ ## Transfer a project
1084
+ Organization owners can transfer their projects to other organizations.
1085
+
1086
+ ```ruby
1087
+ response = compute.transfer_requests.transfer(project_id, org_id)
1088
+ ```
1089
+
1090
+ Available parameters
1091
+
1092
+ | NAME| TYPE | DESCRIPTION | REQUIRED |
1093
+ |---|---|---|---|
1094
+ | project_id | string | UUID of the project to be transfered | Yes |
1095
+ | org_id | string | UUID of the target organization | Yes |
1096
+
1097
+ ## List transfer requests
1098
+ Provides a collection of project transfer requests from or to the organization.
1099
+
1100
+ ```ruby
1101
+ response = compute.transfer_requests.all(org_id)
1102
+ ```
1103
+
1104
+ Optional parameters
1105
+
1106
+ | NAME| TYPE | DESCRIPTION |
1107
+ |---|---|---|
1108
+ | per_page | string | |
1109
+ | page | string | |
1110
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
1111
+
1112
+ ## Retrieve a transfer request
1113
+ Returns a single transfer request.
1114
+
1115
+ ```ruby
1116
+ transfer_request = compute.transfer_requests.get(transfer_request_id)
1117
+ ```
1118
+
1119
+ ## Accept a transfer request
1120
+ Accept a transfer request.
1121
+
1122
+ ```ruby
1123
+ response = transfer_request.accept
1124
+ ```
1125
+
1126
+ ## Decline a transfer request
1127
+ Decline a transfer request.
1128
+
1129
+ ```ruby
1130
+ response = transfer_request.decline
1131
+ ```
1132
+
1133
+ ## Hardware reservations
1134
+
1135
+ ## List hardware reservations
1136
+ Provides a collection of hardware reservations for a given project.
1137
+
1138
+ ```ruby
1139
+ hardware_reservations = compute.hardware_reservations.all(project_id)
1140
+ ```
1141
+
1142
+ Optional parameters
1143
+
1144
+ | NAME| TYPE | DESCRIPTION |
1145
+ |---|---|---|
1146
+ | per_page | string | |
1147
+ | page | string | |
1148
+ | include | string | For resources that contain collections of other resources, the Packet API will return links to the other resources by default. |
1149
+
1150
+ ## Retrieve a hardware reservation
1151
+ Returns a single hardware reservation.
1152
+
1153
+ ```ruby
1154
+ hardware_reservation = @compute.hardware_reservations.get(reservation_id)
1155
+ ```
1156
+
1157
+ ## Move a hardware reservation
1158
+ Move a hardware reservation to another project.
1159
+
1160
+ ```ruby
1161
+ hardware_reservation.move(project_id)
1162
+ ```
1163
+
1164
+ ## Unit tests
1165
+
1166
+ Run mock tests:
1167
+
1168
+ ```bash
1169
+ FOG_MOCK=true rake test
1170
+ ```
1171
+
1172
+ Run real tests:
1173
+
1174
+ ```bash
1175
+ FOG_MOCK=false rake test
1176
+ ```