class Fog::Compute::Packet::Device
Device
Model
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
# File lib/fog/compute/packet/models/device.rb, line 44 def initialize(attributes = {}) super end
Public Instance Methods
destroy()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 112 def destroy requires :id response = service.delete_device(id) true if response.status == 204 end
inactive?()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 130 def inactive? state == "inactive" end
ready?()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 126 def ready? state == "active" end
reboot()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 94 def reboot requires :id response = service.reboot_device(id) true if response.status == 202 end
reload()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 119 def reload requires :id response = service.get_device(id) return unless response.body merge_attributes(response.body) end
save()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 48 def save requires :project_id, :facility, :plan, :hostname, :operating_system options = {} options[:plan] = plan options[:facility] = facility options[:hostname] = hostname options[:operating_system] = operating_system options[:description] = description if description options[:billing_cycle] = billing_cycle if billing_cycle options[:always_pxe] = always_pxe if always_pxe options[:ipxe_script_url] = ipxe_script_url if ipxe_script_url options[:userdata] = userdata if userdata options[:locked] = locked if locked options[:hardware_reservation_id] = hardware_reservation_id if hardware_reservation_id options[:spot_instance] = spot_instance if spot_instance options[:spot_price_max] = spot_price_max if spot_price_max options[:termination_time] = termination_time if termination_time options[:tags] = tags if tags options[:project_ssh_keys] = project_ssh_keys if project_ssh_keys options[:user_ssh_keys] = user_ssh_keys if user_ssh_keys options[:features] = features if features response = service.create_device(project_id, options) merge_attributes(response.body) end
start()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 100 def start requires :id response = service.poweron_device(id) true if response.status == 202 end
stop()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 106 def stop requires :id response = service.poweroff_device(id) true if response.status == 202 end
update()
click to toggle source
# File lib/fog/compute/packet/models/device.rb, line 76 def update requires :id options = {} options[:hostname] = hostname if hostname options[:description] = description if description options[:billing_cycle] = billing_cycle if billing_cycle options[:userdata] = userdata if userdata options[:locked] = locked if locked options[:tags] = tags if tags options[:always_pxe] = always_pxe if always_pxe options[:ipxe_script_url] = ipxe_script_url if ipxe_script_url options[:spot_instance] = spot_instance if spot_instance response = service.update_device(id, options) merge_attributes(response.body) end