Class: Joyent::Machine

Inherits:
Object
  • Object
show all
Defined in:
lib/joyent/machine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#createdObject (readonly)

Returns the value of attribute created.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def created
  @created
end

#datasetObject (readonly)

Returns the value of attribute dataset.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def dataset
  @dataset
end

#diskObject (readonly)

Returns the value of attribute disk.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def disk
  @disk
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def id
  @id
end

#ipsObject (readonly)

Returns the value of attribute ips.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def ips
  @ips
end

#memoryObject (readonly)

Returns the value of attribute memory.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def memory
  @memory
end

#metadataObject (readonly)

Returns the value of attribute metadata.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def 
  @metadata
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def name
  @name
end

#stateObject (readonly)

Returns the value of attribute state.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def state
  @state
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def type
  @type
end

#updatedObject (readonly)

Returns the value of attribute updated.



3
4
5
# File 'lib/joyent/machine.rb', line 3

def updated
  @updated
end

Instance Method Details

#deleteObject



37
38
39
# File 'lib/joyent/machine.rb', line 37

def delete
  @connection.execute(:delete, "/machines/#{self.id}")
end

#rebootObject



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

#startObject



25
26
27
# File 'lib/joyent/machine.rb', line 25

def start
  @connection.execute(:post, "/machines/#{self.id}", {"action" => "start"})
end

#stopObject



21
22
23
# File 'lib/joyent/machine.rb', line 21

def stop
  @connection.execute(:post, "/machines/#{self.id}", {"action" => "stop"})
end