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_SYSDG = 'SYSDG'.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



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
107
# File 'lib/oci/database_management/models/basic_named_credential_content.rb', line 78

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)


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

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)


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

def password_secret_id
  @password_secret_id
end

#roleString

[Required] The role of the database user.

Returns:

  • (String)


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

def role
  @role
end

#user_nameString

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

Returns:

  • (String)


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

def user_name
  @user_name
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


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

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

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



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

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



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

def to_s
  to_hash.to_s
end