Class: OCI::Database::Models::CreateDatabaseBase

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/database/models/create_database_base.rb

Overview

Details for creating a database.

Warning: Oracle recommends that you avoid using any confidential information when you supply string values using the API.

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

SOURCE_ENUM =
[
  SOURCE_NONE = 'NONE'.freeze,
  SOURCE_DB_BACKUP = 'DB_BACKUP'.freeze,
  SOURCE_DATAGUARD = 'DATAGUARD'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateDatabaseBase

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :db_home_id (String)

    The value to assign to the #db_home_id property

  • :db_version (String)

    The value to assign to the #db_version property

  • :source (String)

    The value to assign to the #source property

  • :kms_key_id (String)

    The value to assign to the #kms_key_id property

  • :kms_key_version_id (String)

    The value to assign to the #kms_key_version_id property



104
105
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
# File 'lib/oci/database/models/create_database_base.rb', line 104

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

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

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

  self.db_version = attributes[:'dbVersion'] if attributes[:'dbVersion']

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

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

  self.source = attributes[:'source'] if attributes[:'source']
  self.source = "NONE" if source.nil? && !attributes.key?(:'source') # rubocop:disable Style/StringLiterals

  self.kms_key_id = attributes[:'kmsKeyId'] if attributes[:'kmsKeyId']

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

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

  self.kms_key_version_id = attributes[:'kmsKeyVersionId'] if attributes[:'kmsKeyVersionId']

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

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

Instance Attribute Details

#db_home_idString

The OCID of the Database Home.

Returns:

  • (String)


23
24
25
# File 'lib/oci/database/models/create_database_base.rb', line 23

def db_home_id
  @db_home_id
end

#db_versionString

A valid Oracle Database version. For a list of supported versions, use the ListDbVersions operation.

This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, openMode, permissionLevel, dbWorkload, privateEndpointLabel, nsgIds, isRefreshable, dbName, scheduledOperations, dbToolsDetails, isLocalDataGuardEnabled, or isFreeTier.

Returns:

  • (String)


30
31
32
# File 'lib/oci/database/models/create_database_base.rb', line 30

def db_version
  @db_version
end

#kms_key_idString

The OCID of the key container that is used as the master encryption key in database transparent data encryption (TDE) operations.

Returns:

  • (String)


43
44
45
# File 'lib/oci/database/models/create_database_base.rb', line 43

def kms_key_id
  @kms_key_id
end

#kms_key_version_idString

The OCID of the key container version that is used in database transparent data encryption (TDE) operations KMS Key can have multiple key versions. If none is specified, the current key version (latest) of the Key Id is used for the operation. Autonomous Database Serverless does not use key versions, hence is not applicable for Autonomous Database Serverless instances.

Returns:

  • (String)


48
49
50
# File 'lib/oci/database/models/create_database_base.rb', line 48

def kms_key_version_id
  @kms_key_version_id
end

#sourceString

[Required] The source of the database: Use NONE for creating a new database. Use DB_BACKUP for creating a new database by restoring from a backup. Use DATAGUARD for creating a new STANDBY database for a Data Guard setup.. The default is NONE.

Returns:

  • (String)


39
40
41
# File 'lib/oci/database/models/create_database_base.rb', line 39

def source
  @source
end

Class Method Details

.attribute_mapObject

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



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/database/models/create_database_base.rb', line 51

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'db_home_id': :'dbHomeId',
    'db_version': :'dbVersion',
    'source': :'source',
    'kms_key_id': :'kmsKeyId',
    'kms_key_version_id': :'kmsKeyVersionId'
    # 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.



81
82
83
84
85
86
87
88
89
90
# File 'lib/oci/database/models/create_database_base.rb', line 81

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

  return 'OCI::Database::Models::CreateNewDatabaseDetails' if type == 'NONE'
  return 'OCI::Database::Models::CreateStandByDatabaseDetails' if type == 'DATAGUARD'
  return 'OCI::Database::Models::CreateDatabaseFromBackup' if type == 'DB_BACKUP'

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

.swagger_typesObject

Attribute type mapping.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/oci/database/models/create_database_base.rb', line 64

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'db_home_id': :'String',
    'db_version': :'String',
    'source': :'String',
    'kms_key_id': :'String',
    'kms_key_version_id': :'String'
    # 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



153
154
155
156
157
158
159
160
161
162
# File 'lib/oci/database/models/create_database_base.rb', line 153

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

  self.class == other.class &&
    db_home_id == other.db_home_id &&
    db_version == other.db_version &&
    source == other.source &&
    kms_key_id == other.kms_key_id &&
    kms_key_version_id == other.kms_key_version_id
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



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/oci/database/models/create_database_base.rb', line 187

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


167
168
169
# File 'lib/oci/database/models/create_database_base.rb', line 167

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



176
177
178
# File 'lib/oci/database/models/create_database_base.rb', line 176

def hash
  [db_home_id, db_version, source, kms_key_id, kms_key_version_id].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



220
221
222
223
224
225
226
227
228
229
# File 'lib/oci/database/models/create_database_base.rb', line 220

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



214
215
216
# File 'lib/oci/database/models/create_database_base.rb', line 214

def to_s
  to_hash.to_s
end