class AWS::RDS::DBSnapshotCollection

Public Class Methods

new(options = {}) click to toggle source

@private

Calls superclass method
# File lib/aws/rds/db_snapshot_collection.rb, line 21
def initialize options = {}
  @filters = options[:filters] || {}
  super
end

Public Instance Methods

[](db_snapshot_id) click to toggle source

@param [String] db_snapshot_id @return [DBSnapshot] Returns a {DBSnapshot} with the given ID.

# File lib/aws/rds/db_snapshot_collection.rb, line 28
def [] db_snapshot_id
  DBSnapshot.new(db_snapshot_id, :config => config)
end
db_instance(db_instance) click to toggle source

Filters the DB snapshots to those beloning to a single db instance. You may pass the ID of a db instance or a {DBInstance} object.

@param [String,DBInstance] #db_instance A db instance identifier

string or a {DBInstance} object.

@return [DBSnapshotCollection]

# File lib/aws/rds/db_snapshot_collection.rb, line 40
def db_instance db_instance
  id = db_instance.is_a?(Core::Model) ? db_instance.id : db_instance
  filter(:db_instance_identifier, id.to_s.downcase)
end
filter(name, value) click to toggle source

@param [String,Symbol] name @param [Mixed] value @return [DBSnapshotCollection]

# File lib/aws/rds/db_snapshot_collection.rb, line 56
def filter name, value
  options = {}
  options[:filters] = @filters.merge(name.to_s.to_sym => value)
  options[:config] = config
  DBSnapshotCollection.new(options)
end
type(snapshot_type)
Alias for: with_type
with_type(snapshot_type) click to toggle source

Filters the DB snapshots to those of a given snapshot type. @param [String] snapshot_type @return [DBSnapshotCollection]

# File lib/aws/rds/db_snapshot_collection.rb, line 48
def with_type snapshot_type
  filter(:snapshot_type, snapshot_type)
end
Also aliased as: type

Protected Instance Methods

_each_item(marker, max_records, options = {}) { |db_snapshot| ... } click to toggle source
# File lib/aws/rds/db_snapshot_collection.rb, line 65
def _each_item marker, max_records, options = {}, &block

  options = @filters.merge(options)
  options[:marker] = marker if marker
  options[:max_records] = [[20,max_records].max,100].min if max_records

  response = client.describe_db_snapshots(options)
  response.data[:db_snapshots].each do |details|

    db_snapshot = DBSnapshot.new_from(
        :describe_db_snapshots,
        details,
        details[:db_snapshot_identifier],
        :config => config)

    yield(db_snapshot)

  end

  response.data[:marker]
end