class AWS::CloudWatch::AlarmHistoryItemCollection

Public Class Methods

new(options = {}) click to toggle source

@private

# File lib/aws/cloud_watch/alarm_history_item_collection.rb, line 24
def initialize options = {}
  @filters = options[:filters] || {}
  super
end

Public Instance Methods

filter(name, value) click to toggle source

@param [String,Symbol] name @param [String] value @return [AlarmHistoryItemCollection]

# File lib/aws/cloud_watch/alarm_history_item_collection.rb, line 32
def filter name, value
  filters = @filters.merge(name.to_s.to_sym => value)
  AlarmHistoryItemCollection.new(:filters => filters, :config => config)
end
with_alarm_name(name) click to toggle source

@param [String] name @return [AlarmHistoryItemCollection]

# File lib/aws/cloud_watch/alarm_history_item_collection.rb, line 39
def with_alarm_name name
  filter(:alarm_name, name)
end
with_end_date(date) click to toggle source

@param [Time,DateTime,String<ISO8601>] date @return [AlarmHistoryItemCollection]

# File lib/aws/cloud_watch/alarm_history_item_collection.rb, line 52
def with_end_date date
  date = date.iso8601 if date.respond_to?(:iso8601)
  filter(:end_date, date)
end
with_start_date(date) click to toggle source

@param [Time,DateTime,String<ISO8601>] date @return [AlarmHistoryItemCollection]

# File lib/aws/cloud_watch/alarm_history_item_collection.rb, line 45
def with_start_date date
  date = date.iso8601 if date.respond_to?(:iso8601)
  filter(:start_date, date)
end
with_type(type) click to toggle source

@param [String] type @return [AlarmHistoryItemCollection]

# File lib/aws/cloud_watch/alarm_history_item_collection.rb, line 59
def with_type type
  filter(:history_item_type, type)
end

Protected Instance Methods

_each_item(next_token, limit, options = {}) { |alarm_history_item| ... } click to toggle source
# File lib/aws/cloud_watch/alarm_history_item_collection.rb, line 65
def _each_item next_token, limit, options = {}, &block
  
  options = @filters.merge(options)
  options[:max_records] = limit if limit
  options[:next_token] = next_token if next_token

  resp = client.describe_alarm_history(options)
  resp.data[:alarm_history_items].each do |details|
    
    yield(AlarmHistoryItem.new(details))

  end

 resp.data[:next_token]

end