Class: OCI::LogAnalytics::Models::AbstractCommandDescriptor

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

Overview

Generic command descriptor defining all attributes common to all querylanguage commands for parse output.

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

Constant Summary collapse

NAME_ENUM =
[
  NAME_COMMAND = 'COMMAND'.freeze,
  NAME_SEARCH = 'SEARCH'.freeze,
  NAME_STATS = 'STATS'.freeze,
  NAME_TIME_STATS = 'TIME_STATS'.freeze,
  NAME_SORT = 'SORT'.freeze,
  NAME_FIELDS = 'FIELDS'.freeze,
  NAME_ADD_FIELDS = 'ADD_FIELDS'.freeze,
  NAME_LINK = 'LINK'.freeze,
  NAME_LINK_DETAILS = 'LINK_DETAILS'.freeze,
  NAME_CLUSTER = 'CLUSTER'.freeze,
  NAME_CLUSTER_DETAILS = 'CLUSTER_DETAILS'.freeze,
  NAME_CLUSTER_SPLIT = 'CLUSTER_SPLIT'.freeze,
  NAME_EVAL = 'EVAL'.freeze,
  NAME_EXTRACT = 'EXTRACT'.freeze,
  NAME_EVENT_STATS = 'EVENT_STATS'.freeze,
  NAME_BUCKET = 'BUCKET'.freeze,
  NAME_CLASSIFY = 'CLASSIFY'.freeze,
  NAME_TOP = 'TOP'.freeze,
  NAME_BOTTOM = 'BOTTOM'.freeze,
  NAME_HEAD = 'HEAD'.freeze,
  NAME_TAIL = 'TAIL'.freeze,
  NAME_FIELD_SUMMARY = 'FIELD_SUMMARY'.freeze,
  NAME_REGEX = 'REGEX'.freeze,
  NAME_RENAME = 'RENAME'.freeze,
  NAME_TIME_COMPARE = 'TIME_COMPARE'.freeze,
  NAME_WHERE = 'WHERE'.freeze,
  NAME_CLUSTER_COMPARE = 'CLUSTER_COMPARE'.freeze,
  NAME_DELETE = 'DELETE'.freeze,
  NAME_DELTA = 'DELTA'.freeze,
  NAME_DISTINCT = 'DISTINCT'.freeze,
  NAME_SEARCH_LOOKUP = 'SEARCH_LOOKUP'.freeze,
  NAME_LOOKUP = 'LOOKUP'.freeze,
  NAME_DEMO_MODE = 'DEMO_MODE'.freeze,
  NAME_MACRO = 'MACRO'.freeze,
  NAME_MULTI_SEARCH = 'MULTI_SEARCH'.freeze,
  NAME_HIGHLIGHT = 'HIGHLIGHT'.freeze,
  NAME_HIGHLIGHT_ROWS = 'HIGHLIGHT_ROWS'.freeze,
  NAME_HIGHLIGHT_GROUPS = 'HIGHLIGHT_GROUPS'.freeze,
  NAME_CREATE_VIEW = 'CREATE_VIEW'.freeze,
  NAME_MAP = 'MAP'.freeze,
  NAME_NLP = 'NLP'.freeze,
  NAME_COMPARE = 'COMPARE'.freeze,
  NAME_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AbstractCommandDescriptor

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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

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_query_string = attributes[:'displayQueryString'] if attributes[:'displayQueryString']

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

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

  self.internal_query_string = attributes[:'internalQueryString'] if attributes[:'internalQueryString']

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

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

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

  self.referenced_fields = attributes[:'referencedFields'] if attributes[:'referencedFields']

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

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

  self.declared_fields = attributes[:'declaredFields'] if attributes[:'declaredFields']

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

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

Instance Attribute Details

#categoryString

querylanguage command designation for example; reporting vs filtering

Returns:

  • (String)


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

def category
  @category
end

#declared_fieldsArray<OCI::LogAnalytics::Models::AbstractField>

Fields declared in command fragment from user specified query string.



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

def declared_fields
  @declared_fields
end

#display_query_stringString

[Required] Command fragment display string from user specified query string formatted by query builder.

Returns:

  • (String)


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

def display_query_string
  @display_query_string
end

#internal_query_stringString

[Required] Command fragment internal string from user specified query string formatted by query builder.

Returns:

  • (String)


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

def internal_query_string
  @internal_query_string
end

#nameString

[Required] Name of querylanguage command

Returns:

  • (String)


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

def name
  @name
end

#referenced_fieldsArray<OCI::LogAnalytics::Models::AbstractField>

Fields referenced in command fragment from user specified query string.



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

def referenced_fields
  @referenced_fields
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
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 90

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'display_query_string': :'displayQueryString',
    'internal_query_string': :'internalQueryString',
    'category': :'category',
    'referenced_fields': :'referencedFields',
    'declared_fields': :'declaredFields'
    # 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.



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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 122

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

  return 'OCI::LogAnalytics::Models::TopCommandDescriptor' if type == 'TOP'
  return 'OCI::LogAnalytics::Models::HighlightCommandDescriptor' if type == 'HIGHLIGHT'
  return 'OCI::LogAnalytics::Models::MultiSearchCommandDescriptor' if type == 'MULTI_SEARCH'
  return 'OCI::LogAnalytics::Models::CompareCommandDescriptor' if type == 'COMPARE'
  return 'OCI::LogAnalytics::Models::StatsCommandDescriptor' if type == 'STATS'
  return 'OCI::LogAnalytics::Models::TimeCompareCommandDescriptor' if type == 'TIME_COMPARE'
  return 'OCI::LogAnalytics::Models::TailCommandDescriptor' if type == 'TAIL'
  return 'OCI::LogAnalytics::Models::RegexCommandDescriptor' if type == 'REGEX'
  return 'OCI::LogAnalytics::Models::DeltaCommandDescriptor' if type == 'DELTA'
  return 'OCI::LogAnalytics::Models::LookupCommandDescriptor' if type == 'LOOKUP'
  return 'OCI::LogAnalytics::Models::DemoModeCommandDescriptor' if type == 'DEMO_MODE'
  return 'OCI::LogAnalytics::Models::FieldSummaryCommandDescriptor' if type == 'FIELD_SUMMARY'
  return 'OCI::LogAnalytics::Models::MapCommandDescriptor' if type == 'MAP'
  return 'OCI::LogAnalytics::Models::EventStatsCommandDescriptor' if type == 'EVENT_STATS'
  return 'OCI::LogAnalytics::Models::HighlightGroupsCommandDescriptor' if type == 'HIGHLIGHT_GROUPS'
  return 'OCI::LogAnalytics::Models::WhereCommandDescriptor' if type == 'WHERE'
  return 'OCI::LogAnalytics::Models::ClusterSplitCommandDescriptor' if type == 'CLUSTER_SPLIT'
  return 'OCI::LogAnalytics::Models::TimeStatsCommandDescriptor' if type == 'TIME_STATS'
  return 'OCI::LogAnalytics::Models::ClusterCommandDescriptor' if type == 'CLUSTER'
  return 'OCI::LogAnalytics::Models::ClusterDetailsCommandDescriptor' if type == 'CLUSTER_DETAILS'
  return 'OCI::LogAnalytics::Models::DeleteCommandDescriptor' if type == 'DELETE'
  return 'OCI::LogAnalytics::Models::ClusterCompareCommandDescriptor' if type == 'CLUSTER_COMPARE'
  return 'OCI::LogAnalytics::Models::SearchCommandDescriptor' if type == 'SEARCH'
  return 'OCI::LogAnalytics::Models::BucketCommandDescriptor' if type == 'BUCKET'
  return 'OCI::LogAnalytics::Models::CommandDescriptor' if type == 'COMMAND'
  return 'OCI::LogAnalytics::Models::DistinctCommandDescriptor' if type == 'DISTINCT'
  return 'OCI::LogAnalytics::Models::LinkCommandDescriptor' if type == 'LINK'
  return 'OCI::LogAnalytics::Models::SortCommandDescriptor' if type == 'SORT'
  return 'OCI::LogAnalytics::Models::ExtractCommandDescriptor' if type == 'EXTRACT'
  return 'OCI::LogAnalytics::Models::NlpCommandDescriptor' if type == 'NLP'
  return 'OCI::LogAnalytics::Models::BottomCommandDescriptor' if type == 'BOTTOM'
  return 'OCI::LogAnalytics::Models::FieldsCommandDescriptor' if type == 'FIELDS'
  return 'OCI::LogAnalytics::Models::HighlightRowsCommandDescriptor' if type == 'HIGHLIGHT_ROWS'
  return 'OCI::LogAnalytics::Models::MacroCommandDescriptor' if type == 'MACRO'
  return 'OCI::LogAnalytics::Models::ClassifyCommandDescriptor' if type == 'CLASSIFY'
  return 'OCI::LogAnalytics::Models::LinkDetailsCommandDescriptor' if type == 'LINK_DETAILS'
  return 'OCI::LogAnalytics::Models::SearchLookupCommandDescriptor' if type == 'SEARCH_LOOKUP'
  return 'OCI::LogAnalytics::Models::HeadCommandDescriptor' if type == 'HEAD'
  return 'OCI::LogAnalytics::Models::CreateViewCommandDescriptor' if type == 'CREATE_VIEW'
  return 'OCI::LogAnalytics::Models::AddFieldsCommandDescriptor' if type == 'ADD_FIELDS'
  return 'OCI::LogAnalytics::Models::EvalCommandDescriptor' if type == 'EVAL'
  return 'OCI::LogAnalytics::Models::RenameCommandDescriptor' if type == 'RENAME'

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

.swagger_typesObject

Attribute type mapping.



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 104

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'display_query_string': :'String',
    'internal_query_string': :'String',
    'category': :'String',
    'referenced_fields': :'Array<OCI::LogAnalytics::Models::AbstractField>',
    'declared_fields': :'Array<OCI::LogAnalytics::Models::AbstractField>'
    # 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



240
241
242
243
244
245
246
247
248
249
250
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 240

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

  self.class == other.class &&
    name == other.name &&
    display_query_string == other.display_query_string &&
    internal_query_string == other.internal_query_string &&
    category == other.category &&
    referenced_fields == other.referenced_fields &&
    declared_fields == other.declared_fields
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



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 275

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


255
256
257
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 255

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



264
265
266
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 264

def hash
  [name, display_query_string, internal_query_string, category, referenced_fields, declared_fields].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



308
309
310
311
312
313
314
315
316
317
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 308

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



302
303
304
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 302

def to_s
  to_hash.to_s
end