Class: OCI::DatabaseToolsRuntime::Models::Credential

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/database_tools_runtime/models/credential.rb

Overview

Credential information

Constant Summary collapse

KEY_TYPE_ENUM =
[
  KEY_TYPE_CREDENTIAL_NAME = 'CREDENTIAL_NAME'.freeze,
  KEY_TYPE_PUBLIC_SYNONYM = 'PUBLIC_SYNONYM'.freeze,
  KEY_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Credential

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 88

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

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

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

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

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

  self.key_type = attributes[:'keyType'] if attributes[:'keyType']

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

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

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

  self.related_resource = attributes[:'relatedResource'] if attributes[:'relatedResource']

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

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

Instance Attribute Details

#enabledString

[Required] Indicates whether this credential is enabled (TRUE) or not (FALSE)

Returns:

  • (String)


32
33
34
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 32

def enabled
  @enabled
end

#keyString

[Required] Name of the credential

Returns:

  • (String)


20
21
22
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 20

def key
  @key
end

#key_typeString

Indicates whether this refers to a public synonym or not.

Returns:

  • (String)


36
37
38
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 36

def key_type
  @key_type
end

#ownerString

[Required] Owner of the credential

Returns:

  • (String)


40
41
42
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 40

def owner
  @owner
end


43
44
45
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 43

def related_resource
  @related_resource
end

#user_nameString

[Required] Name of the user that will be used to log in to the remote database or the remote or local operating system

Returns:

  • (String)


24
25
26
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 24

def user_name
  @user_name
end

#windows_domainString

For a Windows target, the Windows domain to use when logging in

Returns:

  • (String)


28
29
30
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 28

def windows_domain
  @windows_domain
end

Class Method Details

.attribute_mapObject

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



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 46

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'key',
    'user_name': :'userName',
    'windows_domain': :'windowsDomain',
    'enabled': :'enabled',
    'key_type': :'keyType',
    'owner': :'owner',
    'related_resource': :'relatedResource'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 61

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'String',
    'user_name': :'String',
    'windows_domain': :'String',
    'enabled': :'String',
    'key_type': :'String',
    'owner': :'String',
    'related_resource': :'OCI::DatabaseToolsRuntime::Models::CredentialRelatedResource'
    # 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



145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 145

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

  self.class == other.class &&
    key == other.key &&
    user_name == other.user_name &&
    windows_domain == other.windows_domain &&
    enabled == other.enabled &&
    key_type == other.key_type &&
    owner == other.owner &&
    related_resource == other.related_resource
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



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 181

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


161
162
163
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 161

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



170
171
172
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 170

def hash
  [key, user_name, windows_domain, enabled, key_type, owner, related_resource].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 214

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



208
209
210
# File 'lib/oci/database_tools_runtime/models/credential.rb', line 208

def to_s
  to_hash.to_s
end