Class: OCI::DatabaseManagement::Models::BasicNamedCredentialContent

Inherits:
NamedCredentialContent show all
Defined in:
lib/oci/database_management/models/basic_named_credential_content.rb

Overview

The details of the 'BASIC' named credential.

Constant Summary collapse

ROLE_ENUM =
[
  ROLE_NORMAL = 'NORMAL'.freeze,
  ROLE_SYSDBA = 'SYSDBA'.freeze,
  ROLE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
PASSWORD_SECRET_ACCESS_MODE_ENUM =
[
  PASSWORD_SECRET_ACCESS_MODE_USER_PRINCIPAL = 'USER_PRINCIPAL'.freeze,
  PASSWORD_SECRET_ACCESS_MODE_RESOURCE_PRINCIPAL = 'RESOURCE_PRINCIPAL'.freeze,
  PASSWORD_SECRET_ACCESS_MODE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from NamedCredentialContent

NamedCredentialContent::CREDENTIAL_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from NamedCredentialContent

#credential_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NamedCredentialContent

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ BasicNamedCredentialContent

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :user_name (String)

    The value to assign to the #user_name property

  • :role (String)

    The value to assign to the #role property

  • :password_secret_id (String)

    The value to assign to the #password_secret_id property

  • :password_secret_access_mode (String)

    The value to assign to the #password_secret_access_mode property

[View source]

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
104
105
106
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 77

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

  attributes['credentialType'] = 'BASIC'

  super(attributes)

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

  self.user_name = attributes[:'userName'] if attributes[:'userName']

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

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

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

  self.password_secret_id = attributes[:'passwordSecretId'] if attributes[:'passwordSecretId']

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

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

  self.password_secret_access_mode = attributes[:'passwordSecretAccessMode'] if attributes[:'passwordSecretAccessMode']

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

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

Instance Attribute Details

#password_secret_access_modeString

[Required] The mechanism used to access the password plain text value.

Returns:

  • (String)

39
40
41
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 39

def password_secret_access_mode
  @password_secret_access_mode
end

#password_secret_idString

[Required] The OCID of the Vault service secret that contains the database user password.

Returns:

  • (String)

35
36
37
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 35

def password_secret_id
  @password_secret_id
end

#roleString

[Required] The role of the database user.

Returns:

  • (String)

31
32
33
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 31

def role
  @role
end

#user_nameString

[Required] The user name used to connect to the database.

Returns:

  • (String)

27
28
29
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 27

def user_name
  @user_name
end

Class Method Details

.attribute_mapObject

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

[View source]

42
43
44
45
46
47
48
49
50
51
52
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 42

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'credential_type': :'credentialType',
    'user_name': :'userName',
    'role': :'role',
    'password_secret_id': :'passwordSecretId',
    'password_secret_access_mode': :'passwordSecretAccessMode'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.

[View source]

55
56
57
58
59
60
61
62
63
64
65
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 55

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'credential_type': :'String',
    'user_name': :'String',
    'role': :'String',
    'password_secret_id': :'String',
    'password_secret_access_mode': :'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

[View source]

141
142
143
144
145
146
147
148
149
150
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 141

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

  self.class == other.class &&
    credential_type == other.credential_type &&
    user_name == other.user_name &&
    role == other.role &&
    password_secret_id == other.password_secret_id &&
    password_secret_access_mode == other.password_secret_access_mode
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

[View source]

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 175

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
[View source]

155
156
157
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 155

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code

[View source]

164
165
166
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 164

def hash
  [credential_type, user_name, role, password_secret_id, password_secret_access_mode].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash

[View source]

208
209
210
211
212
213
214
215
216
217
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 208

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

[View source]

202
203
204
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 202

def to_s
  to_hash.to_s
end