Class: Aws::Plugins::RegionalEndpoint
- Inherits:
-
Seahorse::Client::Plugin
- Object
- Seahorse::Client::Plugin
- Aws::Plugins::RegionalEndpoint
- Defined in:
- lib/aws-sdk-core/plugins/regional_endpoint.rb
Constant Summary collapse
- MISSING_REGION =
raised when region is not configured
'missing required configuration option :region'
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Seahorse::Client::Plugin
#add_handlers, #add_options, after_initialize, after_initialize_hooks, before_initialize, #before_initialize, before_initialize_hooks, handlers, option, options
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response, #handler_for, #new_handler
Class Method Details
.resolve_region(cfg) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/aws-sdk-core/plugins/regional_endpoint.rb', line 40 def self.resolve_region(cfg) 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: cfg.profile) env_region || cfg_region end |
Instance Method Details
#after_initialize(client) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/aws-sdk-core/plugins/regional_endpoint.rb', line 30 def after_initialize(client) if client.config.region.nil? or client.config.region == '' msg = "missing region; use :region option or " msg << "export region name to ENV['AWS_REGION']" raise Errors::MissingRegionError, msg end end |