1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

allow setting region

This is supported since february 2015:

https://blogs.aws.amazon.com/security/post/Tx3CYWU11LY2GLB/AWS-Security-Token-Service-Is-Now-Available-in-Every-AWS-Region
This commit is contained in:
Frederick Cheung 2015-09-29 10:11:23 +01:00
parent fdf71a9ed1
commit 440f62a499

View file

@ -7,7 +7,7 @@ module Fog
class ValidationError < Fog::AWS::STS::Error; end
class AwsAccessKeysMissing < Fog::AWS::STS::Error; end
recognizes :aws_access_key_id, :aws_secret_access_key, :host, :path, :port, :scheme, :persistent, :aws_session_token, :use_iam_profile, :aws_credentials_expire_at, :instrumentor, :instrumentor_name
recognizes :region, :aws_access_key_id, :aws_secret_access_key, :host, :path, :port, :scheme, :persistent, :aws_session_token, :use_iam_profile, :aws_credentials_expire_at, :instrumentor, :instrumentor_name
request_path 'fog/aws/requests/sts'
request :get_federation_token
@ -79,7 +79,8 @@ module Fog
@instrumentor_name = options[:instrumentor_name] || 'fog.aws.sts'
@connection_options = options[:connection_options] || {}
@host = options[:host] || 'sts.amazonaws.com'
@region = options[:region] || 'us-east-1'
@host = options[:host] || "sts.#{@region}.amazonaws.com"
@path = options[:path] || '/'
@persistent = options[:persistent] || false
@port = options[:port] || 443
@ -100,7 +101,7 @@ module Fog
@aws_credentials_expire_at = options[:aws_credentials_expire_at]
if (@aws_access_key_id && @aws_secret_access_key)
@signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key, 'us-east-1', 'sts')
@signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key, @region, 'sts')
end
end