Class: OCI::LogAnalytics::Models::GeoStatsCommandDescriptor

Inherits:
AbstractCommandDescriptor show all
Defined in:
lib/oci/log_analytics/models/geo_stats_command_descriptor.rb

Overview

Command descriptor for querylanguage GEOSTATS command. This is similiar to STATS with some built in functions for City, State and Country by Coordinates.

Constant Summary collapse

INCLUDE_ENUM =
[
  INCLUDE_CLIENT = 'CLIENT'.freeze,
  INCLUDE_SERVER = 'SERVER'.freeze,
  INCLUDE_CLIENT_AND_SERVER = 'CLIENT_AND_SERVER'.freeze,
  INCLUDE_CUSTOM = 'CUSTOM'.freeze,
  INCLUDE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from AbstractCommandDescriptor

AbstractCommandDescriptor::NAME_ENUM

Instance Attribute Summary collapse

Attributes inherited from AbstractCommandDescriptor

#category, #declared_fields, #display_query_string, #internal_query_string, #is_hidden, #name, #referenced_fields

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommandDescriptor

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ GeoStatsCommandDescriptor

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
171
172
173
174
175
176
177
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 128

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['name'] = 'GEO_STATS'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

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

  self.city_field = attributes[:'cityField'] if attributes[:'cityField']

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

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

  self.region_field = attributes[:'regionField'] if attributes[:'regionField']

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

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

  self.country_field = attributes[:'countryField'] if attributes[:'countryField']

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

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

  self.continent_field = attributes[:'continentField'] if attributes[:'continentField']

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

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

  self.coordinates_field = attributes[:'coordinatesField'] if attributes[:'coordinatesField']

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

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

  self.group_by_fields = attributes[:'groupByFields'] if attributes[:'groupByFields']

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

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

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

Instance Attribute Details

#city_fieldOCI::LogAnalytics::Models::AbstractField

The city field to use. Only applicable when include = CUSTOM.



30
31
32
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 30

def city_field
  @city_field
end

#continent_fieldOCI::LogAnalytics::Models::AbstractField

The continent field to use. Only applicable when include = CUSTOM.



45
46
47
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 45

def continent_field
  @continent_field
end

#coordinates_fieldOCI::LogAnalytics::Models::AbstractField

The coordinates field to use. Only applicable when include = CUSTOM.



50
51
52
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 50

def coordinates_field
  @coordinates_field
end

#country_fieldOCI::LogAnalytics::Models::AbstractField

The country field to use. Only applicable when include = CUSTOM.



40
41
42
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 40

def country_field
  @country_field
end

#functionsArray<OCI::LogAnalytics::Models::FunctionField>

Statistical functions specified in the query string. At least 1 is required for a GEOSTATS command.



60
61
62
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 60

def functions
  @functions
end

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

Group by fields if specified in the query string. Required if include = CUSTOM.



55
56
57
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 55

def group_by_fields
  @group_by_fields
end

#includeString

Indicates which coordinates to show. Either client, server, client and server or custom. If custom is specified at least one of coordinatesField, regionField or countryField is required. Defaults to client.

Returns:

  • (String)


25
26
27
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 25

def include
  @include
end

#region_fieldOCI::LogAnalytics::Models::AbstractField

The region field to use. Only applicable when include = CUSTOM.



35
36
37
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 35

def region_field
  @region_field
end

Class Method Details

.attribute_mapObject

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



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 63

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',
    'is_hidden': :'isHidden',
    'include': :'include',
    'city_field': :'cityField',
    'region_field': :'regionField',
    'country_field': :'countryField',
    'continent_field': :'continentField',
    'coordinates_field': :'coordinatesField',
    'group_by_fields': :'groupByFields',
    'functions': :'functions'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

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>',
    'is_hidden': :'BOOLEAN',
    'include': :'String',
    'city_field': :'OCI::LogAnalytics::Models::AbstractField',
    'region_field': :'OCI::LogAnalytics::Models::AbstractField',
    'country_field': :'OCI::LogAnalytics::Models::AbstractField',
    'continent_field': :'OCI::LogAnalytics::Models::AbstractField',
    'coordinates_field': :'OCI::LogAnalytics::Models::AbstractField',
    'group_by_fields': :'Array<OCI::LogAnalytics::Models::AbstractField>',
    'functions': :'Array<OCI::LogAnalytics::Models::FunctionField>'
    # 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



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/geo_stats_command_descriptor.rb', line 199

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 &&
    is_hidden == other.is_hidden &&
    include == other.include &&
    city_field == other.city_field &&
    region_field == other.region_field &&
    country_field == other.country_field &&
    continent_field == other.continent_field &&
    coordinates_field == other.coordinates_field &&
    group_by_fields == other.group_by_fields &&
    functions == other.functions
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



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 243

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


223
224
225
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 223

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



232
233
234
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 232

def hash
  [name, display_query_string, internal_query_string, category, referenced_fields, declared_fields, is_hidden, include, city_field, region_field, country_field, continent_field, coordinates_field, group_by_fields, functions].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



276
277
278
279
280
281
282
283
284
285
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 276

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



270
271
272
# File 'lib/oci/log_analytics/models/geo_stats_command_descriptor.rb', line 270

def to_s
  to_hash.to_s
end