Class: Aws::Api::ShapeMap Private

Inherits:
Object
  • Object
show all
Includes:
Seahorse::Model::Shapes
Defined in:
lib/aws-sdk-core/api/shape_map.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

EMPTY_REF =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

begin
  shape = StructureShape.new
  shape[:struct_class] = Aws::EmptyStructure
  ShapeRef.new(shape: shape)
end
SHAPE_CLASSES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  'blob' => BlobShape,
  'byte' => StringShape,
  'boolean' => BooleanShape,
  'character' => StringShape,
  'double' => FloatShape,
  'float' => FloatShape,
  'integer' => IntegerShape,
  'list' => ListShape,
  'long' => IntegerShape,
  'map' => MapShape,
  'string' => StringShape,
  'structure' => StructureShape,
  'timestamp' => TimestampShape,
}

Instance Method Summary collapse

Constructor Details

#initialize(shape_definitions, options = {}) ⇒ ShapeMap

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ShapeMap.

Parameters:

  • shape_definitions (Hash)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :docs (DocstringProvider) — default: NullDocstringProvider


31
32
33
34
35
# File 'lib/aws-sdk-core/api/shape_map.rb', line 31

def initialize(shape_definitions, options = {})
  @shapes = {}
  @docs = options[:docs] || Docs::NullDocstringProvider.new
  build_shapes(shape_definitions)
end

Instance Method Details

#[](shape_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
40
41
42
43
# File 'lib/aws-sdk-core/api/shape_map.rb', line 37

def [](shape_name)
  if shape = @shapes[shape_name]
    shape
  else
    raise ArgumentError, "unknown shape #{shape_name.inspect}"
  end
end

#each_structureObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
47
48
49
50
51
# File 'lib/aws-sdk-core/api/shape_map.rb', line 45

def each_structure
  @shapes.each do |_, shape|
    if StructureShape === shape && !shape[:error] && !shape[:exception]
      yield(shape)
    end
  end
end

#shape_ref(definition, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/aws-sdk-core/api/shape_map.rb', line 53

def shape_ref(definition, options = {})
  if definition

    meta = definition.dup

    shape = self[meta.delete('shape')]
    location = meta.delete('location')
    location_name = meta.delete('locationName')
    location_name ||= options[:member_name] unless location == 'headers'
    documentation = @docs.shape_ref_docs(shape.name, options[:target])

    ShapeRef.new(
      shape: shape,
      location: location,
      location_name: location_name,
      required: !!options[:required],
      deprecated: !!(meta.delete('deprecated') || shape[:deprecated]),
      documentation: documentation,
      metadata: meta)
  else
    EMPTY_REF
  end
end