class Aws::Rest::Request::Body

def apply(http_req, params)

Parameters:
  • params (Hash) --
  • http_req (Seahorse::Client::Http::Request) --
def apply(http_req, params)
  body = build_body(params)
  # for rest-json, ensure we send at least an empty object
  # don't send an empty object for streaming? case.
  if body.nil? && @serializer_class == Json::Builder &&
     modeled_body? && !streaming?
    body = '{}'
  end
  http_req.body = body
end

def body_params(params)

def body_params(params)
  @rules.shape.members.inject({}) do |hash, (member_name, member_ref)|
    if !member_ref.location && params.key?(member_name)
      hash[member_name] = params[member_name]
    end
    hash
  end
end

def build_body(params)

def build_body(params)
  if streaming?
    params[@rules[:payload]]
  elsif @rules[:payload]
    params = params[@rules[:payload]]
    serialize(@rules[:payload_member], params) if params
  else
    params = body_params(params)
    serialize(@rules, params) unless params.empty?
  end
end

def initialize(serializer_class, rules)

Parameters:
  • rules (Seahorse::Model::ShapeRef) --
  • serializer_class (Class) --
def initialize(serializer_class, rules)
  @serializer_class = serializer_class
  @rules = rules
end

def modeled_body?

either with payload trait or normal members.
operation is modeled for body when it is modeled for a payload
def modeled_body?
  return true if @rules[:payload]
  @rules.shape.members.each do |member|
    _name, shape = member
    return true if shape.location.nil?
  end
  false
end

def serialize(rules, params)

def serialize(rules, params)
  @serializer_class.new(rules).serialize(params)
end

def streaming?

def streaming?
  @rules[:payload] && (
    BlobShape === @rules[:payload_member].shape ||
    StringShape === @rules[:payload_member].shape
  )
end