lib/awskeyring/awsapi.rb in awskeyring-0.10.0 vs lib/awskeyring/awsapi.rb in awskeyring-1.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'aws-sdk-iam'
require 'cgi'
require 'json'
# Awskeyring Module,
@@ -16,11 +18,11 @@
Effect: 'Allow'
}]
}.to_json.freeze
# AWS Signin url
- AWS_SIGNIN_URL = 'https://signin.aws.amazon.com/federation'.freeze
+ AWS_SIGNIN_URL = 'https://signin.aws.amazon.com/federation'
# AWS Env vars
AWS_ENV_VARS = %w[
AWS_ACCESS_KEY_ID
AWS_ACCESS_KEY
@@ -147,12 +149,12 @@
def self.verify_cred(key:, secret:)
begin
ENV['AWS_DEFAULT_REGION'] = 'us-east-1' unless region
sts = Aws::STS::Client.new(access_key_id: key, secret_access_key: secret)
sts.get_caller_identity
- rescue Aws::Errors::ServiceError => err
- warn err.to_s
+ rescue Aws::Errors::ServiceError => e
+ warn e.to_s
exit 1
end
true
end
@@ -255,16 +257,16 @@
# @param [Block] block the block to retry.
def self.retry_backoff(&block)
retries ||= 1
begin
yield block
- rescue Aws::IAM::Errors::InvalidClientTokenId => err
+ rescue Aws::IAM::Errors::InvalidClientTokenId => e
if retries < 4
sleep 2**retries
retries += 1
retry
end
- warn err.message
+ warn e.message
exit 1
end
end
end
end