Class: OCI::Opsi::Models::DataObjectTemplatizedQuery

Inherits:
DataObjectQuery show all
Defined in:
lib/oci/opsi/models/data_object_templatized_query.rb

Overview

Information required in a structured template to form and execute query on a data object.

Constant Summary

Constants inherited from DataObjectQuery

OCI::Opsi::Models::DataObjectQuery::QUERY_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from DataObjectQuery

#query_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DataObjectQuery

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ DataObjectTemplatizedQuery

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 80

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

  attributes['queryType'] = 'TEMPLATIZED_QUERY'

  super(attributes)

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

  self.select_list = attributes[:'selectList'] if attributes[:'selectList']

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

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

  self.where_conditions_list = attributes[:'whereConditionsList'] if attributes[:'whereConditionsList']

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

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

  self.group_by_list = attributes[:'groupByList'] if attributes[:'groupByList']

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

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

  self.having_conditions_list = attributes[:'havingConditionsList'] if attributes[:'havingConditionsList']

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

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

  self.order_by_list = attributes[:'orderByList'] if attributes[:'orderByList']

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

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

  self.time_filters = attributes[:'timeFilters'] if attributes[:'timeFilters']

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

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

Instance Attribute Details

#group_by_listArray<String>

List of items to be added into the GROUP BY clause of the query; items will be added with comma separation.

Returns:

  • (Array<String>)


25
26
27
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 25

def group_by_list
  @group_by_list
end

#having_conditions_listArray<String>

List of items to be added into the HAVING clause of the query; items will be added with AND separation.

Returns:

  • (Array<String>)


29
30
31
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 29

def having_conditions_list
  @having_conditions_list
end

#order_by_listArray<String>

List of items to be added into the ORDER BY clause of the query; items will be added with comma separation.

Returns:

  • (Array<String>)


33
34
35
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 33

def order_by_list
  @order_by_list
end

#select_listArray<String>

List of items to be added into the SELECT clause of the query; items will be added with comma separation.

Returns:

  • (Array<String>)


13
14
15
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 13

def select_list
  @select_list
end

#time_filtersOCI::Opsi::Models::DataObjectQueryTimeFilters



36
37
38
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 36

def time_filters
  @time_filters
end

#where_conditions_listArray<String>

List of items to be added into the WHERE clause of the query; items will be added with AND separation. Item can contain a single condition or multiple conditions. Single condition e.g: "optimizer_mode='mode1'" Multiple conditions e.g: (module='module1' OR module='module2')

Returns:

  • (Array<String>)


21
22
23
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 21

def where_conditions_list
  @where_conditions_list
end

Class Method Details

.attribute_mapObject

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



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 39

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'query_type': :'queryType',
    'select_list': :'selectList',
    'where_conditions_list': :'whereConditionsList',
    'group_by_list': :'groupByList',
    'having_conditions_list': :'havingConditionsList',
    'order_by_list': :'orderByList',
    'time_filters': :'timeFilters'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 54

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'query_type': :'String',
    'select_list': :'Array<String>',
    'where_conditions_list': :'Array<String>',
    'group_by_list': :'Array<String>',
    'having_conditions_list': :'Array<String>',
    'order_by_list': :'Array<String>',
    'time_filters': :'OCI::Opsi::Models::DataObjectQueryTimeFilters'
    # 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



134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 134

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

  self.class == other.class &&
    query_type == other.query_type &&
    select_list == other.select_list &&
    where_conditions_list == other.where_conditions_list &&
    group_by_list == other.group_by_list &&
    having_conditions_list == other.having_conditions_list &&
    order_by_list == other.order_by_list &&
    time_filters == other.time_filters
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



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 170

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


150
151
152
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 150

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



159
160
161
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 159

def hash
  [query_type, select_list, where_conditions_list, group_by_list, having_conditions_list, order_by_list, time_filters].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



203
204
205
206
207
208
209
210
211
212
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 203

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



197
198
199
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 197

def to_s
  to_hash.to_s
end