Class: Elasticsnap::EbsSnapshot
- Inherits:
-
Object
- Object
- Elasticsnap::EbsSnapshot
- Defined in:
- lib/elasticsnap/ebs_snapshot.rb
Instance Attribute Summary collapse
-
#cluster_name ⇒ Object
Returns the value of attribute cluster_name.
-
#security_group ⇒ Object
Returns the value of attribute security_group.
Instance Method Summary collapse
-
#initialize(security_group: nil, cluster_name: nil) ⇒ EbsSnapshot
constructor
A new instance of EbsSnapshot.
- #snapshot ⇒ Object
- #wrap_snapshot(snapshot) ⇒ Object
Constructor Details
#initialize(security_group: nil, cluster_name: nil) ⇒ EbsSnapshot
Returns a new instance of EbsSnapshot.
10 11 12 13 14 |
# 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 |
Instance Attribute Details
#cluster_name ⇒ Object
Returns the value of attribute cluster_name.
8 9 10 |
# File 'lib/elasticsnap/ebs_snapshot.rb', line 8 def cluster_name @cluster_name end |
#security_group ⇒ Object
Returns the value of attribute security_group.
7 8 9 |
# File 'lib/elasticsnap/ebs_snapshot.rb', line 7 def security_group @security_group end |
Instance Method Details
#snapshot ⇒ Object
16 17 18 19 20 21 22 |
# 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.(volume) end end |
#wrap_snapshot(snapshot) ⇒ Object
24 25 26 27 28 |
# 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 |