def configure_client
super
unless self::Options.include?(ConfiguredOptionGrammars)
self::Options.module_eval do
include(ConfiguredOptionGrammars)
define_configured_grammars
end
end
api_config[:operations].each do |name, customizations|
option_grammar = self::Options.operation_grammar(name)
target_prefix = self::TARGET_PREFIX
add_client_request_method(Inflection.ruby_name(name).to_sym) do
configure_request do |request, options|
request.headers["x-amz-target"] = target_prefix + name
request.body = option_grammar.to_json(options)
end
process_response do |response|
response_body = response.http_response.body
response_body = "{}" if response_body == ""
data = JSON.load(response_body)
MetaUtils.extend_method(response, :data) { data }
end
simulate_response do |response|
data = {}
MetaUtils.extend_method(response, :data) { data }
end
end
end
end