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
|
# frozen_string_literal: true
module Aws
module Plugins
# @api private
class ParamValidator < Seahorse::Client::Plugin
option(:validate_params,
default: true,
doc_type: 'Boolean',
docstring: <<-DOCS)
When `true`, request parameters are validated before
sending the request.
DOCS
def add_handlers(handlers, config)
if config.validate_params
handlers.add(Handler, step: :validate, priority: 50)
end
end
class Handler < Seahorse::Client::Handler
def call(context)
Aws::ParamValidator.validate!(context.operation.input, context.params)
@handler.call(context)
end
end
end
end
end
|