Module: HTTPX::Plugins::AwsSdkAuthentication
- Defined in:
- lib/httpx/plugins/aws_sdk_authentication.rb
Overview
This plugin applies AWS Sigv4 to requests, using the AWS SDK credentials and configuration.
It requires the “aws-sdk-core” gem.
Defined Under Namespace
Modules: InstanceMethods, OptionsMethods
Classes: Configuration, Credentials
Class Method Summary
collapse
Class Method Details
54
55
56
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 54
def configure(klass)
klass.plugin(:aws_sigv4)
end
|
.credentials(profile) ⇒ Object
62
63
64
65
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 62
def credentials(profile)
mock_configuration = Configuration.new(profile)
Credentials.new(Aws::CredentialProviderChain.new(mock_configuration).resolve)
end
|
58
59
60
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 58
def (options)
options.merge(max_concurrent_requests: 1)
end
|
.load_dependencies(_klass) ⇒ Object
50
51
52
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 50
def load_dependencies(_klass)
require "aws-sdk-core"
end
|
.region(profile) ⇒ Object
67
68
69
70
71
72
73
74
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 67
def region(profile)
keys = %w[AWS_REGION AMAZON_REGION AWS_DEFAULT_REGION]
env_region = ENV.values_at(*keys).compact.first
env_region = nil if env_region == ""
cfg_region = Aws.shared_config.region(profile: profile)
env_region || cfg_region
end
|