Class: OCI::Logging::Models::UnifiedAgentParser
- Inherits:
-
Object
- Object
- OCI::Logging::Models::UnifiedAgentParser
- Defined in:
- lib/oci/logging/models/unified_agent_parser.rb
Overview
source parser object. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
Direct Known Subclasses
UnifiedAgentApache2Parser, UnifiedAgentApacheErrorParser, UnifiedAgentAuditdParser, UnifiedAgentCsvParser, UnifiedAgentGrokParser, UnifiedAgentMsgpackParser, UnifiedAgentMultilineGrokParser, UnifiedAgentMultilineParser, UnifiedAgentNoneParser, UnifiedAgentRegexParser, UnifiedAgentSyslogParser, UnifiedAgentTsvParser, UnifiedJSONParser
Constant Summary collapse
- PARSER_TYPE_ENUM =
[ PARSER_TYPE_AUDITD = 'AUDITD'.freeze, PARSER_TYPE_JSON = 'JSON'.freeze, PARSER_TYPE_TSV = 'TSV'.freeze, PARSER_TYPE_CSV = 'CSV'.freeze, PARSER_TYPE_NONE = 'NONE'.freeze, PARSER_TYPE_SYSLOG = 'SYSLOG'.freeze, PARSER_TYPE_APACHE2 = 'APACHE2'.freeze, PARSER_TYPE_APACHE_ERROR = 'APACHE_ERROR'.freeze, PARSER_TYPE_MSGPACK = 'MSGPACK'.freeze, PARSER_TYPE_REGEXP = 'REGEXP'.freeze, PARSER_TYPE_MULTILINE = 'MULTILINE'.freeze, PARSER_TYPE_GROK = 'GROK'.freeze, PARSER_TYPE_MULTILINE_GROK = 'MULTILINE_GROK'.freeze, PARSER_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#field_time_key ⇒ String
Specify time field for the event time.
-
#is_estimate_current_event ⇒ BOOLEAN
If true, use Fluent::EventTime.now(current time) as a timestamp when time_key is specified.
-
#is_keep_time_key ⇒ BOOLEAN
If true, keep time field in the record.
-
#is_null_empty_string ⇒ BOOLEAN
If true, an empty string field is replaced with nil.
-
#null_value_pattern ⇒ String
Specify the null value pattern.
-
#parser_type ⇒ String
[Required] Type of fluent parser.
-
#timeout_in_milliseconds ⇒ Integer
Specify the timeout for parse processing.
-
#types ⇒ Hash<String, String>
Specify types for converting a field into another type.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ UnifiedAgentParser
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ UnifiedAgentParser
Initializes the object
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 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 134 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.parser_type = attributes[:'parserType'] if attributes[:'parserType'] raise 'You cannot provide both :parserType and :parser_type' if attributes.key?(:'parserType') && attributes.key?(:'parser_type') self.parser_type = attributes[:'parser_type'] if attributes[:'parser_type'] self.field_time_key = attributes[:'fieldTimeKey'] if attributes[:'fieldTimeKey'] raise 'You cannot provide both :fieldTimeKey and :field_time_key' if attributes.key?(:'fieldTimeKey') && attributes.key?(:'field_time_key') self.field_time_key = attributes[:'field_time_key'] if attributes[:'field_time_key'] self.types = attributes[:'types'] if attributes[:'types'] self.null_value_pattern = attributes[:'nullValuePattern'] if attributes[:'nullValuePattern'] raise 'You cannot provide both :nullValuePattern and :null_value_pattern' if attributes.key?(:'nullValuePattern') && attributes.key?(:'null_value_pattern') self.null_value_pattern = attributes[:'null_value_pattern'] if attributes[:'null_value_pattern'] self.is_null_empty_string = attributes[:'isNullEmptyString'] unless attributes[:'isNullEmptyString'].nil? self.is_null_empty_string = false if is_null_empty_string.nil? && !attributes.key?(:'isNullEmptyString') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isNullEmptyString and :is_null_empty_string' if attributes.key?(:'isNullEmptyString') && attributes.key?(:'is_null_empty_string') self.is_null_empty_string = attributes[:'is_null_empty_string'] unless attributes[:'is_null_empty_string'].nil? self.is_null_empty_string = false if is_null_empty_string.nil? && !attributes.key?(:'isNullEmptyString') && !attributes.key?(:'is_null_empty_string') # rubocop:disable Style/StringLiterals self.is_estimate_current_event = attributes[:'isEstimateCurrentEvent'] unless attributes[:'isEstimateCurrentEvent'].nil? self.is_estimate_current_event = true if is_estimate_current_event.nil? && !attributes.key?(:'isEstimateCurrentEvent') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isEstimateCurrentEvent and :is_estimate_current_event' if attributes.key?(:'isEstimateCurrentEvent') && attributes.key?(:'is_estimate_current_event') self.is_estimate_current_event = attributes[:'is_estimate_current_event'] unless attributes[:'is_estimate_current_event'].nil? self.is_estimate_current_event = true if is_estimate_current_event.nil? && !attributes.key?(:'isEstimateCurrentEvent') && !attributes.key?(:'is_estimate_current_event') # rubocop:disable Style/StringLiterals self.is_keep_time_key = attributes[:'isKeepTimeKey'] unless attributes[:'isKeepTimeKey'].nil? self.is_keep_time_key = false if is_keep_time_key.nil? && !attributes.key?(:'isKeepTimeKey') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isKeepTimeKey and :is_keep_time_key' if attributes.key?(:'isKeepTimeKey') && attributes.key?(:'is_keep_time_key') self.is_keep_time_key = attributes[:'is_keep_time_key'] unless attributes[:'is_keep_time_key'].nil? self.is_keep_time_key = false if is_keep_time_key.nil? && !attributes.key?(:'isKeepTimeKey') && !attributes.key?(:'is_keep_time_key') # rubocop:disable Style/StringLiterals self.timeout_in_milliseconds = attributes[:'timeoutInMilliseconds'] if attributes[:'timeoutInMilliseconds'] raise 'You cannot provide both :timeoutInMilliseconds and :timeout_in_milliseconds' if attributes.key?(:'timeoutInMilliseconds') && attributes.key?(:'timeout_in_milliseconds') self.timeout_in_milliseconds = attributes[:'timeout_in_milliseconds'] if attributes[:'timeout_in_milliseconds'] end |
Instance Attribute Details
#field_time_key ⇒ String
Specify time field for the event time. If the event doesn’t have this field, the current time is used.
35 36 37 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 35 def field_time_key @field_time_key end |
#is_estimate_current_event ⇒ BOOLEAN
If true, use Fluent::EventTime.now(current time) as a timestamp when time_key is specified.
51 52 53 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 51 def is_estimate_current_event @is_estimate_current_event end |
#is_keep_time_key ⇒ BOOLEAN
If true, keep time field in the record.
55 56 57 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 55 def is_keep_time_key @is_keep_time_key end |
#is_null_empty_string ⇒ BOOLEAN
If true, an empty string field is replaced with nil.
47 48 49 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 47 def is_null_empty_string @is_null_empty_string end |
#null_value_pattern ⇒ String
Specify the null value pattern.
43 44 45 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 43 def null_value_pattern @null_value_pattern end |
#parser_type ⇒ String
[Required] Type of fluent parser.
31 32 33 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 31 def parser_type @parser_type end |
#timeout_in_milliseconds ⇒ Integer
Specify the timeout for parse processing. This is mainly for detecting an incorrect regexp pattern.
59 60 61 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 59 def timeout_in_milliseconds @timeout_in_milliseconds end |
#types ⇒ Hash<String, String>
Specify types for converting a field into another type.
39 40 41 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 39 def types @types end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 62 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'parser_type': :'parserType', 'field_time_key': :'fieldTimeKey', 'types': :'types', 'null_value_pattern': :'nullValuePattern', 'is_null_empty_string': :'isNullEmptyString', 'is_estimate_current_event': :'isEstimateCurrentEvent', 'is_keep_time_key': :'isKeepTimeKey', 'timeout_in_milliseconds': :'timeoutInMilliseconds' # rubocop:enable Style/SymbolLiteral } end |
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 98 def self.get_subtype(object_hash) type = object_hash[:'parserType'] # rubocop:disable Style/SymbolLiteral return 'OCI::Logging::Models::UnifiedAgentMultilineGrokParser' if type == 'MULTILINE_GROK' return 'OCI::Logging::Models::UnifiedJSONParser' if type == 'JSON' return 'OCI::Logging::Models::UnifiedAgentGrokParser' if type == 'GROK' return 'OCI::Logging::Models::UnifiedAgentNoneParser' if type == 'NONE' return 'OCI::Logging::Models::UnifiedAgentSyslogParser' if type == 'SYSLOG' return 'OCI::Logging::Models::UnifiedAgentAuditdParser' if type == 'AUDITD' return 'OCI::Logging::Models::UnifiedAgentApache2Parser' if type == 'APACHE2' return 'OCI::Logging::Models::UnifiedAgentRegexParser' if type == 'REGEXP' return 'OCI::Logging::Models::UnifiedAgentMultilineParser' if type == 'MULTILINE' return 'OCI::Logging::Models::UnifiedAgentTsvParser' if type == 'TSV' return 'OCI::Logging::Models::UnifiedAgentApacheErrorParser' if type == 'APACHE_ERROR' return 'OCI::Logging::Models::UnifiedAgentMsgpackParser' if type == 'MSGPACK' return 'OCI::Logging::Models::UnifiedAgentCsvParser' if type == 'CSV' # TODO: Log a warning when the subtype is not found. 'OCI::Logging::Models::UnifiedAgentParser' end |
.swagger_types ⇒ Object
Attribute type mapping.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 78 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'parser_type': :'String', 'field_time_key': :'String', 'types': :'Hash<String, String>', 'null_value_pattern': :'String', 'is_null_empty_string': :'BOOLEAN', 'is_estimate_current_event': :'BOOLEAN', 'is_keep_time_key': :'BOOLEAN', 'timeout_in_milliseconds': :'Integer' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 211 def ==(other) return true if equal?(other) self.class == other.class && parser_type == other.parser_type && field_time_key == other.field_time_key && types == other.types && null_value_pattern == other.null_value_pattern && is_null_empty_string == other.is_null_empty_string && is_estimate_current_event == other.is_estimate_current_event && is_keep_time_key == other.is_keep_time_key && timeout_in_milliseconds == other.timeout_in_milliseconds end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 248 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
228 229 230 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 228 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
237 238 239 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 237 def hash [parser_type, field_time_key, types, null_value_pattern, is_null_empty_string, is_estimate_current_event, is_keep_time_key, timeout_in_milliseconds].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
281 282 283 284 285 286 287 288 289 290 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 281 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_s ⇒ String
Returns the string representation of the object
275 276 277 |
# File 'lib/oci/logging/models/unified_agent_parser.rb', line 275 def to_s to_hash.to_s end |