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,17 @@
1
+ require_relative "operating_system"
2
+
3
+ module Fog
4
+ module Compute
5
+ class Packet
6
+ # Plans
7
+ class OperatingSystems < Fog::Collection
8
+ model Fog::Compute::Packet::OperatingSystem
9
+
10
+ def all
11
+ response = service.list_operating_systems
12
+ load(response.body["operating_systems"])
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,71 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Organization Model
5
+ class Organization < Fog::Model
6
+ identity :id
7
+
8
+ attribute :name
9
+ attribute :description
10
+ attribute :website
11
+ attribute :twitter
12
+ attribute :logo
13
+ attribute :created_at
14
+ attribute :updated_at
15
+ attribute :projects
16
+ attribute :members
17
+ attribute :memberships
18
+ attribute :address
19
+ attribute :entitlement
20
+ attribute :terms
21
+ attribute :credit_amount
22
+ attribute :customdata
23
+
24
+ def initialize(attributes = {})
25
+ super
26
+ end
27
+
28
+ def save
29
+ requires :name
30
+
31
+ options = {}
32
+ options[:name] = name
33
+
34
+ options[:description] = description if description
35
+ options[:website] = website if website
36
+ options[:twitter] = twitter if twitter
37
+ options[:logo] = website if logo
38
+ options[:address] = address if address
39
+ options[:customdata] = customdata if customdata
40
+
41
+ response = service.create_organization(options)
42
+
43
+ merge_attributes(response.body)
44
+ true
45
+ end
46
+
47
+ def update
48
+ requires :id
49
+ options = {}
50
+
51
+ options[:name] = name if name
52
+ options[:description] = description if description
53
+ options[:website] = website if website
54
+ options[:twitter] = twitter if twitter
55
+ options[:logo] = website if logo
56
+ options[:address] = address if address
57
+ options[:customdata] = customdata if customdata
58
+
59
+ response = service.update_organization(id, options)
60
+ merge_attributes(response.body)
61
+ end
62
+
63
+ def destroy
64
+ requires :id
65
+ response = service.delete_organization(id)
66
+ true if response.status == 204
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "organization"
2
+
3
+ module Fog
4
+ module Compute
5
+ class Packet
6
+ # Plans
7
+ class Organizations < Fog::Collection
8
+ model Fog::Compute::Packet::Organization
9
+
10
+ def all(params = {})
11
+ response = service.list_organizations(params)
12
+ load(response.body["organizations"])
13
+ end
14
+
15
+ def get(id)
16
+ response = service.get_organization(id)
17
+ new(response.body)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,63 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # PaymentMethod Model
5
+ class PaymentMethod < Fog::Model
6
+ identity :id
7
+
8
+ attribute :name
9
+ attribute :type
10
+ attribute :default
11
+ attribute :created_at
12
+ attribute :updated_at
13
+ attribute :card_type
14
+ attribute :expiration_month
15
+ attribute :expiration_year
16
+ attribute :cardholder_name
17
+ attribute :billing_address
18
+ attribute :email
19
+ attribute :created_by_user
20
+ attribute :organization
21
+ attribute :projects
22
+ attribute :nonce
23
+ attribute :organization_id
24
+
25
+ def initialize(attributes = {})
26
+ super
27
+ end
28
+
29
+ def save
30
+ requires :organization_id, :nonce, :name
31
+ options = {
32
+ :name => name,
33
+ :nonce => nonce
34
+ }
35
+ options[:default] = default if default
36
+ response = service.create_payment_method(organization_id, options)
37
+
38
+ merge_attributes(response.body)
39
+ end
40
+
41
+ def update
42
+ requires :id
43
+ options = {}
44
+ options[:name] = options["name"] if options["name"]
45
+ options[:cardholder_name] = options["cardholder_name"] if options["cardholder_name"]
46
+ options[:expiration_month] = options["expiration_month"] if options["expiration_month"]
47
+ options[:expiration_year] = options["expiration_year"] if options["expiration_year"]
48
+
49
+ response = service.update_payment_method(id, options)
50
+
51
+ merge_attributes(response.body)
52
+ end
53
+
54
+ def destroy
55
+ requires :id
56
+
57
+ response = service.delete_payment_method(id)
58
+ true if response.status == 204
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "payment_method"
2
+
3
+ module Fog
4
+ module Compute
5
+ class Packet
6
+ # PaymentMethods
7
+ class PaymentMethods < Fog::Collection
8
+ model Fog::Compute::Packet::PaymentMethod
9
+
10
+ def all(org_id, params = {})
11
+ response = service.list_payment_methods(org_id, params)
12
+ load(response.body["payment_methods"])
13
+ end
14
+
15
+ def get(id)
16
+ response = service.get_payment_method(id)
17
+ new(response.body)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Plan
5
+ class Plan < Fog::Model
6
+ identity :id
7
+
8
+ attribute :slug
9
+ attribute :name
10
+ attribute :description
11
+ attribute :line
12
+ attribute :specs
13
+ attribute :pricing
14
+
15
+ attr_accessor :options
16
+
17
+ def initialize(attributes = {})
18
+ super
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ require_relative "plan"
2
+
3
+ module Fog
4
+ module Compute
5
+ class Packet
6
+ # Plans
7
+ class Plans < Fog::Collection
8
+ model Fog::Compute::Packet::Plans
9
+
10
+ def all(params = {})
11
+ response = service.list_plans(params)
12
+ load(response.body["plans"])
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,47 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Project Model
5
+ class Project < Fog::Model
6
+ identity :id
7
+
8
+ attribute :name
9
+ attribute :created_at
10
+ attribute :updated_at
11
+ attribute :network_status
12
+ attribute :max_devices
13
+ attribute :organization
14
+ attribute :memebers
15
+ attribute :memeberships
16
+ attribute :devices
17
+ attribute :ssh_keys
18
+ attribute :transfers
19
+ attribute :volumes
20
+ attribute :href
21
+
22
+ attr_accessor :options
23
+
24
+ def initialize(attributes = {})
25
+ super
26
+ end
27
+
28
+ def save(payment_method_id = "")
29
+ requires :name
30
+
31
+ options = {}
32
+ options[:name] = name
33
+ options[:payment_method_id] = payment_method_id if payment_method_id
34
+ response = service.create_project(options)
35
+ merge_attributes(response.body)
36
+ end
37
+
38
+ def destroy
39
+ requires :id
40
+
41
+ response = service.delete_project(id)
42
+ true if response.status == 204
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "project"
2
+
3
+ module Fog
4
+ module Compute
5
+ class Packet
6
+ # Projects Collection
7
+ class Projects < Fog::Collection
8
+ model Fog::Compute::Packet::Project
9
+
10
+ def all(params = {})
11
+ response = service.list_projects(params)
12
+ load(response.body["projects"])
13
+ end
14
+
15
+ def get(id)
16
+ response = service.get_project(id)
17
+ new(response.body)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Session Model
5
+ class Session < Fog::Model
6
+ identity :id
7
+
8
+ attribute :token
9
+ attribute :expires_at
10
+ attribute :user
11
+ attribute :created_at
12
+ attribute :updated_at
13
+
14
+ attr_accessor :options
15
+
16
+ def initialize(attributes = {})
17
+ super
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ require_relative "session"
2
+
3
+ module Fog
4
+ module Compute
5
+ class Packet
6
+ # Sessions Collection
7
+ class Sessions < Fog::Collection
8
+ model Fog::Compute::Packet::Session
9
+ def login(login_params)
10
+ service.session_login(login_params)
11
+ true
12
+ end
13
+
14
+ def all(params = {})
15
+ response = service.list_sessions(params)
16
+ load(response.body["sessions"])
17
+ end
18
+
19
+ def delete(session_id = "")
20
+ response = service.delete_session(session_id)
21
+ true if response.status == 204
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,33 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Snapshot
5
+ class Snapshot < Fog::Model
6
+ identity :id
7
+
8
+ attribute :status
9
+ attribute :timestamp
10
+ attribute :created_at
11
+ attribute :volume
12
+ attribute :storage_id
13
+
14
+ def initialize(attributes = {})
15
+ super
16
+ end
17
+
18
+ def save
19
+ requires :storage_id
20
+ response = service.create_snapshot(storage_id)
21
+ true if response.status == 202
22
+ end
23
+
24
+ def destroy(volume_id)
25
+ requires :id
26
+
27
+ response = service.delete_snapshot(volume_id, id)
28
+ true if response.status == 204
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "snapshot"
2
+
3
+ module Fog
4
+ module Compute
5
+ class Packet
6
+ # Volumes
7
+ class Snapshots < Fog::Collection
8
+ model Fog::Compute::Packet::Snapshot
9
+
10
+ def all(volume_id, params = {})
11
+ response = service.list_snapshots(volume_id, params)
12
+ load(response.body["snapshots"])
13
+ end
14
+
15
+ def get(id)
16
+ response = service.get_volume(id)
17
+ load(response.body)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ module Fog
2
+ module Compute
3
+ class Packet
4
+ # Ip Model
5
+ class SpotMarketPrice < Fog::Model
6
+ attribute :spot_market_prices
7
+ attribute :prices_history
8
+
9
+ def initialize(attributes = {})
10
+ super
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end