Sha256: 95ee74cfdec412d233503580d7983017a2fcced233e1454f9142d0118e7d8ced

Contents?: true

Size: 880 Bytes

Versions: 41

Compression:

Stored size: 880 Bytes

Contents

#
# DESCRIPTION:
#   Common helper methods
#
# DEPENDENCIES:
#   gem: aws-sdk
#   gem: sensu-plugin
#
# USAGE:
#
# NOTES:
#
# LICENSE:
#   Shane Starcher <shane.starcher@gmail.com>
#   Released under the same terms as Sensu (the MIT license); see LICENSE
#   for details.
#

module Common
  def initialize(argv = ARGV)
    super(argv)
    aws_config
  end

  def aws_config
    Aws.config[:credentials] = Aws::Credentials.new(config[:aws_access_key], config[:aws_secret_access_key]) if config[:aws_access_key] && config[:aws_secret_access_key]

    # the cop can't figure out whether it should be a single guard or
    # a multiple line if. Due to poor detection in this case we left as
    # is an opted to disable and keep existing.
    Aws.config.update( # rubocop:disable Style/MultilineIfModifier
      region: config[:aws_region]
    ) if config.key?(:aws_region)
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
sensu-plugins-aws-18.6.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-boutetnico-1.4.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-boutetnico-1.3.4 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-boutetnico-1.2.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-boutetnico-1.1.1 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-boutetnico-1.0.6 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-18.5.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-18.4.2 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-18.4.1 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-18.4.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-18.3.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-18.2.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-18.1.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-18.0.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-17.2.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-17.1.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-17.0.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-16.2.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-16.1.0 lib/sensu-plugins-aws/common.rb
sensu-plugins-aws-16.0.0 lib/sensu-plugins-aws/common.rb