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 28 29 30 31 32 33 34
|
# frozen_string_literal: true
module Aws
module Plugins
# @api private
class ParamConverter < Seahorse::Client::Plugin
option(:convert_params,
default: true,
doc_type: 'Boolean',
docstring: <<-DOCS
When `true`, an attempt is made to coerce request parameters into
the required types.
DOCS
)
def add_handlers(handlers, config)
handlers.add(Handler, step: :initialize) if config.convert_params
end
class Handler < Seahorse::Client::Handler
def call(context)
converter = Aws::ParamConverter.new(context.operation.input)
context.params = converter.convert(context.params)
@handler.call(context).on_complete do |resp|
converter.close_opened_files
end
end
end
end
end
end
|