Module: Boucher::Snapshots

Defined in:
lib/boucher/snapshots.rb

Class Method Summary collapse

Class Method Details

.allObject



22
23
24
# File 'lib/boucher/snapshots.rb', line 22

def self.all
  @snapshots ||= Boucher.compute.snapshots
end

.snap(volume_id) ⇒ Object



30
31
32
33
34
35
# File 'lib/boucher/snapshots.rb', line 30

def self.snap(volume_id)
  description = "Boucher snapshot of #{volume_id} at #{Time.now.strftime("%b %d %Y %H:%M")}"
  snapshot = all.create(:volume_id => volume_id, :description => description)
  snapshot.wait_for { snapshot.state == "completed" }
  snapshot
end

.with_id(snapshot_id) ⇒ Object



26
27
28
# File 'lib/boucher/snapshots.rb', line 26

def self.with_id(snapshot_id)
  all.find { |snapshot| snapshot.id == snapshot_id }
end