class Aws::Query::Handler
Constants
- CONTENT_TYPE
- METADATA_REF
- METADATA_STRUCT
- WRAPPER_STRUCT
Public Instance Methods
call(context)
click to toggle source
@param [Seahorse::Client::RequestContext] context @return [Seahorse::Client::Response]
# File lib/aws-sdk-core/query/handler.rb, line 25 def call(context) build_request(context) @handler.call(context).on_success do |response| response.error = nil response.data = parse_xml(context) end end
Private Instance Methods
apply_params(param_list, params, rules)
click to toggle source
# File lib/aws-sdk-core/query/handler.rb, line 47 def apply_params(param_list, params, rules) ParamBuilder.new(param_list).apply(rules, params) end
build_request(context)
click to toggle source
# File lib/aws-sdk-core/query/handler.rb, line 35 def build_request(context) context.http_request.http_method = 'POST' context.http_request.headers['Content-Type'] = CONTENT_TYPE param_list = ParamList.new param_list.set('Version', context.config.api.version) param_list.set('Action', context.operation.name) if input_shape = context.operation.input apply_params(param_list, context.params, input_shape) end context.http_request.body = param_list.to_io end
parse_xml(context)
click to toggle source
# File lib/aws-sdk-core/query/handler.rb, line 51 def parse_xml(context) if context.operation.output data = Xml::Parser.new(rules(context)).parse(xml(context)) remove_wrapper(data, context) else EmptyStructure.new end end
remove_wrapper(data, context)
click to toggle source
# File lib/aws-sdk-core/query/handler.rb, line 75 def remove_wrapper(data, context) if context.operation.output context[:request_id] = data.response_metadata.request_id data.result || Structure.new(context.operation.output.shape.member_names) else data end end
rules(context)
click to toggle source
# File lib/aws-sdk-core/query/handler.rb, line 64 def rules(context) shape = Seahorse::Model::Shapes::StructureShape.new shape.add_member(:result, ShapeRef.new( shape: context.operation.output.shape, location_name: context.operation.name + 'Result' )) shape[:struct_class] = WRAPPER_STRUCT shape.add_member(:response_metadata, METADATA_REF) ShapeRef.new(shape: shape) end
xml(context)
click to toggle source
# File lib/aws-sdk-core/query/handler.rb, line 60 def xml(context) context.http_response.body_contents end