fog-packet 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +51 -0
- data/.rubocop.yml +38 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +1176 -0
- data/Rakefile +24 -0
- data/fog-packet.gemspec +24 -0
- data/lib/fog-packet.rb +26 -0
- data/lib/fog/compute/packet/compute.rb +313 -0
- data/lib/fog/compute/packet/models/bandwidth.rb +14 -0
- data/lib/fog/compute/packet/models/batch.rb +18 -0
- data/lib/fog/compute/packet/models/batches.rb +27 -0
- data/lib/fog/compute/packet/models/bgp_session.rb +35 -0
- data/lib/fog/compute/packet/models/bgp_sessions.rb +22 -0
- data/lib/fog/compute/packet/models/capacities.rb +27 -0
- data/lib/fog/compute/packet/models/capacity.rb +29 -0
- data/lib/fog/compute/packet/models/device.rb +136 -0
- data/lib/fog/compute/packet/models/devices.rb +22 -0
- data/lib/fog/compute/packet/models/email.rb +50 -0
- data/lib/fog/compute/packet/models/email_verification.rb +18 -0
- data/lib/fog/compute/packet/models/emails.rb +17 -0
- data/lib/fog/compute/packet/models/event.rb +23 -0
- data/lib/fog/compute/packet/models/events.rb +17 -0
- data/lib/fog/compute/packet/models/facilities.rb +17 -0
- data/lib/fog/compute/packet/models/facility.rb +22 -0
- data/lib/fog/compute/packet/models/hardware_reservation.rb +66 -0
- data/lib/fog/compute/packet/models/hardware_reservations.rb +22 -0
- data/lib/fog/compute/packet/models/invitation.rb +36 -0
- data/lib/fog/compute/packet/models/invitations.rb +22 -0
- data/lib/fog/compute/packet/models/ip.rb +60 -0
- data/lib/fog/compute/packet/models/ips.rb +22 -0
- data/lib/fog/compute/packet/models/license.rb +55 -0
- data/lib/fog/compute/packet/models/licenses.rb +22 -0
- data/lib/fog/compute/packet/models/membership.rb +38 -0
- data/lib/fog/compute/packet/models/memberships.rb +22 -0
- data/lib/fog/compute/packet/models/notification.rb +31 -0
- data/lib/fog/compute/packet/models/notifications.rb +22 -0
- data/lib/fog/compute/packet/models/operating_system.rb +23 -0
- data/lib/fog/compute/packet/models/operating_systems.rb +17 -0
- data/lib/fog/compute/packet/models/organization.rb +71 -0
- data/lib/fog/compute/packet/models/organizations.rb +22 -0
- data/lib/fog/compute/packet/models/payment_method.rb +63 -0
- data/lib/fog/compute/packet/models/payment_methods.rb +22 -0
- data/lib/fog/compute/packet/models/plan.rb +23 -0
- data/lib/fog/compute/packet/models/plans.rb +17 -0
- data/lib/fog/compute/packet/models/project.rb +47 -0
- data/lib/fog/compute/packet/models/projects.rb +22 -0
- data/lib/fog/compute/packet/models/session.rb +22 -0
- data/lib/fog/compute/packet/models/sessions.rb +26 -0
- data/lib/fog/compute/packet/models/snapshot.rb +33 -0
- data/lib/fog/compute/packet/models/snapshots.rb +22 -0
- data/lib/fog/compute/packet/models/spot_market_price.rb +15 -0
- data/lib/fog/compute/packet/models/spot_market_prices.rb +22 -0
- data/lib/fog/compute/packet/models/ssh_key.rb +51 -0
- data/lib/fog/compute/packet/models/ssh_keys.rb +22 -0
- data/lib/fog/compute/packet/models/transfer_request.rb +34 -0
- data/lib/fog/compute/packet/models/transfer_requests.rb +27 -0
- data/lib/fog/compute/packet/models/two_factor_auth.rb +18 -0
- data/lib/fog/compute/packet/models/user.rb +56 -0
- data/lib/fog/compute/packet/models/users.rb +22 -0
- data/lib/fog/compute/packet/models/virtual_network.rb +76 -0
- data/lib/fog/compute/packet/models/virtual_networks.rb +17 -0
- data/lib/fog/compute/packet/models/volume.rb +96 -0
- data/lib/fog/compute/packet/models/volumes.rb +23 -0
- data/lib/fog/compute/packet/models/vpn.rb +16 -0
- data/lib/fog/compute/packet/models/vpns.rb +27 -0
- data/lib/fog/compute/packet/requests/accept_invitation.rb +43 -0
- data/lib/fog/compute/packet/requests/accept_transfer_request.rb +26 -0
- data/lib/fog/compute/packet/requests/assign_ip.rb +32 -0
- data/lib/fog/compute/packet/requests/assign_port.rb +25 -0
- data/lib/fog/compute/packet/requests/attach_volume.rb +41 -0
- data/lib/fog/compute/packet/requests/bond_ports.rb +25 -0
- data/lib/fog/compute/packet/requests/create_batch.rb +43 -0
- data/lib/fog/compute/packet/requests/create_bgp_session.rb +37 -0
- data/lib/fog/compute/packet/requests/create_device.rb +212 -0
- data/lib/fog/compute/packet/requests/create_email.rb +38 -0
- data/lib/fog/compute/packet/requests/create_license.rb +46 -0
- data/lib/fog/compute/packet/requests/create_organization.rb +87 -0
- data/lib/fog/compute/packet/requests/create_payment_method.rb +63 -0
- data/lib/fog/compute/packet/requests/create_project.rb +72 -0
- data/lib/fog/compute/packet/requests/create_snapshot.rb +25 -0
- data/lib/fog/compute/packet/requests/create_ssh_key.rb +44 -0
- data/lib/fog/compute/packet/requests/create_virtual_network.rb +49 -0
- data/lib/fog/compute/packet/requests/create_volume.rb +70 -0
- data/lib/fog/compute/packet/requests/decline_invitation.rb +43 -0
- data/lib/fog/compute/packet/requests/decline_transfer_request.rb +26 -0
- data/lib/fog/compute/packet/requests/delete_bgp_session.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_device.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_email.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_license.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_membership.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_organization.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_payment_method.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_project.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_session.rb +27 -0
- data/lib/fog/compute/packet/requests/delete_snapshot.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_ssh_key.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_virtual_network.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_volume.rb +25 -0
- data/lib/fog/compute/packet/requests/detach_volume.rb +36 -0
- data/lib/fog/compute/packet/requests/disable_two_factor_auth.rb +27 -0
- data/lib/fog/compute/packet/requests/disable_vpn.rb +25 -0
- data/lib/fog/compute/packet/requests/disbond_ports.rb +25 -0
- data/lib/fog/compute/packet/requests/enable_two_factor_auth.rb +26 -0
- data/lib/fog/compute/packet/requests/enable_vpn.rb +25 -0
- data/lib/fog/compute/packet/requests/get_bandwidth.rb +31 -0
- data/lib/fog/compute/packet/requests/get_batch.rb +38 -0
- data/lib/fog/compute/packet/requests/get_bgp_session.rb +37 -0
- data/lib/fog/compute/packet/requests/get_capacity.rb +165 -0
- data/lib/fog/compute/packet/requests/get_device.rb +189 -0
- data/lib/fog/compute/packet/requests/get_email.rb +32 -0
- data/lib/fog/compute/packet/requests/get_hardware_reservation.rb +193 -0
- data/lib/fog/compute/packet/requests/get_invitation.rb +43 -0
- data/lib/fog/compute/packet/requests/get_ip.rb +60 -0
- data/lib/fog/compute/packet/requests/get_license.rb +37 -0
- data/lib/fog/compute/packet/requests/get_membership.rb +40 -0
- data/lib/fog/compute/packet/requests/get_notification.rb +40 -0
- data/lib/fog/compute/packet/requests/get_organization.rb +61 -0
- data/lib/fog/compute/packet/requests/get_payment_method.rb +56 -0
- data/lib/fog/compute/packet/requests/get_project.rb +67 -0
- data/lib/fog/compute/packet/requests/get_ssh_key.rb +38 -0
- data/lib/fog/compute/packet/requests/get_transfer_request.rb +38 -0
- data/lib/fog/compute/packet/requests/get_user.rb +56 -0
- data/lib/fog/compute/packet/requests/get_volume.rb +60 -0
- data/lib/fog/compute/packet/requests/get_vpn.rb +29 -0
- data/lib/fog/compute/packet/requests/list_batches.rb +33 -0
- data/lib/fog/compute/packet/requests/list_bgp_sessions.rb +32 -0
- data/lib/fog/compute/packet/requests/list_devices.rb +33 -0
- data/lib/fog/compute/packet/requests/list_events.rb +33 -0
- data/lib/fog/compute/packet/requests/list_facilities.rb +57 -0
- data/lib/fog/compute/packet/requests/list_hardware_reservations.rb +216 -0
- data/lib/fog/compute/packet/requests/list_invitations.rb +48 -0
- data/lib/fog/compute/packet/requests/list_ips.rb +65 -0
- data/lib/fog/compute/packet/requests/list_licenses.rb +42 -0
- data/lib/fog/compute/packet/requests/list_memberships.rb +45 -0
- data/lib/fog/compute/packet/requests/list_notifications.rb +45 -0
- data/lib/fog/compute/packet/requests/list_operating_systems.rb +66 -0
- data/lib/fog/compute/packet/requests/list_organizations.rb +81 -0
- data/lib/fog/compute/packet/requests/list_payment_methods.rb +76 -0
- data/lib/fog/compute/packet/requests/list_plans.rb +92 -0
- data/lib/fog/compute/packet/requests/list_projects.rb +87 -0
- data/lib/fog/compute/packet/requests/list_sessions.rb +40 -0
- data/lib/fog/compute/packet/requests/list_snapshots.rb +40 -0
- data/lib/fog/compute/packet/requests/list_spotmarketprices.rb +173 -0
- data/lib/fog/compute/packet/requests/list_spotmarketprices_history.rb +42 -0
- data/lib/fog/compute/packet/requests/list_ssh_keys.rb +50 -0
- data/lib/fog/compute/packet/requests/list_transfer_requests.rb +43 -0
- data/lib/fog/compute/packet/requests/list_users.rb +61 -0
- data/lib/fog/compute/packet/requests/list_virtual_networks.rb +62 -0
- data/lib/fog/compute/packet/requests/list_volumes.rb +65 -0
- data/lib/fog/compute/packet/requests/move_hardware_reservation.rb +43 -0
- data/lib/fog/compute/packet/requests/poweroff_device.rb +194 -0
- data/lib/fog/compute/packet/requests/poweron_device.rb +194 -0
- data/lib/fog/compute/packet/requests/reboot_device.rb +194 -0
- data/lib/fog/compute/packet/requests/request_email_verification.rb +25 -0
- data/lib/fog/compute/packet/requests/reserve_ip.rb +37 -0
- data/lib/fog/compute/packet/requests/session_login.rb +25 -0
- data/lib/fog/compute/packet/requests/transfer_project.rb +43 -0
- data/lib/fog/compute/packet/requests/unassign_ip.rb +24 -0
- data/lib/fog/compute/packet/requests/unassign_port.rb +25 -0
- data/lib/fog/compute/packet/requests/update_device.rb +201 -0
- data/lib/fog/compute/packet/requests/update_email.rb +37 -0
- data/lib/fog/compute/packet/requests/update_license.rb +42 -0
- data/lib/fog/compute/packet/requests/update_membership.rb +43 -0
- data/lib/fog/compute/packet/requests/update_notification.rb +40 -0
- data/lib/fog/compute/packet/requests/update_organization.rb +85 -0
- data/lib/fog/compute/packet/requests/update_payment_method.rb +63 -0
- data/lib/fog/compute/packet/requests/update_project.rb +71 -0
- data/lib/fog/compute/packet/requests/update_ssh_key.rb +43 -0
- data/lib/fog/compute/packet/requests/update_user.rb +65 -0
- data/lib/fog/compute/packet/requests/update_volume.rb +66 -0
- data/lib/fog/compute/packet/requests/validate_capacity.rb +38 -0
- data/lib/fog/compute/packet/requests/verify_email.rb +36 -0
- data/tests/packet/models/test_batches.rb +45 -0
- data/tests/packet/models/test_bgp_sessions.rb +52 -0
- data/tests/packet/models/test_capacity.rb +40 -0
- data/tests/packet/models/test_devices.rb +93 -0
- data/tests/packet/models/test_email_verification.rb +25 -0
- data/tests/packet/models/test_emails.rb +45 -0
- data/tests/packet/models/test_facilities.rb +18 -0
- data/tests/packet/models/test_hardware_reservations.rb +38 -0
- data/tests/packet/models/test_invitations.rb +41 -0
- data/tests/packet/models/test_ips.rb +52 -0
- data/tests/packet/models/test_licenses.rb +56 -0
- data/tests/packet/models/test_memberships.rb +41 -0
- data/tests/packet/models/test_notifications.rb +35 -0
- data/tests/packet/models/test_operating_systems.rb +19 -0
- data/tests/packet/models/test_organizations.rb +67 -0
- data/tests/packet/models/test_payment_methods.rb +61 -0
- data/tests/packet/models/test_plans.rb +19 -0
- data/tests/packet/models/test_projects.rb +41 -0
- data/tests/packet/models/test_sessions.rb +34 -0
- data/tests/packet/models/test_snapshots.rb +43 -0
- data/tests/packet/models/test_spotmarketprices.rb +28 -0
- data/tests/packet/models/test_ssh_keys.rb +58 -0
- data/tests/packet/models/test_transfer_requests.rb +49 -0
- data/tests/packet/models/test_two_factor_auth.rb +29 -0
- data/tests/packet/models/test_users.rb +47 -0
- data/tests/packet/models/test_virtual_networks.rb +81 -0
- data/tests/packet/models/test_volumes.rb +70 -0
- data/tests/packet/models/test_vpns.rb +37 -0
- data/tests/packet/requests/test_batches.rb +45 -0
- data/tests/packet/requests/test_bgp_sessions.rb +64 -0
- data/tests/packet/requests/test_capacity.rb +40 -0
- data/tests/packet/requests/test_devices.rb +104 -0
- data/tests/packet/requests/test_email_verification.rb +25 -0
- data/tests/packet/requests/test_emails.rb +51 -0
- data/tests/packet/requests/test_facilities.rb +19 -0
- data/tests/packet/requests/test_hardware_reservations.rb +38 -0
- data/tests/packet/requests/test_invitations.rb +40 -0
- data/tests/packet/requests/test_ips.rb +66 -0
- data/tests/packet/requests/test_licenses.rb +56 -0
- data/tests/packet/requests/test_memberships.rb +43 -0
- data/tests/packet/requests/test_notifications.rb +40 -0
- data/tests/packet/requests/test_operating_systems.rb +19 -0
- data/tests/packet/requests/test_organizations.rb +64 -0
- data/tests/packet/requests/test_payment_methods.rb +60 -0
- data/tests/packet/requests/test_plans.rb +21 -0
- data/tests/packet/requests/test_projects.rb +40 -0
- data/tests/packet/requests/test_sessions.rb +34 -0
- data/tests/packet/requests/test_snapshots.rb +57 -0
- data/tests/packet/requests/test_sportmarketprices.rb +29 -0
- data/tests/packet/requests/test_ssh_keys.rb +60 -0
- data/tests/packet/requests/test_transfer_requests.rb +46 -0
- data/tests/packet/requests/test_two_factor_auth.rb +29 -0
- data/tests/packet/requests/test_users.rb +48 -0
- data/tests/packet/requests/test_virtual_networks.rb +100 -0
- data/tests/packet/requests/test_volumes.rb +95 -0
- data/tests/packet/requests/test_vpns.rb +38 -0
- data/tests/test_helper.rb +4 -0
- 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
|