class Aws::Api::Docs::ClientTypeDocumenter

def docstring(api, shape)

def docstring(api, shape)
  docs = shape.documentation || ''
  methods = returned_by(api, shape)
  unless methods.empty?
    docs += "<p>Returned by:</p>"
    docs += "<ul>"
    docs += methods.map{|m| "<li>{#{m}}</li>" }.join
    docs += "</ul>"
  end
  docs
end

def document(api, shape)

Parameters:
  • shape (Seahorse::Model::Shapes::StructureShape) --
  • api (Seahorse::Model::Api) --
def document(api, shape)
  yard_class = YARD::CodeObjects::ClassObject.new(@namespace, shape.name)
  yard_class.superclass = 'Struct'
  yard_class.docstring = docstring(api, shape)
  tags(api, shape).each do |tag|
    yard_class.add_tag(tag)
  end
  shape.members.each do |member_name, ref|
    document_struct_member(yard_class, member_name, ref)
  end
end

def initialize(namespace)

Parameters:
  • namespace (Yard::CodeObjects::Base) --
def initialize(namespace)
  @namespace = namespace
end

def input_example_tag(api, shape)

def input_example_tag(api, shape)
  params = ParamFormatter.new(ShapeRef.new(shape: shape))
  note = "@note When passing #{shape.name} as input to an #{Client} "
  note << "method, you can use a\n  vanilla Hash:\n\n      "
  note << params.format.lines.join("      ")
  tag(note)
end

def input_shape?(haystack, needle, stack = [])

Returns `true` if the given shape is ever used as input in the api.
def input_shape?(haystack, needle, stack = [])
  if stack.include?(haystack)
    return false
  else
    stack += [haystack]
  end
  case haystack
  when needle
    return true
  when Seahorse::Model::Api
    haystack.operations.each do |_, operation|
      if operation.input && input_shape?(operation.input.shape, needle, stack)
        return true
      end
    end
  when StructureShape
    haystack.members.each do |_, member_ref|
      if input_shape?(member_ref.shape, needle, stack)
        return true
      end
    end
  when ListShape
    return input_shape?(haystack.member.shape, needle, stack)
  when MapShape
    return input_shape?(haystack.value.shape, needle, stack)
  end
  false
end

def returned_by(api, shape)

def returned_by(api, shape)
  methods = []
  api.metadata['shapes'].each_structure do |struct|
    struct.members.each do |member_name, member_ref|
      if member_ref.shape == shape
        methods << "Types::#{struct.name}##{member_name}"
      end
    end
  end
  api.operations.each do |operation_name, operation|
    if operation.output && operation.output.shape == shape
      methods << "Client##{operation_name}"
    end
  end
  methods
end

def tags(api, shape)

def tags(api, shape)
  tags = []
  tags << input_example_tag(api, shape) if input_shape?(api, shape)
  tags
end