Module: RubyAemAws::SnapshotVerifier

Overview

Mixin for checking snapshots of a component via EC2 client Add this to a component to make it capable of determining its own snapshots.

Instance Method Summary collapse

Instance Method Details

#snapshot?(snapshot_id) ⇒ Boolean

Returns true if snapshot exists, nil if no snapshot exists.

Parameters:

  • snapshot_id

    AWS Snapshot ID

Returns:

  • (Boolean)

    true if snapshot exists, nil if no snapshot exists



21
22
23
# File 'lib/ruby_aem_aws/mixins/snapshot_verifier.rb', line 21

def snapshot?(snapshot_id)
  return true unless get_snapshot_by_id(snapshot_id).nil?
end

#snapshots?(snapshot_type) ⇒ Boolean

Returns true if snapshots exist, false is no snapshots exist.

Parameters:

  • snapshot_type

    AEM snapshot type

Returns:

  • (Boolean)

    true if snapshots exist, false is no snapshots exist



27
28
29
30
31
32
33
34
35
# File 'lib/ruby_aem_aws/mixins/snapshot_verifier.rb', line 27

def snapshots?(snapshot_type)
  has_snapshot = false
  get_snapshots_by_type(snapshot_type).each do |s|
    next if s.nil?

    has_snapshot = true
  end
  has_snapshot
end