Class: Joyent::Machine
- Inherits:
-
Object
- Object
- Joyent::Machine
- Defined in:
- lib/joyent/machine.rb
Instance Attribute Summary collapse
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#dataset ⇒ Object
readonly
Returns the value of attribute dataset.
-
#disk ⇒ Object
readonly
Returns the value of attribute disk.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#ips ⇒ Object
readonly
Returns the value of attribute ips.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(connection, attributes) ⇒ Machine
constructor
A new instance of Machine.
- #reboot ⇒ Object
- #resize(package) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(connection, attributes) ⇒ Machine
Returns a new instance of Machine.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/joyent/machine.rb', line 5 def initialize(connection, attributes) @connection = connection @id = attributes["id"] @name = attributes["name"] @type = attributes["type"] @state = attributes["state"] @dataset = attributes["dataset"] @memory = attributes["memory"] @disk = attributes["disk"] @ips = attributes["ips"] @metadata = attributes["metadata"] @created = attributes["created"] @updated = attributes["updated"] end |
Instance Attribute Details
#created ⇒ Object (readonly)
Returns the value of attribute created.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def created @created end |
#dataset ⇒ Object (readonly)
Returns the value of attribute dataset.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def dataset @dataset end |
#disk ⇒ Object (readonly)
Returns the value of attribute disk.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def disk @disk end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def id @id end |
#ips ⇒ Object (readonly)
Returns the value of attribute ips.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def ips @ips end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def memory @memory end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def @metadata end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def name @name end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def state @state end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def type @type end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
3 4 5 |
# File 'lib/joyent/machine.rb', line 3 def updated @updated end |
Instance Method Details
#delete ⇒ Object
37 38 39 |
# File 'lib/joyent/machine.rb', line 37 def delete @connection.execute(:delete, "/machines/#{self.id}") end |
#reboot ⇒ Object
29 30 31 |
# File 'lib/joyent/machine.rb', line 29 def reboot @connection.execute(:post, "/machines/#{self.id}", {"action" => "reboot"}) end |
#resize(package) ⇒ Object
33 34 35 |
# File 'lib/joyent/machine.rb', line 33 def resize(package) @connection.execute(:post, "/machines/#{self.id}", {"action" => "resize", "package" => package}) end |
#start ⇒ Object
25 26 27 |
# File 'lib/joyent/machine.rb', line 25 def start @connection.execute(:post, "/machines/#{self.id}", {"action" => "start"}) end |
#stop ⇒ Object
21 22 23 |
# File 'lib/joyent/machine.rb', line 21 def stop @connection.execute(:post, "/machines/#{self.id}", {"action" => "stop"}) end |