Sha256: feda26b9a0c748215cea091fb6402916198030122c0648be241c73e2a255443c

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 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

1 entries across 1 versions & 1 rubygems

Version Path
aws_log_cleaner-0.1.5 lib/aws_log_cleaner/aws_credentials.rb