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_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



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
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
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 162

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)


77
78
79
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 77

def _alias
  @_alias
end

#display_nameString

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

Returns:

  • (String)


41
42
43
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 41

def display_name
  @display_name
end

#filter_query_stringString

Query used to derive this field if specified.

Returns:

  • (String)


82
83
84
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 82

def filter_query_string
  @filter_query_string
end

#internal_nameString

Internal identifier for the field.

Returns:

  • (String)


57
58
59
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 57

def internal_name
  @internal_name
end

#is_declaredBOOLEAN

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

Returns:

  • (BOOLEAN)


46
47
48
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 46

def is_declared
  @is_declared
end

#is_durationBOOLEAN

Identifies if this field format is a duration.

Returns:

  • (BOOLEAN)


72
73
74
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 72

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)


67
68
69
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 67

def is_groupable
  @is_groupable
end

#nameString

[Required] Field type classification.

Returns:

  • (String)


36
37
38
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 36

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>)


52
53
54
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 52

def original_display_names
  @original_display_names
end

#unit_typeString

Field denoting field unit type.

Returns:

  • (String)


87
88
89
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 87

def unit_type
  @unit_type
end

#value_typeString

Field denoting field data type.

Returns:

  • (String)


62
63
64
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 62

def value_type
  @value_type
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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.



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

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



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

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



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

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


284
285
286
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 284

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



293
294
295
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 293

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



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

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



331
332
333
# File 'lib/oci/log_analytics/models/abstract_field.rb', line 331

def to_s
  to_hash.to_s
end