Class: OCI::DatabaseManagement::Models::MySqlDatabaseUsageMetrics

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/database_management/models/my_sql_database_usage_metrics.rb

Overview

The list of aggregated metrics for Managed MySQL Databases in the fleet.

Constant Summary collapse

DATABASE_STATUS_ENUM =
[
  DATABASE_STATUS_UP = 'UP'.freeze,
  DATABASE_STATUS_DOWN = 'DOWN'.freeze,
  DATABASE_STATUS_UNKNOWN = 'UNKNOWN'.freeze,
  DATABASE_STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MySqlDatabaseUsageMetrics

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 106

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

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

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

  self.database_name = attributes[:'databaseName'] if attributes[:'databaseName']

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

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

  self.database_type = attributes[:'databaseType'] if attributes[:'databaseType']

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

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

  self.mds_deployment_type = attributes[:'mdsDeploymentType'] if attributes[:'mdsDeploymentType']

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

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

  self.mdslifecycle_state = attributes[:'mdslifecycleState'] if attributes[:'mdslifecycleState']

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

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

  self.database_version = attributes[:'databaseVersion'] if attributes[:'databaseVersion']

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

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

  self.db_id = attributes[:'dbId'] if attributes[:'dbId']

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

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

  self.database_status = attributes[:'databaseStatus'] if attributes[:'databaseStatus']

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

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

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

Instance Attribute Details

#compartment_idString

[Required] The OCID of the compartment where the Managed MySQL Database resides.

Returns:

  • (String)


21
22
23
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 21

def compartment_id
  @compartment_id
end

#database_nameString

[Required] The display name of the Managed MySQL Database.

Returns:

  • (String)


25
26
27
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 25

def database_name
  @database_name
end

#database_statusString

[Required] The status of the MySQL Database. Indicates whether the status of the database is UP, DOWN, or UNKNOWN at the current time.

Returns:

  • (String)


51
52
53
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 51

def database_status
  @database_status
end

#database_typeString

[Required] Indicates MySQL Database type, ONPREMISE or MySQL Database System.

Returns:

  • (String)


29
30
31
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 29

def database_type
  @database_type
end

#database_versionString

[Required] The version of the MySQL Database.

Returns:

  • (String)


41
42
43
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 41

def database_version
  @database_version
end

#db_idString

[Required] The OCID of the Managed MySQL Database.

Returns:

  • (String)


45
46
47
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 45

def db_id
  @db_id
end

#mds_deployment_typeString

[Required] The type of MySQL Database System.

Returns:

  • (String)


33
34
35
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 33

def mds_deployment_type
  @mds_deployment_type
end

#mdslifecycle_stateString

[Required] The lifecycle state of the MySQL Database System.

Returns:

  • (String)


37
38
39
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 37

def mdslifecycle_state
  @mdslifecycle_state
end

#metricsArray<OCI::DatabaseManagement::Models::MySqlFleetMetricDefinition>

[Required] A list of the database health metrics like CPU, Storage, and Memory.



55
56
57
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 55

def metrics
  @metrics
end

Class Method Details

.attribute_mapObject

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



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 58

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'compartment_id': :'compartmentId',
    'database_name': :'databaseName',
    'database_type': :'databaseType',
    'mds_deployment_type': :'mdsDeploymentType',
    'mdslifecycle_state': :'mdslifecycleState',
    'database_version': :'databaseVersion',
    'db_id': :'dbId',
    'database_status': :'databaseStatus',
    'metrics': :'metrics'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 75

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'compartment_id': :'String',
    'database_name': :'String',
    'database_type': :'String',
    'mds_deployment_type': :'String',
    'mdslifecycle_state': :'String',
    'database_version': :'String',
    'db_id': :'String',
    'database_status': :'String',
    'metrics': :'Array<OCI::DatabaseManagement::Models::MySqlFleetMetricDefinition>'
    # 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



183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 183

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

  self.class == other.class &&
    compartment_id == other.compartment_id &&
    database_name == other.database_name &&
    database_type == other.database_type &&
    mds_deployment_type == other.mds_deployment_type &&
    mdslifecycle_state == other.mdslifecycle_state &&
    database_version == other.database_version &&
    db_id == other.db_id &&
    database_status == other.database_status &&
    metrics == other.metrics
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



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 221

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


201
202
203
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 201

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



210
211
212
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 210

def hash
  [compartment_id, database_name, database_type, mds_deployment_type, mdslifecycle_state, database_version, db_id, database_status, metrics].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



254
255
256
257
258
259
260
261
262
263
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 254

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



248
249
250
# File 'lib/oci/database_management/models/my_sql_database_usage_metrics.rb', line 248

def to_s
  to_hash.to_s
end