lib/aws-sdk-s3/plugins/accelerate.rb in aws-sdk-s3-1.87.0 vs lib/aws-sdk-s3/plugins/accelerate.rb in aws-sdk-s3-1.88.0

- old
+ new

@@ -27,32 +27,35 @@ # and to remove :use_accelerate_endpoint from the params. handlers.add( OptionHandler, step: :initialize, operations: operations ) handlers.add( - AccelerateHandler, step: :build, priority: 0, operations: operations + AccelerateHandler, step: :build, priority: 11, operations: operations ) end # @api private class OptionHandler < Seahorse::Client::Handler def call(context) # Support client configuration and per-operation configuration if context.params.is_a?(Hash) accelerate = context.params.delete(:use_accelerate_endpoint) end - if accelerate.nil? - accelerate = context.config.use_accelerate_endpoint + accelerate = context.config.use_accelerate_endpoint if accelerate.nil? + # Raise if :endpoint and dualstack are both provided + if accelerate && !context.config.regional_endpoint + raise ArgumentError, + 'Cannot use both :use_accelerate_endpoint and :endpoint' end context[:use_accelerate_endpoint] = accelerate @handler.call(context) end end # @api private class AccelerateHandler < Seahorse::Client::Handler def call(context) - if context[:use_accelerate_endpoint] + if context.config.regional_endpoint && context[:use_accelerate_endpoint] dualstack = !!context[:use_dualstack_endpoint] use_accelerate_endpoint(context, dualstack) end @handler.call(context) end