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,35 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Packet
|
4
|
+
# BgpSession Model
|
5
|
+
class BgpSession < Fog::Model
|
6
|
+
identity :id
|
7
|
+
|
8
|
+
attribute :status
|
9
|
+
attribute :learned_routes
|
10
|
+
attribute :switch_name
|
11
|
+
attribute :created_at
|
12
|
+
attribute :device
|
13
|
+
attribute :address_family
|
14
|
+
attribute :href
|
15
|
+
attribute :device_id
|
16
|
+
|
17
|
+
def initialize(attributes = {})
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def save
|
22
|
+
requires :device_id, :address_family
|
23
|
+
response = service.create_bgp_session(device_id, address_family)
|
24
|
+
merge_attributes(response.body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def destroy
|
28
|
+
requires :id
|
29
|
+
response = service.delete_bgp_session(id)
|
30
|
+
true if response.status == 204
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative "bgp_session"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Packet
|
6
|
+
# BgpSessions Collection
|
7
|
+
class BgpSessions < Fog::Collection
|
8
|
+
model Fog::Compute::Packet::BgpSession
|
9
|
+
|
10
|
+
def all(device_id)
|
11
|
+
response = service.list_bgp_sessions(device_id)
|
12
|
+
load(response.body["bgp_sessions"])
|
13
|
+
end
|
14
|
+
|
15
|
+
def get(id)
|
16
|
+
response = service.get_bgp_session(id)
|
17
|
+
new(response.body)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative "capacity"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Packet
|
6
|
+
# Capacities Collection
|
7
|
+
class Capacities < Fog::Collection
|
8
|
+
model Fog::Compute::Packet::Capacity
|
9
|
+
|
10
|
+
def all
|
11
|
+
response = service.get_capacity
|
12
|
+
new(response.body["capacity"])
|
13
|
+
end
|
14
|
+
|
15
|
+
def get(id)
|
16
|
+
response = service.get_device(id)
|
17
|
+
new(response.body)
|
18
|
+
end
|
19
|
+
|
20
|
+
def validate(options)
|
21
|
+
response = service.validate_capacity(options)
|
22
|
+
true if response.status == 204
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Packet
|
4
|
+
# Capacity Model
|
5
|
+
class Capacity < Fog::Model
|
6
|
+
attribute :ams1
|
7
|
+
attribute :atl1
|
8
|
+
attribute :dfw1
|
9
|
+
attribute :ewr1
|
10
|
+
attribute :fra1
|
11
|
+
attribute :hkg1
|
12
|
+
attribute :iad1
|
13
|
+
attribute :lax1
|
14
|
+
attribute :nrt1
|
15
|
+
attribute :ord1
|
16
|
+
attribute :sea1
|
17
|
+
attribute :sin1
|
18
|
+
attribute :sjc1
|
19
|
+
attribute :hkg1
|
20
|
+
attribute :syd1
|
21
|
+
attribute :yyz1
|
22
|
+
|
23
|
+
def initialize(attributes = {})
|
24
|
+
super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Packet
|
4
|
+
# Device Model
|
5
|
+
class Device < Fog::Model
|
6
|
+
identity :id
|
7
|
+
|
8
|
+
attribute :short_id
|
9
|
+
attribute :hostname
|
10
|
+
attribute :plan
|
11
|
+
attribute :facility
|
12
|
+
attribute :operating_system
|
13
|
+
attribute :billing_cycle
|
14
|
+
attribute :project_id
|
15
|
+
attribute :userdata
|
16
|
+
attribute :storage
|
17
|
+
attribute :ipxe_script_url
|
18
|
+
attribute :public_ipv4_subnet_size
|
19
|
+
attribute :always_pxe
|
20
|
+
attribute :hardware_reservation_id
|
21
|
+
attribute :spot_instance
|
22
|
+
attribute :spot_price_max
|
23
|
+
attribute :termination_time
|
24
|
+
attribute :description
|
25
|
+
attribute :name
|
26
|
+
attribute :href
|
27
|
+
attribute :state
|
28
|
+
attribute :created_at
|
29
|
+
attribute :updated_at
|
30
|
+
attribute :locked
|
31
|
+
attribute :tags
|
32
|
+
attribute :ip_addresses
|
33
|
+
attribute :volumes
|
34
|
+
attribute :project
|
35
|
+
attribute :provisioning_events
|
36
|
+
attribute :provisioning_percentage
|
37
|
+
attribute :root_password
|
38
|
+
attribute :hardware_reservation
|
39
|
+
attribute :project_ssh_keys
|
40
|
+
attribute :network_ports
|
41
|
+
attribute :user_ssh_keys
|
42
|
+
attribute :features
|
43
|
+
|
44
|
+
def initialize(attributes = {})
|
45
|
+
super
|
46
|
+
end
|
47
|
+
|
48
|
+
def save
|
49
|
+
requires :project_id, :facility, :plan, :hostname, :operating_system
|
50
|
+
|
51
|
+
options = {}
|
52
|
+
options[:plan] = plan
|
53
|
+
options[:facility] = facility
|
54
|
+
options[:hostname] = hostname
|
55
|
+
options[:operating_system] = operating_system
|
56
|
+
|
57
|
+
options[:description] = description if description
|
58
|
+
options[:billing_cycle] = billing_cycle if billing_cycle
|
59
|
+
options[:always_pxe] = always_pxe if always_pxe
|
60
|
+
options[:ipxe_script_url] = ipxe_script_url if ipxe_script_url
|
61
|
+
options[:userdata] = userdata if userdata
|
62
|
+
options[:locked] = locked if locked
|
63
|
+
options[:hardware_reservation_id] = hardware_reservation_id if hardware_reservation_id
|
64
|
+
options[:spot_instance] = spot_instance if spot_instance
|
65
|
+
options[:spot_price_max] = spot_price_max if spot_price_max
|
66
|
+
options[:termination_time] = termination_time if termination_time
|
67
|
+
options[:tags] = tags if tags
|
68
|
+
options[:project_ssh_keys] = project_ssh_keys if project_ssh_keys
|
69
|
+
options[:user_ssh_keys] = user_ssh_keys if user_ssh_keys
|
70
|
+
options[:features] = features if features
|
71
|
+
|
72
|
+
response = service.create_device(project_id, options)
|
73
|
+
merge_attributes(response.body)
|
74
|
+
end
|
75
|
+
|
76
|
+
def update
|
77
|
+
requires :id
|
78
|
+
|
79
|
+
options = {}
|
80
|
+
options[:hostname] = hostname if hostname
|
81
|
+
options[:description] = description if description
|
82
|
+
options[:billing_cycle] = billing_cycle if billing_cycle
|
83
|
+
options[:userdata] = userdata if userdata
|
84
|
+
options[:locked] = locked if locked
|
85
|
+
options[:tags] = tags if tags
|
86
|
+
options[:always_pxe] = always_pxe if always_pxe
|
87
|
+
options[:ipxe_script_url] = ipxe_script_url if ipxe_script_url
|
88
|
+
options[:spot_instance] = spot_instance if spot_instance
|
89
|
+
|
90
|
+
response = service.update_device(id, options)
|
91
|
+
merge_attributes(response.body)
|
92
|
+
end
|
93
|
+
|
94
|
+
def reboot
|
95
|
+
requires :id
|
96
|
+
response = service.reboot_device(id)
|
97
|
+
true if response.status == 202
|
98
|
+
end
|
99
|
+
|
100
|
+
def start
|
101
|
+
requires :id
|
102
|
+
response = service.poweron_device(id)
|
103
|
+
true if response.status == 202
|
104
|
+
end
|
105
|
+
|
106
|
+
def stop
|
107
|
+
requires :id
|
108
|
+
response = service.poweroff_device(id)
|
109
|
+
true if response.status == 202
|
110
|
+
end
|
111
|
+
|
112
|
+
def destroy
|
113
|
+
requires :id
|
114
|
+
|
115
|
+
response = service.delete_device(id)
|
116
|
+
true if response.status == 204
|
117
|
+
end
|
118
|
+
|
119
|
+
def reload
|
120
|
+
requires :id
|
121
|
+
response = service.get_device(id)
|
122
|
+
return unless response.body
|
123
|
+
merge_attributes(response.body)
|
124
|
+
end
|
125
|
+
|
126
|
+
def ready?
|
127
|
+
state == "active"
|
128
|
+
end
|
129
|
+
|
130
|
+
def inactive?
|
131
|
+
state == "inactive"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative "device"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Packet
|
6
|
+
# Devices Collection
|
7
|
+
class Devices < Fog::Collection
|
8
|
+
model Fog::Compute::Packet::Device
|
9
|
+
|
10
|
+
def all(project_id, params = {})
|
11
|
+
response = service.list_devices(project_id, params)
|
12
|
+
load(response.body["devices"])
|
13
|
+
end
|
14
|
+
|
15
|
+
def get(id)
|
16
|
+
response = service.get_device(id)
|
17
|
+
new(response.body)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Packet
|
4
|
+
# Email
|
5
|
+
class Email < Fog::Model
|
6
|
+
identity :id
|
7
|
+
|
8
|
+
attribute :address
|
9
|
+
attribute :default
|
10
|
+
attribute :href
|
11
|
+
|
12
|
+
attr_accessor :options
|
13
|
+
|
14
|
+
def initialize(attributes = {})
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def save
|
19
|
+
requires :address
|
20
|
+
|
21
|
+
options = {}
|
22
|
+
options[:address] = address
|
23
|
+
options[:default] = default
|
24
|
+
|
25
|
+
response = service.create_email(options)
|
26
|
+
merge_attributes(response.body)
|
27
|
+
end
|
28
|
+
|
29
|
+
def update
|
30
|
+
requires :id
|
31
|
+
|
32
|
+
options = {}
|
33
|
+
options[:address] = address
|
34
|
+
options[:default] = default
|
35
|
+
|
36
|
+
response = service.update_email(id, options)
|
37
|
+
|
38
|
+
merge_attributes(response.body)
|
39
|
+
end
|
40
|
+
|
41
|
+
def destroy
|
42
|
+
requires :id
|
43
|
+
|
44
|
+
response = service.delete_email(id)
|
45
|
+
true if response.status == 204
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Packet
|
4
|
+
# EmailVerification Collection
|
5
|
+
class EmailVerification < Fog::Collection
|
6
|
+
def request(email)
|
7
|
+
response = service.request_email_verification(email)
|
8
|
+
true if response.status == 201
|
9
|
+
end
|
10
|
+
|
11
|
+
def verify(token)
|
12
|
+
response = service.verify_email(token)
|
13
|
+
true if response.status == 200
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative "email"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Packet
|
6
|
+
# Projects Collection
|
7
|
+
class Emails < Fog::Collection
|
8
|
+
model Fog::Compute::Packet::Email
|
9
|
+
|
10
|
+
def get(id)
|
11
|
+
response = service.get_email(id)
|
12
|
+
new(response.body)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Packet
|
4
|
+
# Event Model
|
5
|
+
class Event < Fog::Model
|
6
|
+
identity :id
|
7
|
+
|
8
|
+
attribute :error_messages
|
9
|
+
attribute :state
|
10
|
+
attribute :type
|
11
|
+
attribute :body
|
12
|
+
attribute :relationships
|
13
|
+
attribute :interpolated
|
14
|
+
attribute :href
|
15
|
+
attribute :created_at
|
16
|
+
|
17
|
+
def initialize(attributes = {})
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative "event"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Packet
|
6
|
+
# Events Collection
|
7
|
+
class Events < Fog::Collection
|
8
|
+
model Fog::Compute::Packet::Event
|
9
|
+
|
10
|
+
def all(device_id, params = {})
|
11
|
+
response = service.list_events(device_id, params)
|
12
|
+
load(response.body["events"])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative "facility"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Packet
|
6
|
+
# Facilities Collection
|
7
|
+
class Facilities < Fog::Collection
|
8
|
+
model Fog::Compute::Packet::Facility
|
9
|
+
|
10
|
+
def all
|
11
|
+
response = service.list_facilities
|
12
|
+
load(response.body["facilities"])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Packet
|
4
|
+
# Facility Model
|
5
|
+
class Facility < Fog::Model
|
6
|
+
identity :id
|
7
|
+
|
8
|
+
attribute :name
|
9
|
+
attribute :code
|
10
|
+
attribute :features
|
11
|
+
attribute :address
|
12
|
+
attribute :ip_ranges
|
13
|
+
|
14
|
+
attr_accessor :options
|
15
|
+
|
16
|
+
def initialize(attributes = {})
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|