Class: Fog::Compute::Joyent::Snapshots

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/joyent/models/compute/snapshots.rb

Instance Method Summary collapse

Instance Method Details

#all(machine_id) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/fog/joyent/models/compute/snapshots.rb', line 15

def all(machine_id)
  data = service.list_machine_snapshots(machine_id).body.map do |m|
    m["machine_id"] = machine_id
    m
  end
  load(data)
end

#create(machine_id, snapshot_name) ⇒ Object



9
10
11
12
13
# File 'lib/fog/joyent/models/compute/snapshots.rb', line 9

def create(machine_id, snapshot_name)
  data = self.service.create_machine_snapshot(machine_id, snapshot_name).body
  data['machine_id'] = machine_id
  new(data)
end

#get(machine_id, snapshot_name) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/fog/joyent/models/compute/snapshots.rb', line 23

def get(machine_id, snapshot_name)
  data = service.get_machine_snapshot(machine_id, snapshot_name).body
  if data
    data["machine_id"] = machine_id
    new(data)
  else
    nil
  end
end