class OCI::LogAnalytics::Models::AbstractCommandDescriptor

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

Constants

NAME_ENUM

Attributes

category[RW]

querylanguage command designation for example; reporting vs filtering

@return [String]

declared_fields[RW]

Fields declared in command fragment from user specified query string.

@return [Array<OCI::LogAnalytics::Models::AbstractField>]

display_query_string[RW]

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

@return [String]

internal_query_string[RW]

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

@return [String]

name[R]

[Required] Name of querylanguage command

@return [String]

referenced_fields[RW]

Fields referenced in command fragment from user specified query string.

@return [Array<OCI::LogAnalytics::Models::AbstractField>]

Public Class Methods

attribute_map() click to toggle source

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

# 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) click to toggle source

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.

# 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
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :name The value to assign to the {#name} property @option attributes [String] :display_query_string The value to assign to the {#display_query_string} property @option attributes [String] :internal_query_string The value to assign to the {#internal_query_string} property @option attributes [String] :category The value to assign to the {#category} property @option attributes [Array<OCI::LogAnalytics::Models::AbstractField>] :referenced_fields The value to assign to the {#referenced_fields} property @option attributes [Array<OCI::LogAnalytics::Models::AbstractField>] :declared_fields The value to assign to the {#declared_fields} property

# 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
swagger_types() click to toggle source

Attribute type mapping.

# 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

Public Instance Methods

==(other) click to toggle source

Checks equality by comparing each attribute. @param [Object] other the other object to be compared

# 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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# 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) click to toggle source

@see the `==` method @param [Object] other the other object to be compared

# File lib/oci/log_analytics/models/abstract_command_descriptor.rb, line 255
def eql?(other)
  self == other
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# 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
name=(name) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] name Object to be assigned

# File lib/oci/log_analytics/models/abstract_command_descriptor.rb, line 224
def name=(name)
  # rubocop:disable Style/ConditionalAssignment
  if name && !NAME_ENUM.include?(name)
    OCI.logger.debug("Unknown value for 'name' [" + name + "]. Mapping to 'NAME_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @name = NAME_UNKNOWN_ENUM_VALUE
  else
    @name = name
  end
  # rubocop:enable Style/ConditionalAssignment
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# 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_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/oci/log_analytics/models/abstract_command_descriptor.rb, line 302
def to_s
  to_hash.to_s
end

Private Instance Methods

_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/oci/log_analytics/models/abstract_command_descriptor.rb, line 325
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end