module RubyAemAws::CloudwatchClient

Mixin for checking that an instance has associated CloudWatch metrics.

Public Instance Methods

get_alarm(alarm_name) click to toggle source

@param alarm_name Cloudwatch alarm name @return Cloudwatch client describe_alarms response

# File lib/ruby_aem_aws/client/cloudwatch.rb, line 20
def get_alarm(alarm_name)
  alarm_filter = filter_for_cloudwatch_alarm(alarm_name)

  response = cloud_watch_client.describe_alarms(alarm_filter)

  until response.next_token.nil?
    next_token = { next_token: response.next_token }
    filter.update(next_token)
    response = cloud_watch_client.describe_alarms(alarm_filter)
  end

  response
end
get_log_event(loggroup_name, log_stream_name, log_message) click to toggle source

@param loggroup_name Cloudwatch loggroup name @param log_stream_name Cloudwatch log stream name @param log_message Log message to filter for @return Cloudwatch log client filter_log_events response

# File lib/ruby_aem_aws/client/cloudwatch.rb, line 38
def get_log_event(loggroup_name, log_stream_name, log_message)
  filter = filter_for_cloudwatch_log_event(loggroup_name, log_stream_name, log_message)
  response = cloud_watch_log_client.filter_log_events(filter)

  until response.next_token.nil?
    next_token = { next_token: response.next_token }
    filter.update(next_token)
    response = cloud_watch_client.filter_log_events(filter)
  end

  response
end
get_log_streams(loggroup_name, log_stream_name) click to toggle source

@param loggroup_name Cloudwatch loggroup name @param log_stream_name Cloudwatch log stream name @return Cloudwatch log client describe_log_streams response

# File lib/ruby_aem_aws/client/cloudwatch.rb, line 54
def get_log_streams(loggroup_name, log_stream_name)
  filter = filter_for_cloudwatch_log_stream(loggroup_name, log_stream_name)

  response = cloud_watch_log_client.describe_log_streams(filter)

  until response.next_token.nil?
    next_token = { next_token: response.next_token }
    filter.update(next_token)
    response = cloud_watch_client.describe_log_streams(filter)
  end

  response
end
get_metrics(namespace, metric_name, dimension) click to toggle source

@param namespace Cloudwatch namespace name @param metric_name Cloudwatch metric name @param dimension Cloudwatch dimension filter @return Cloudwatch client list_metrics response

# File lib/ruby_aem_aws/client/cloudwatch.rb, line 72
def get_metrics(namespace, metric_name, dimension)
  filter = filter_for_cloudwatch_metric(namespace, metric_name)
  filter.update(dimension)

  response = cloud_watch_client.list_metrics(filter)

  until response.next_token.nil?
    next_token = { next_token: response.next_token }
    filter.update(next_token)
    response = cloud_watch_client.list_metrics(filter)
  end

  response
end