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
52
53
54
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 52
def configure(klass)
klass.plugin(:aws_sigv4)
end
|
.credentials(profile) ⇒ Object
60
61
62
63
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 60
def credentials(profile)
mock_configuration = Configuration.new(profile)
Credentials.new(Aws::CredentialProviderChain.new(mock_configuration).resolve)
end
|
56
57
58
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 56
def (options)
options.merge(max_concurrent_requests: 1)
end
|
.load_dependencies(_klass) ⇒ Object
48
49
50
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 48
def load_dependencies(_klass)
require "aws-sdk-core"
end
|
.region(profile) ⇒ Object
65
66
67
68
69
70
71
72
|
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 65
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
|