class Aws::Plugins::GlobalConfiguration
@api private
Aws::S3.new.config.force_path_style #=> true
Aws::EC2.new # no error this time<br><br>Aws.config = { force_path_style: true }
To avoid this issue, you can nest service specific options
#=> raises ArgumentError: invalid configuration option ‘:force_path_style’<br>Aws::EC2.new<br>Aws.config = true
# oops, this option is only recognized by Aws::S3
shared by other services.
Some services have very specific configuration options that are not
## Service Specific Global Configuration
Aws::EC2.new(region: ‘us-east-1’).config.region #=> ‘us-east-1’
# constructor args have priority over global configuration
Aws::EC2.new.config.region #=> ‘us-west-2’
# uses the global configuration
service interfaces.
Options applied to ‘Aws.config` are merged with constructed<br><br>Aws.config = ’us-west-2’
You can specify global configuration defaults via ‘Aws.config`
## Global AWS configuration
all AWS classes or specific ones.
This plugin provides the ability to provide global configuration for
def add_identifier(identifier)
- Api: - private
def add_identifier(identifier) @identifiers << identifier end
def apply_aws_defaults(client_class, options)
def apply_aws_defaults(client_class, options) Aws.config.each do |option_name, default| next if self.class.identifiers.include?(option_name) next if options.key?(option_name) options[option_name] = default end end
def apply_service_defaults(client_class, options)
def apply_service_defaults(client_class, options) if defaults = Aws.config[client_class.identifier] defaults.each do |option_name, default| options[option_name] = default unless options.key?(option_name) end end end
def before_initialize(client_class, options)
- Api: - private
def before_initialize(client_class, options) # apply service specific defaults before the global aws defaults apply_service_defaults(client_class, options) apply_aws_defaults(client_class, options) end
def identifiers
- Api: - private
Returns:
-
(Set
-)
def identifiers @identifiers end