Class: OCI::Logging::Models::UnifiedAgentParserFilter

Inherits:
UnifiedAgentLoggingFilter show all
Defined in:
lib/oci/logging/models/unified_agent_parser_filter.rb

Overview

Logging parser filter object. Ref: docs.fluentd.org/filter/parser

Constant Summary

Constants inherited from UnifiedAgentLoggingFilter

OCI::Logging::Models::UnifiedAgentLoggingFilter::FILTER_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from UnifiedAgentLoggingFilter

#filter_type, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from UnifiedAgentLoggingFilter

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ UnifiedAgentParserFilter

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 107

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['filterType'] = 'PARSER_FILTER'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.parser = attributes[:'parser'] if attributes[:'parser']

  self.key_name = attributes[:'keyName'] if attributes[:'keyName']

  raise 'You cannot provide both :keyName and :key_name' if attributes.key?(:'keyName') && attributes.key?(:'key_name')

  self.key_name = attributes[:'key_name'] if attributes[:'key_name']

  self.reserve_time = attributes[:'reserveTime'] unless attributes[:'reserveTime'].nil?
  self.reserve_time = false if reserve_time.nil? && !attributes.key?(:'reserveTime') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :reserveTime and :reserve_time' if attributes.key?(:'reserveTime') && attributes.key?(:'reserve_time')

  self.reserve_time = attributes[:'reserve_time'] unless attributes[:'reserve_time'].nil?
  self.reserve_time = false if reserve_time.nil? && !attributes.key?(:'reserveTime') && !attributes.key?(:'reserve_time') # rubocop:disable Style/StringLiterals

  self.reserve_data = attributes[:'reserveData'] unless attributes[:'reserveData'].nil?
  self.reserve_data = false if reserve_data.nil? && !attributes.key?(:'reserveData') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :reserveData and :reserve_data' if attributes.key?(:'reserveData') && attributes.key?(:'reserve_data')

  self.reserve_data = attributes[:'reserve_data'] unless attributes[:'reserve_data'].nil?
  self.reserve_data = false if reserve_data.nil? && !attributes.key?(:'reserveData') && !attributes.key?(:'reserve_data') # rubocop:disable Style/StringLiterals

  self.remove_key_name_field = attributes[:'removeKeyNameField'] unless attributes[:'removeKeyNameField'].nil?
  self.remove_key_name_field = false if remove_key_name_field.nil? && !attributes.key?(:'removeKeyNameField') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :removeKeyNameField and :remove_key_name_field' if attributes.key?(:'removeKeyNameField') && attributes.key?(:'remove_key_name_field')

  self.remove_key_name_field = attributes[:'remove_key_name_field'] unless attributes[:'remove_key_name_field'].nil?
  self.remove_key_name_field = false if remove_key_name_field.nil? && !attributes.key?(:'removeKeyNameField') && !attributes.key?(:'remove_key_name_field') # rubocop:disable Style/StringLiterals

  self.replace_invalid_sequence = attributes[:'replaceInvalidSequence'] unless attributes[:'replaceInvalidSequence'].nil?
  self.replace_invalid_sequence = false if replace_invalid_sequence.nil? && !attributes.key?(:'replaceInvalidSequence') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :replaceInvalidSequence and :replace_invalid_sequence' if attributes.key?(:'replaceInvalidSequence') && attributes.key?(:'replace_invalid_sequence')

  self.replace_invalid_sequence = attributes[:'replace_invalid_sequence'] unless attributes[:'replace_invalid_sequence'].nil?
  self.replace_invalid_sequence = false if replace_invalid_sequence.nil? && !attributes.key?(:'replaceInvalidSequence') && !attributes.key?(:'replace_invalid_sequence') # rubocop:disable Style/StringLiterals

  self.inject_key_prefix = attributes[:'injectKeyPrefix'] if attributes[:'injectKeyPrefix']

  raise 'You cannot provide both :injectKeyPrefix and :inject_key_prefix' if attributes.key?(:'injectKeyPrefix') && attributes.key?(:'inject_key_prefix')

  self.inject_key_prefix = attributes[:'inject_key_prefix'] if attributes[:'inject_key_prefix']

  self.hash_value_field = attributes[:'hashValueField'] if attributes[:'hashValueField']

  raise 'You cannot provide both :hashValueField and :hash_value_field' if attributes.key?(:'hashValueField') && attributes.key?(:'hash_value_field')

  self.hash_value_field = attributes[:'hash_value_field'] if attributes[:'hash_value_field']

  self.emit_invalid_record_to_error = attributes[:'emitInvalidRecordToError'] unless attributes[:'emitInvalidRecordToError'].nil?
  self.emit_invalid_record_to_error = true if emit_invalid_record_to_error.nil? && !attributes.key?(:'emitInvalidRecordToError') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :emitInvalidRecordToError and :emit_invalid_record_to_error' if attributes.key?(:'emitInvalidRecordToError') && attributes.key?(:'emit_invalid_record_to_error')

  self.emit_invalid_record_to_error = attributes[:'emit_invalid_record_to_error'] unless attributes[:'emit_invalid_record_to_error'].nil?
  self.emit_invalid_record_to_error = true if emit_invalid_record_to_error.nil? && !attributes.key?(:'emitInvalidRecordToError') && !attributes.key?(:'emit_invalid_record_to_error') # rubocop:disable Style/StringLiterals
end

Instance Attribute Details

#emit_invalid_record_to_errorBOOLEAN

If true, emit invalid record to @ERROR label. Invalid cases are: 1) key does not exist; 2) the format does not match; or 3) an unexpected error. You can rescue unexpected format logs in the @ERROR lable. If you want to ignore these errors, set this to false.

Returns:

  • (BOOLEAN)


51
52
53
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 51

def emit_invalid_record_to_error
  @emit_invalid_record_to_error
end

#hash_value_fieldString

Store the parsed values as a hash value in a field.

Returns:

  • (String)


44
45
46
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 44

def hash_value_field
  @hash_value_field
end

#inject_key_prefixString

Store the parsed values with the specified key name prefix.

Returns:

  • (String)


40
41
42
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 40

def inject_key_prefix
  @inject_key_prefix
end

#key_nameString

[Required] The field name in the record to parse.

Returns:

  • (String)


20
21
22
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 20

def key_name
  @key_name
end

#parserOCI::Logging::Models::UnifiedAgentParser

This attribute is required.



16
17
18
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 16

def parser
  @parser
end

#remove_key_name_fieldBOOLEAN

If true, remove the keyName field when parsing is succeeded.

Returns:

  • (BOOLEAN)


32
33
34
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 32

def remove_key_name_field
  @remove_key_name_field
end

#replace_invalid_sequenceBOOLEAN

If true, the invalid string is replaced with safe characters and is re-parsed.

Returns:

  • (BOOLEAN)


36
37
38
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 36

def replace_invalid_sequence
  @replace_invalid_sequence
end

#reserve_dataBOOLEAN

If true, keep the original key-value pair in the parsed result.

Returns:

  • (BOOLEAN)


28
29
30
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 28

def reserve_data
  @reserve_data
end

#reserve_timeBOOLEAN

If true, keep the original event time in the parsed result.

Returns:

  • (BOOLEAN)


24
25
26
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 24

def reserve_time
  @reserve_time
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 54

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'filter_type': :'filterType',
    'parser': :'parser',
    'key_name': :'keyName',
    'reserve_time': :'reserveTime',
    'reserve_data': :'reserveData',
    'remove_key_name_field': :'removeKeyNameField',
    'replace_invalid_sequence': :'replaceInvalidSequence',
    'inject_key_prefix': :'injectKeyPrefix',
    'hash_value_field': :'hashValueField',
    'emit_invalid_record_to_error': :'emitInvalidRecordToError'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 73

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'filter_type': :'String',
    'parser': :'OCI::Logging::Models::UnifiedAgentParser',
    'key_name': :'String',
    'reserve_time': :'BOOLEAN',
    'reserve_data': :'BOOLEAN',
    'remove_key_name_field': :'BOOLEAN',
    'replace_invalid_sequence': :'BOOLEAN',
    'inject_key_prefix': :'String',
    'hash_value_field': :'String',
    'emit_invalid_record_to_error': :'BOOLEAN'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 185

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    name == other.name &&
    filter_type == other.filter_type &&
    parser == other.parser &&
    key_name == other.key_name &&
    reserve_time == other.reserve_time &&
    reserve_data == other.reserve_data &&
    remove_key_name_field == other.remove_key_name_field &&
    replace_invalid_sequence == other.replace_invalid_sequence &&
    inject_key_prefix == other.inject_key_prefix &&
    hash_value_field == other.hash_value_field &&
    emit_invalid_record_to_error == other.emit_invalid_record_to_error
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 225

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


205
206
207
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 205

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



214
215
216
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 214

def hash
  [name, filter_type, parser, key_name, reserve_time, reserve_data, remove_key_name_field, replace_invalid_sequence, inject_key_prefix, hash_value_field, emit_invalid_record_to_error].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



258
259
260
261
262
263
264
265
266
267
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 258

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



252
253
254
# File 'lib/oci/logging/models/unified_agent_parser_filter.rb', line 252

def to_s
  to_hash.to_s
end