Module: HTTPX::Plugins::AwsSdkAuthentication
- Defined in:
- lib/httpx/plugins/aws_sdk_authentication.rb,
sig/plugins/aws_sdk_authentication.rbs
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, _AwsSdkOptions Classes: Configuration, Credentials
Class Method Summary collapse
- .configure(klass) ⇒ void
- .credentials(profile) ⇒ Credentials
- .extra_options(options) ⇒ Options & _AwsSdkOptions
- .load_dependencies(_klass) ⇒ void
- .region(profile) ⇒ String
Class Method Details
.configure(klass) ⇒ void
This method returns an undefined value.
52 53 54 |
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 52 def configure(klass) klass.plugin(:aws_sigv4) end |
.credentials(profile) ⇒ Credentials
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 |
.extra_options(options) ⇒ Options & _AwsSdkOptions
56 57 58 |
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 56 def () .merge(max_concurrent_requests: 1) end |
.load_dependencies(_klass) ⇒ void
This method returns an undefined value.
48 49 50 |
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 48 def load_dependencies(_klass) require "aws-sdk-core" end |
.region(profile) ⇒ String
65 66 67 68 69 70 71 72 |
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 65 def region(profile) # https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb#L62 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 |