Skip to content

Commit 5516a5a

Browse files
committed
Add struct attr_reader on DefaultResolver
1 parent 61e8de1 commit 5516a5a

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,10 @@ def resolve_endpoint(cfg)
152152

153153
# preserve legacy (pre EP2) client.config.endpoint still resolves a value
154154
# when needed.
155-
struct = cfg.instance_variable_get(:@struct)
156-
if struct
157-
# need a separate proc to get namespace/private access to resolve_legacy_endpoint
158-
b = proc { resolve_legacy_endpoint(struct) }
159-
struct.define_singleton_method(:endpoint) { @endpoint ||= b.call }
160-
nil
161-
else
162-
# backup in case internal details of config resolver change
163-
resolve_legacy_endpoint(cfg)
164-
end
155+
# need a separate proc to get namespace/private access to resolve_legacy_endpoint
156+
b = proc { resolve_legacy_endpoint(cfg.struct) }
157+
cfg.struct.define_singleton_method(:endpoint) { @endpoint ||= b.call }
158+
nil
165159
end
166160

167161
# get a custom configured endpoint from ENV or configuration

gems/aws-sdk-core/lib/seahorse/client/configuration.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ def initialize(struct)
187187
@members = Set.new(@struct.members)
188188
end
189189

190+
attr_reader :struct
191+
190192
def resolve
191193
@members.each { |opt_name| value_at(opt_name) }
192194
end

0 commit comments

Comments
 (0)