Sha256: e41140f43fddc422600850204ead44150a1556b6ba1ceb435d9832d1e6af1d52

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

require 'aws-sdk'

Aws.use_bundled_cert!

module AwsLogCleaner

  # wrapper for aws credentials
  class AwsCredentials

    attr_reader :credentials, :region

    def initialize(access_key = nil, secret = nil, region = nil)
      key_id = access_key || ENV['AWS_ACCESS_KEY_ID']
      secret = secret || ENV['AWS_SECRET_ACCESS_KEY']
      @region = region || ENV['AWS_DEFAULT_REGION']

      @credentials =
        if key_id.nil? && secret.nil?
          Aws::SharedCredentials.new
        else
          Aws::Credentials.new(key_id, secret)
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aws_log_cleaner-0.1.4 lib/aws_log_cleaner/aws_credentials.rb
aws_log_cleaner-0.1.3 lib/aws_log_cleaner/aws_credentials.rb