Class: OCI::LogAnalytics::Models::AbstractField

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/log_analytics/models/abstract_field.rb

Overview

Generic field defining all attributes common to all querylanguage fields.

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

Field, FieldsAddRemoveField, FunctionField, SortField

Constant Summary collapse

NAME_ENUM =
[
  NAME_FIELD = 'FIELD'.freeze,
  NAME_FIELDS = 'FIELDS'.freeze,
  NAME_FUNCTION = 'FUNCTION'.freeze,
  NAME_SORT = 'SORT'.freeze,
  NAME_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
VALUE_TYPE_ENUM =
[
  VALUE_TYPE_BOOLEAN = 'BOOLEAN'.freeze,
  VALUE_TYPE_STRING = 'STRING'.freeze,
  VALUE_TYPE_DOUBLE = 'DOUBLE'.freeze,
  VALUE_TYPE_FLOAT = 'FLOAT'.freeze,
  VALUE_TYPE_LONG = 'LONG'.freeze,
  VALUE_TYPE_INTEGER = 'INTEGER'.freeze,
  VALUE_TYPE_TIMESTAMP = 'TIMESTAMP'.freeze,
  VALUE_TYPE_FACET = 'FACET'.freeze,
  VALUE_TYPE_TABLE = 'TABLE'.freeze,
  VALUE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AbstractField

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :name (String)

    The value to assign to the #name property

  • :display_name (String)

    The value to assign to the #display_name property

  • :is_declared (BOOLEAN)

    The value to assign to the #is_declared property

  • :original_display_names (Array<String>)

    The value to assign to the #original_display_names property

  • :internal_name (String)

    The value to assign to the #internal_name property

  • :value_type (String)

    The value to assign to the #value_type property

  • :is_groupable (BOOLEAN)

    The value to assign to the #is_groupable property

  • :is_duration (BOOLEAN)

    The value to assign to the #is_duration property

  • :_alias (String)

    The value to assign to the #_alias property

  • :filter_query_string (String)

    The value to assign to the #filter_query_string property

  • :unit_type (String)

    The value to assign to the #unit_type property



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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 164

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.name = attributes[:'name'] if attributes[:'name']

  self.display_name = attributes[:'displayName'] if attributes[:'displayName']

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

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

  self.is_declared = attributes[:'isDeclared'] unless attributes[:'isDeclared'].nil?

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

  self.is_declared = attributes[:'is_declared'] unless attributes[:'is_declared'].nil?

  self.original_display_names = attributes[:'originalDisplayNames'] if attributes[:'originalDisplayNames']

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

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

  self.internal_name = attributes[:'internalName'] if attributes[:'internalName']

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

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

  self.value_type = attributes[:'valueType'] if attributes[:'valueType']

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

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

  self.is_groupable = attributes[:'isGroupable'] unless attributes[:'isGroupable'].nil?

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

  self.is_groupable = attributes[:'is_groupable'] unless attributes[:'is_groupable'].nil?

  self.is_duration = attributes[:'isDuration'] unless attributes[:'isDuration'].nil?

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

  self.is_duration = attributes[:'is_duration'] unless attributes[:'is_duration'].nil?

  self._alias = attributes[:'alias'] if attributes[:'alias']

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

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

  self.filter_query_string = attributes[:'filterQueryString'] if attributes[:'filterQueryString']

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

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

  self.unit_type = attributes[:'unitType'] if attributes[:'unitType']

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

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

Instance Attribute Details

#_aliasString

Alias of field if renamed by queryStrng.

Returns:

  • (String)


79
80
81
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 79

def _alias
  @_alias
end

#display_nameString

Field display name - will be alias if field is renamed by queryStrng.

Returns:

  • (String)


43
44
45
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 43

def display_name
  @display_name
end

#filter_query_stringString

Query used to derive this field if specified.

Returns:

  • (String)


84
85
86
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 84

def filter_query_string
  @filter_query_string
end

#internal_nameString

Internal identifier for the field.

Returns:

  • (String)


59
60
61
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 59

def internal_name
  @internal_name
end

#is_declaredBOOLEAN

Field denoting if this is a declaration of the field in the queryString.

Returns:

  • (BOOLEAN)


48
49
50
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 48

def is_declared
  @is_declared
end

#is_durationBOOLEAN

Identifies if this field format is a duration.

Returns:

  • (BOOLEAN)


74
75
76
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 74

def is_duration
  @is_duration
end

#is_groupableBOOLEAN

Identifies if this field can be used as a grouping field in any grouping command.

Returns:

  • (BOOLEAN)


69
70
71
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 69

def is_groupable
  @is_groupable
end

#nameString

[Required] Field type classification.

Returns:

  • (String)


38
39
40
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 38

def name
  @name
end

#original_display_namesArray<String>

Same as displayName unless field renamed in which case this will hold the original display names for the field across all renames.

Returns:

  • (Array<String>)


54
55
56
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 54

def original_display_names
  @original_display_names
end

#unit_typeString

Field denoting field unit type.

Returns:

  • (String)


89
90
91
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 89

def unit_type
  @unit_type
end

#value_typeString

Field denoting field data type.

Returns:

  • (String)


64
65
66
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 64

def value_type
  @value_type
end

Class Method Details

.attribute_mapObject

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



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 92

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'display_name': :'displayName',
    'is_declared': :'isDeclared',
    'original_display_names': :'originalDisplayNames',
    'internal_name': :'internalName',
    'value_type': :'valueType',
    'is_groupable': :'isGroupable',
    'is_duration': :'isDuration',
    '_alias': :'alias',
    'filter_query_string': :'filterQueryString',
    'unit_type': :'unitType'
    # 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.



134
135
136
137
138
139
140
141
142
143
144
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 134

def self.get_subtype(object_hash)
  type = object_hash[:'name'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::LogAnalytics::Models::FieldsAddRemoveField' if type == 'FIELDS'
  return 'OCI::LogAnalytics::Models::FunctionField' if type == 'FUNCTION'
  return 'OCI::LogAnalytics::Models::Field' if type == 'FIELD'
  return 'OCI::LogAnalytics::Models::SortField' if type == 'SORT'

  # TODO: Log a warning when the subtype is not found.
  'OCI::LogAnalytics::Models::AbstractField'
end

.swagger_typesObject

Attribute type mapping.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 111

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'display_name': :'String',
    'is_declared': :'BOOLEAN',
    'original_display_names': :'Array<String>',
    'internal_name': :'String',
    'value_type': :'String',
    'is_groupable': :'BOOLEAN',
    'is_duration': :'BOOLEAN',
    '_alias': :'String',
    'filter_query_string': :'String',
    'unit_type': :'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



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 266

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

  self.class == other.class &&
    name == other.name &&
    display_name == other.display_name &&
    is_declared == other.is_declared &&
    original_display_names == other.original_display_names &&
    internal_name == other.internal_name &&
    value_type == other.value_type &&
    is_groupable == other.is_groupable &&
    is_duration == other.is_duration &&
    _alias == other._alias &&
    filter_query_string == other.filter_query_string &&
    unit_type == other.unit_type
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



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 306

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


286
287
288
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 286

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



295
296
297
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 295

def hash
  [name, display_name, is_declared, original_display_names, internal_name, value_type, is_groupable, is_duration, _alias, filter_query_string, unit_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



339
340
341
342
343
344
345
346
347
348
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 339

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



333
334
335
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 333

def to_s
  to_hash.to_s
end