Class: OCI::StackMonitoring::Models::SqlQueryProperties

Inherits:
MetricExtensionQueryProperties show all
Defined in:
lib/oci/stack_monitoring/models/sql_query_properties.rb

Overview

Query Properties applicable to SQL type of collection method

Constant Summary collapse

SQL_TYPE_ENUM =
[
  SQL_TYPE_STATEMENT = 'STATEMENT'.freeze,
  SQL_TYPE_SQL_SCRIPT = 'SQL_SCRIPT'.freeze,
  SQL_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from MetricExtensionQueryProperties

MetricExtensionQueryProperties::COLLECTION_METHOD_ENUM

Instance Attribute Summary collapse

Attributes inherited from MetricExtensionQueryProperties

#collection_method

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MetricExtensionQueryProperties

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ SqlQueryProperties

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 70

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

  attributes['collectionMethod'] = 'SQL'

  super(attributes)

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

  self.sql_type = attributes[:'sqlType'] if attributes[:'sqlType']

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

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

  self.sql_details = attributes[:'sqlDetails'] if attributes[:'sqlDetails']

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

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

  self.in_param_details = attributes[:'inParamDetails'] if attributes[:'inParamDetails']

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

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

  self.out_param_details = attributes[:'outParamDetails'] if attributes[:'outParamDetails']

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

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

Instance Attribute Details

#in_param_detailsArray<OCI::StackMonitoring::Models::SqlInParamDetails>

List of values and position of PL/SQL procedure IN parameters



29
30
31
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 29

def in_param_details
  @in_param_details
end

#out_param_detailsOCI::StackMonitoring::Models::SqlOutParamDetails



32
33
34
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 32

def out_param_details
  @out_param_details
end

#sql_detailsOCI::StackMonitoring::Models::SqlDetails

This attribute is required.



25
26
27
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 25

def sql_details
  @sql_details
end

#sql_typeString

[Required] Type of SQL data collection method i.e. either a Statement or SQL Script File

Returns:

  • (String)


21
22
23
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 21

def sql_type
  @sql_type
end

Class Method Details

.attribute_mapObject

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



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 35

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'collection_method': :'collectionMethod',
    'sql_type': :'sqlType',
    'sql_details': :'sqlDetails',
    'in_param_details': :'inParamDetails',
    'out_param_details': :'outParamDetails'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 48

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'collection_method': :'String',
    'sql_type': :'String',
    'sql_details': :'OCI::StackMonitoring::Models::SqlDetails',
    'in_param_details': :'Array<OCI::StackMonitoring::Models::SqlInParamDetails>',
    'out_param_details': :'OCI::StackMonitoring::Models::SqlOutParamDetails'
    # 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



125
126
127
128
129
130
131
132
133
134
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 125

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

  self.class == other.class &&
    collection_method == other.collection_method &&
    sql_type == other.sql_type &&
    sql_details == other.sql_details &&
    in_param_details == other.in_param_details &&
    out_param_details == other.out_param_details
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



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 159

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


139
140
141
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 139

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



148
149
150
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 148

def hash
  [collection_method, sql_type, sql_details, in_param_details, out_param_details].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



192
193
194
195
196
197
198
199
200
201
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 192

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



186
187
188
# File 'lib/oci/stack_monitoring/models/sql_query_properties.rb', line 186

def to_s
  to_hash.to_s
end