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
].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



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
126
127
128
129
130
131
132
133
# File 'lib/oci/database/models/create_database_base.rb', line 101

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

[Required] The OCID of the Database Home.

Returns:

  • (String)


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

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)


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

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)


41
42
43
# File 'lib/oci/database/models/create_database_base.rb', line 41

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)


46
47
48
# File 'lib/oci/database/models/create_database_base.rb', line 46

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. The default is NONE.

Returns:

  • (String)


37
38
39
# File 'lib/oci/database/models/create_database_base.rb', line 37

def source
  @source
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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::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.



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

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



150
151
152
153
154
155
156
157
158
159
# File 'lib/oci/database/models/create_database_base.rb', line 150

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



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

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


164
165
166
# File 'lib/oci/database/models/create_database_base.rb', line 164

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



173
174
175
# File 'lib/oci/database/models/create_database_base.rb', line 173

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



217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/database/models/create_database_base.rb', line 217

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



211
212
213
# File 'lib/oci/database/models/create_database_base.rb', line 211

def to_s
  to_hash.to_s
end