File: dualstack.rb

package info (click to toggle)
ruby-aws-sdk-s3 1.170.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,740 kB
  • sloc: ruby: 16,388; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Aws
  module S3
    module Plugins
      # @api private
      class Dualstack < Seahorse::Client::Plugin
        def add_handlers(handlers, _config)
          handlers.add(OptionHandler, step: :initialize)
        end

        # @api private
        class OptionHandler < Seahorse::Client::Handler
          def call(context)
            # Support client configuration and per-operation configuration
            if context.params.is_a?(Hash)
              dualstack = context.params.delete(:use_dualstack_endpoint)
            end
            dualstack = context.config.use_dualstack_endpoint if dualstack.nil?
            context[:use_dualstack_endpoint] = dualstack
            @handler.call(context)
          end
        end
      end
    end
  end
end