bin/check-rds-events.rb in sensu-plugins-aws-3.2.1 vs bin/check-rds-events.rb in sensu-plugins-aws-4.0.0

- old
+ new

@@ -39,11 +39,11 @@ # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require 'sensu-plugin/check/cli' -require 'aws-sdk-v1' +require 'aws-sdk' class CheckRDSEvents < Sensu::Plugin::Check::CLI option :aws_access_key, short: '-a AWS_ACCESS_KEY', long: '--aws-access-key AWS_ACCESS_KEY', @@ -72,14 +72,11 @@ secret_access_key: config[:aws_secret_access_key], region: config[:aws_region] } end def rds_regions - # This is for SDK v2 - # Aws.partition('aws').regions.map(&:name) - - AWS::RDS.regions.map(&:name) + Aws.partition('aws').regions.map(&:name) end def run clusters = maint_clusters if clusters.empty? @@ -100,10 +97,10 @@ critical 'Invalid region specified!' end end aws_regions.each do |r| - rds = AWS::RDS::Client.new aws_config.merge!(region: r) + rds = Aws::RDS::Client.new aws_config.merge!(region: r) begin if !config[:db_instance_id].nil? && !config[:db_instance_id].empty? db_instance = rds.describe_db_instances(db_instance_identifier: config[:db_instance_id]) if db_instance.nil? || db_instance.empty?