Class: OCI::Opsi::Models::DataObjectQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/opsi/models/data_object_query.rb

Overview

Information required to form and execute query on a data object. 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

QUERY_TYPE_ENUM =
[
  QUERY_TYPE_TEMPLATIZED_QUERY = 'TEMPLATIZED_QUERY'.freeze,
  QUERY_TYPE_STANDARD_QUERY = 'STANDARD_QUERY'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DataObjectQuery

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/oci/opsi/models/data_object_query.rb', line 76

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.query_type = attributes[:'queryType'] if attributes[:'queryType']

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

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

  self.bind_params = attributes[:'bindParams'] if attributes[:'bindParams']

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

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

  self.query_execution_timeout_in_seconds = attributes[:'queryExecutionTimeoutInSeconds'] if attributes[:'queryExecutionTimeoutInSeconds']

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

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

Instance Attribute Details

#bind_paramsArray<OCI::Opsi::Models::DataObjectBindParameter>

List of bind parameters to be applied in the query.



23
24
25
# File 'lib/oci/opsi/models/data_object_query.rb', line 23

def bind_params
  @bind_params
end

#query_execution_timeout_in_secondsFloat

Timeout (in seconds) to be set for the data object query execution.

Returns:

  • (Float)


27
28
29
# File 'lib/oci/opsi/models/data_object_query.rb', line 27

def query_execution_timeout_in_seconds
  @query_execution_timeout_in_seconds
end

#query_typeString

[Required] Type of Query

Returns:

  • (String)


19
20
21
# File 'lib/oci/opsi/models/data_object_query.rb', line 19

def query_type
  @query_type
end

Class Method Details

.attribute_mapObject

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



30
31
32
33
34
35
36
37
38
# File 'lib/oci/opsi/models/data_object_query.rb', line 30

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'query_type': :'queryType',
    'bind_params': :'bindParams',
    'query_execution_timeout_in_seconds': :'queryExecutionTimeoutInSeconds'
    # 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.



56
57
58
59
60
61
62
63
64
# File 'lib/oci/opsi/models/data_object_query.rb', line 56

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

  return 'OCI::Opsi::Models::DataObjectStandardQuery' if type == 'STANDARD_QUERY'
  return 'OCI::Opsi::Models::DataObjectTemplatizedQuery' if type == 'TEMPLATIZED_QUERY'

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

.swagger_typesObject

Attribute type mapping.



41
42
43
44
45
46
47
48
49
# File 'lib/oci/opsi/models/data_object_query.rb', line 41

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'query_type': :'String',
    'bind_params': :'Array<OCI::Opsi::Models::DataObjectBindParameter>',
    'query_execution_timeout_in_seconds': :'Float'
    # 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



116
117
118
119
120
121
122
123
# File 'lib/oci/opsi/models/data_object_query.rb', line 116

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

  self.class == other.class &&
    query_type == other.query_type &&
    bind_params == other.bind_params &&
    query_execution_timeout_in_seconds == other.query_execution_timeout_in_seconds
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



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/opsi/models/data_object_query.rb', line 148

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


128
129
130
# File 'lib/oci/opsi/models/data_object_query.rb', line 128

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



137
138
139
# File 'lib/oci/opsi/models/data_object_query.rb', line 137

def hash
  [query_type, bind_params, query_execution_timeout_in_seconds].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



181
182
183
184
185
186
187
188
189
190
# File 'lib/oci/opsi/models/data_object_query.rb', line 181

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



175
176
177
# File 'lib/oci/opsi/models/data_object_query.rb', line 175

def to_s
  to_hash.to_s
end