Class: OCI::Logging::Models::UnifiedAgentLoggingRecordTransformerFilter

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

Overview

Logging record transformer filter object mutates/transforms logs. Ref: docs.fluentd.org/filter/record_transformer

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 = {}) ⇒ UnifiedAgentLoggingRecordTransformerFilter

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 90

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

  attributes['filterType'] = 'RECORD_TRANSFORMER_FILTER'

  super(attributes)

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

  self.record_list = attributes[:'recordList'] if attributes[:'recordList']

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

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

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

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

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

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

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

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

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

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

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

  self.renew_time_key = attributes[:'renewTimeKey'] if attributes[:'renewTimeKey']

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

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

  self.keep_keys = attributes[:'keepKeys'] if attributes[:'keepKeys']

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

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

  self.remove_keys = attributes[:'removeKeys'] if attributes[:'removeKeys']

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

  self.remove_keys = attributes[:'remove_keys'] if attributes[:'remove_keys']
end

Instance Attribute Details

#is_auto_typecast_enabledBOOLEAN

If true, automatically casts the field types.

Returns:

  • (BOOLEAN)


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

def is_auto_typecast_enabled
  @is_auto_typecast_enabled
end

#is_renew_record_enabledBOOLEAN

If true, it modifies a new empty hash

Returns:

  • (BOOLEAN)


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

def is_renew_record_enabled
  @is_renew_record_enabled
end

#is_ruby_enabledBOOLEAN

When set to true, the full Ruby syntax is enabled in the ${} expression.

Returns:

  • (BOOLEAN)


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

def is_ruby_enabled
  @is_ruby_enabled
end

#keep_keysArray<String>

A list of keys to keep. Only relevant if isRenewRecordEnabled is set to true

Returns:

  • (Array<String>)


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

def keep_keys
  @keep_keys
end

#record_listArray<OCI::Logging::Models::RecordTransformerPair>

[Required] Add new key-value pairs in logs



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

def record_list
  @record_list
end

#remove_keysArray<String>

A list of keys to delete

Returns:

  • (Array<String>)


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

def remove_keys
  @remove_keys
end

#renew_time_keyString

Overwrites the time of logs with this value, this value must be a Unix timestamp.

Returns:

  • (String)


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

def renew_time_key
  @renew_time_key
end

Class Method Details

.attribute_mapObject

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



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 43

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'filter_type': :'filterType',
    'record_list': :'recordList',
    'is_ruby_enabled': :'isRubyEnabled',
    'is_auto_typecast_enabled': :'isAutoTypecastEnabled',
    'is_renew_record_enabled': :'isRenewRecordEnabled',
    'renew_time_key': :'renewTimeKey',
    'keep_keys': :'keepKeys',
    'remove_keys': :'removeKeys'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 60

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'filter_type': :'String',
    'record_list': :'Array<OCI::Logging::Models::RecordTransformerPair>',
    'is_ruby_enabled': :'BOOLEAN',
    'is_auto_typecast_enabled': :'BOOLEAN',
    'is_renew_record_enabled': :'BOOLEAN',
    'renew_time_key': :'String',
    'keep_keys': :'Array<String>',
    'remove_keys': :'Array<String>'
    # 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



156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 156

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

  self.class == other.class &&
    name == other.name &&
    filter_type == other.filter_type &&
    record_list == other.record_list &&
    is_ruby_enabled == other.is_ruby_enabled &&
    is_auto_typecast_enabled == other.is_auto_typecast_enabled &&
    is_renew_record_enabled == other.is_renew_record_enabled &&
    renew_time_key == other.renew_time_key &&
    keep_keys == other.keep_keys &&
    remove_keys == other.remove_keys
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



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 194

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


174
175
176
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 174

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



183
184
185
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 183

def hash
  [name, filter_type, record_list, is_ruby_enabled, is_auto_typecast_enabled, is_renew_record_enabled, renew_time_key, keep_keys, remove_keys].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



227
228
229
230
231
232
233
234
235
236
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 227

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



221
222
223
# File 'lib/oci/logging/models/unified_agent_logging_record_transformer_filter.rb', line 221

def to_s
  to_hash.to_s
end