Class: Aws::EndpointProvider Private
- Inherits:
-
Object
- Object
- Aws::EndpointProvider
- Defined in:
- lib/aws-sdk-core/endpoint_provider.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .default_provider ⇒ Object private
- .default_rules ⇒ Object private
Instance Method Summary collapse
- #add_rule(options = {}) ⇒ Object private
-
#initialize(options = {}) ⇒ EndpointProvider
constructor
private
A new instance of EndpointProvider.
- #resolve(options) ⇒ Hash private
Constructor Details
#initialize(options = {}) ⇒ EndpointProvider
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of EndpointProvider.
8 9 10 |
# File 'lib/aws-sdk-core/endpoint_provider.rb', line 8 def initialize( = {}) @rules = [:rules] || [] end |
Class Method Details
.default_provider ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
86 87 88 |
# File 'lib/aws-sdk-core/endpoint_provider.rb', line 86 def default_provider @default_provider ||= EndpointProvider.new(rules: default_rules) end |
.default_rules ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
90 91 92 93 |
# File 'lib/aws-sdk-core/endpoint_provider.rb', line 90 def default_rules path = File.join(File.dirname(__FILE__), '..', '..', 'endpoints.json') MultiJson.load(File.read(path)) end |
Instance Method Details
#add_rule(options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
54 55 56 |
# File 'lib/aws-sdk-core/endpoint_provider.rb', line 54 def add_rule( = {}) @rules = (@rules + [new_rule()]).sort_by { |r| r['priority'] } end |
#resolve(options) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/aws-sdk-core/endpoint_provider.rb', line 16 def resolve() @rules.each do |rule_group| if region_matches?(rule_group, ) rule_group['rules'].each do |rule| if service_matches?(rule, ) return (rule['config']['endpoint'], ) end end end end {} end |