Class: OCI::LogAnalytics::Models::IngestTimeRuleFieldCondition

Inherits:
IngestTimeRuleCondition show all
Defined in:
lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb

Overview

The field condition(s) to evaluate for an ingest time rule.

Constant Summary collapse

FIELD_OPERATOR_ENUM =
[
  FIELD_OPERATOR_EQUAL = 'EQUAL'.freeze,
  FIELD_OPERATOR_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from IngestTimeRuleCondition

OCI::LogAnalytics::Models::IngestTimeRuleCondition::KIND_ENUM

Instance Attribute Summary collapse

Attributes inherited from IngestTimeRuleCondition

#kind

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from IngestTimeRuleCondition

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ IngestTimeRuleFieldCondition

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 70

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

  attributes['kind'] = 'FIELD'

  super(attributes)

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

  self.field_name = attributes[:'fieldName'] if attributes[:'fieldName']

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

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

  self.field_operator = attributes[:'fieldOperator'] if attributes[:'fieldOperator']

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

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

  self.field_value = attributes[:'fieldValue'] if attributes[:'fieldValue']

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

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

  self.additional_conditions = attributes[:'additionalConditions'] if attributes[:'additionalConditions']

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

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

Instance Attribute Details

#additional_conditionsArray<OCI::LogAnalytics::Models::IngestTimeRuleAdditionalFieldCondition>

Optional additional condition(s) to be evaluated.



32
33
34
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 32

def additional_conditions
  @additional_conditions
end

#field_nameString

[Required] The field name to be evaluated.

Returns:

  • (String)


20
21
22
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 20

def field_name
  @field_name
end

#field_operatorString

[Required] The operator to be used for evaluating the field.

Returns:

  • (String)


24
25
26
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 24

def field_operator
  @field_operator
end

#field_valueString

[Required] The field value to be evaluated.

Returns:

  • (String)


28
29
30
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 28

def field_value
  @field_value
end

Class Method Details

.attribute_mapObject

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



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 35

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'kind': :'kind',
    'field_name': :'fieldName',
    'field_operator': :'fieldOperator',
    'field_value': :'fieldValue',
    'additional_conditions': :'additionalConditions'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 48

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'kind': :'String',
    'field_name': :'String',
    'field_operator': :'String',
    'field_value': :'String',
    'additional_conditions': :'Array<OCI::LogAnalytics::Models::IngestTimeRuleAdditionalFieldCondition>'
    # 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



125
126
127
128
129
130
131
132
133
134
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 125

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

  self.class == other.class &&
    kind == other.kind &&
    field_name == other.field_name &&
    field_operator == other.field_operator &&
    field_value == other.field_value &&
    additional_conditions == other.additional_conditions
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



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 159

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


139
140
141
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 139

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



148
149
150
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 148

def hash
  [kind, field_name, field_operator, field_value, additional_conditions].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



192
193
194
195
196
197
198
199
200
201
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 192

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



186
187
188
# File 'lib/oci/log_analytics/models/ingest_time_rule_field_condition.rb', line 186

def to_s
  to_hash.to_s
end