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_CUSLTER_SPLIT = 'CUSLTER_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_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):



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

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)


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

def category
  @category
end

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

Fields declared in command fragment from user specified query string.



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

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)


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

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)


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

def internal_query_string
  @internal_query_string
end

#nameString

[Required] Name of querylanguage command

Returns:

  • (String)


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

def name
  @name
end

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

Fields referenced in command fragment from user specified query string.



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

def referenced_fields
  @referenced_fields
end

Class Method Details

.attribute_mapObject

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



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 85

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.



117
118
119
120
121
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
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 117

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::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::EventStatsCommandDescriptor' if type == 'EVENT_STATS'
  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::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::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.



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 99

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



230
231
232
233
234
235
236
237
238
239
240
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 230

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



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 265

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


245
246
247
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 245

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

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



298
299
300
301
302
303
304
305
306
307
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 298

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



292
293
294
# File 'lib/oci/log_analytics/models/abstract_command_descriptor.rb', line 292

def to_s
  to_hash.to_s
end