Class: AWSCDK::Logs::ListToMapProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
logs/list_to_map_property.rb

Overview

This processor takes a list of objects that contain key fields, and converts them into a map of target keys.

For more information about this processor including examples, see listToMap in the CloudWatch Logs User Guide.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, source:, flatten: nil, flattened_element: nil, target: nil, value_key: nil) ⇒ ListToMapProperty

Returns a new instance of ListToMapProperty.

Parameters:

  • key (String)

    The key of the field to be extracted as keys in the generated map.

  • source (String)

    The key in the log event that has a list of objects that will be converted to a map.

  • flatten (Boolean, nil) (defaults to: nil)

    A Boolean value to indicate whether the list will be flattened into single items.

  • flattened_element (String, nil) (defaults to: nil)

    If you set flatten to true, use flattenedElement to specify which element, first or last, to keep.

  • target (String, nil) (defaults to: nil)

    The key of the field that will hold the generated map.

  • value_key (String, nil) (defaults to: nil)

    If this is specified, the values that you specify in this parameter will be extracted from the source objects and put into the values of the generated map.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'logs/list_to_map_property.rb', line 15

def initialize(key:, source:, flatten: nil, flattened_element: nil, target: nil, value_key: nil)
  @key = key
  Jsii::Type.check_type(@key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key")
  @source = source
  Jsii::Type.check_type(@source, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "source")
  @flatten = flatten
  Jsii::Type.check_type(@flatten, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "flatten") unless @flatten.nil?
  @flattened_element = flattened_element
  Jsii::Type.check_type(@flattened_element, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "flattenedElement") unless @flattened_element.nil?
  @target = target
  Jsii::Type.check_type(@target, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "target") unless @target.nil?
  @value_key = value_key
  Jsii::Type.check_type(@value_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "valueKey") unless @value_key.nil?
end

Instance Attribute Details

#flattenBoolean? (readonly)

Note:

Default: false

A Boolean value to indicate whether the list will be flattened into single items.

Returns:

  • (Boolean, nil)


42
43
44
# File 'logs/list_to_map_property.rb', line 42

def flatten
  @flatten
end

#flattened_elementString? (readonly)

Note:

Default: - Must be specified if flatten is true and if flatten is false, has no effect

If you set flatten to true, use flattenedElement to specify which element, first or last, to keep.

You must specify this parameter if flatten is true.

Returns:

  • (String, nil)


49
50
51
# File 'logs/list_to_map_property.rb', line 49

def flattened_element
  @flattened_element
end

#keyString (readonly)

The key of the field to be extracted as keys in the generated map.

Returns:

  • (String)


33
34
35
# File 'logs/list_to_map_property.rb', line 33

def key
  @key
end

#sourceString (readonly)

The key in the log event that has a list of objects that will be converted to a map.

Returns:

  • (String)


37
38
39
# File 'logs/list_to_map_property.rb', line 37

def source
  @source
end

#targetString? (readonly)

Note:

Default: - Stored at the root of the log event

The key of the field that will hold the generated map.

Returns:

  • (String, nil)


54
55
56
# File 'logs/list_to_map_property.rb', line 54

def target
  @target
end

#value_keyString? (readonly)

Note:

Default: - Original objects in the source list will be put into the values of the generated map

If this is specified, the values that you specify in this parameter will be extracted from the source objects and put into the values of the generated map.

Returns:

  • (String, nil)


59
60
61
# File 'logs/list_to_map_property.rb', line 59

def value_key
  @value_key
end

Class Method Details

.jsii_propertiesObject



61
62
63
64
65
66
67
68
69
70
# File 'logs/list_to_map_property.rb', line 61

def self.jsii_properties
  {
    :key => "key",
    :source => "source",
    :flatten => "flatten",
    :flattened_element => "flattenedElement",
    :target => "target",
    :value_key => "valueKey",
  }
end

Instance Method Details

#to_jsiiObject



72
73
74
75
76
77
78
79
80
81
82
83
# File 'logs/list_to_map_property.rb', line 72

def to_jsii
  result = {}
  result.merge!({
    "key" => @key,
    "source" => @source,
    "flatten" => @flatten,
    "flattenedElement" => @flattened_element,
    "target" => @target,
    "valueKey" => @value_key,
  })
  result.compact
end