class Elasticsnap::EbsSnapshot

Attributes

cluster_name[RW]
security_group[RW]

Public Class Methods

new(security_group: nil, cluster_name: nil) click to toggle source
# File lib/elasticsnap/ebs_snapshot.rb, line 10
def initialize(security_group: nil, cluster_name: nil)
  raise ArgumentError, 'security_group required' if security_group.nil?
  @security_group = security_group
  @cluster_name = cluster_name
end

Public Instance Methods

snapshot() click to toggle source
# File lib/elasticsnap/ebs_snapshot.rb, line 16
def snapshot
  SecurityGroup.new(name: security_group).volumes(cluster_name: cluster_name).map do |volume|
    snapshot = volume.snapshot("Created by Elasticsnap from #{volume.id}")
    snapshot = wrap_snapshot(snapshot)
    snapshot.add_volume_tags(volume)
  end
end
wrap_snapshot(snapshot) click to toggle source
# File lib/elasticsnap/ebs_snapshot.rb, line 24
def wrap_snapshot(snapshot)
  snapshot = Fog::Compute::AWS::Snapshot.new(snapshot.body)
  snapshot.send(:extend, SnapshotVolumeTags)
  snapshot
end