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

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

25
26
27
28
29
# File 'lib/aws-sdk-core/api/shape_map.rb', line 25

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.


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

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.


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

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.


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

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])
    if meta['hostLabel']
      # used for endpoint pattern
      meta['hostLabelName'] = options[:member_name]
    end

    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