Class: OCI::Audit::Models::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/audit/models/identity.rb

Overview

A container object for identity attributes.

Example:

—– { "principalName": "ExampleName", "principalId": "ocid1.user.oc1..<unique_ID>", "authType": "natv", "callerName": null, "callerId": null, "tenantId": "ocid1.tenancy.oc1..<unique_ID>", "ipAddress": "172.24.80.88", "credentials": null, "userAgent": "Jersey/2.23 (HttpUrlConnection 1.8.0_212)", "consoleSessionId": null } —–

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Identity

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :principal_name (String)

    The value to assign to the #principal_name property

  • :principal_id (String)

    The value to assign to the #principal_id property

  • :auth_type (String)

    The value to assign to the #auth_type property

  • :caller_name (String)

    The value to assign to the #caller_name property

  • :caller_id (String)

    The value to assign to the #caller_id property

  • :tenant_id (String)

    The value to assign to the #tenant_id property

  • :ip_address (String)

    The value to assign to the #ip_address property

  • :credentials (String)

    The value to assign to the #credentials property

  • :user_agent (String)

    The value to assign to the #user_agent property

  • :console_session_id (String)

    The value to assign to the #console_session_id property



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/oci/audit/models/identity.rb', line 140

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

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

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

  self.principal_id = attributes[:'principalId'] if attributes[:'principalId']

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

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

  self.auth_type = attributes[:'authType'] if attributes[:'authType']

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

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

  self.caller_name = attributes[:'callerName'] if attributes[:'callerName']

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

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

  self.caller_id = attributes[:'callerId'] if attributes[:'callerId']

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

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

  self.tenant_id = attributes[:'tenantId'] if attributes[:'tenantId']

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

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

  self.ip_address = attributes[:'ipAddress'] if attributes[:'ipAddress']

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

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

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

  self.user_agent = attributes[:'userAgent'] if attributes[:'userAgent']

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

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

  self.console_session_id = attributes[:'consoleSessionId'] if attributes[:'consoleSessionId']

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

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

Instance Attribute Details

#auth_typeString

The type of authentication used.

Example: natv

Returns:

  • (String)


45
46
47
# File 'lib/oci/audit/models/identity.rb', line 45

def auth_type
  @auth_type
end

#caller_idString

The OCID of the caller. The caller that made a request on behalf of the prinicpal.

Returns:

  • (String)


56
57
58
# File 'lib/oci/audit/models/identity.rb', line 56

def caller_id
  @caller_id
end

#caller_nameString

The name of the user or service. This value is the friendly name associated with callerId.

Returns:

  • (String)


50
51
52
# File 'lib/oci/audit/models/identity.rb', line 50

def caller_name
  @caller_name
end

#console_session_idString

This value identifies any Console session associated with this request.

Returns:

  • (String)


86
87
88
# File 'lib/oci/audit/models/identity.rb', line 86

def console_session_id
  @console_session_id
end

#credentialsString

The credential ID of the user. This value is extracted from the HTTP 'Authorization' request header. It consists of the tenantId, userId, and user fingerprint, all delimited by a slash (/).

Returns:

  • (String)


74
75
76
# File 'lib/oci/audit/models/identity.rb', line 74

def credentials
  @credentials
end

#ip_addressString

The IP address of the source of the request.

Example: 172.24.80.88

Returns:

  • (String)


68
69
70
# File 'lib/oci/audit/models/identity.rb', line 68

def ip_address
  @ip_address
end

#principal_idString

The OCID of the principal.

Returns:

  • (String)


38
39
40
# File 'lib/oci/audit/models/identity.rb', line 38

def principal_id
  @principal_id
end

#principal_nameString

The name of the user or service. This value is the friendly name associated with principalId.

Example: ExampleName

Returns:

  • (String)


33
34
35
# File 'lib/oci/audit/models/identity.rb', line 33

def principal_name
  @principal_name
end

#tenant_idString

The OCID of the tenant.

Returns:

  • (String)


61
62
63
# File 'lib/oci/audit/models/identity.rb', line 61

def tenant_id
  @tenant_id
end

#user_agentString

The user agent of the client that made the request.

Example: Jersey/2.23 (HttpUrlConnection 1.8.0_212)

Returns:

  • (String)


81
82
83
# File 'lib/oci/audit/models/identity.rb', line 81

def user_agent
  @user_agent
end

Class Method Details

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/oci/audit/models/identity.rb', line 89

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'principal_name': :'principalName',
    'principal_id': :'principalId',
    'auth_type': :'authType',
    'caller_name': :'callerName',
    'caller_id': :'callerId',
    'tenant_id': :'tenantId',
    'ip_address': :'ipAddress',
    'credentials': :'credentials',
    'user_agent': :'userAgent',
    'console_session_id': :'consoleSessionId'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/oci/audit/models/identity.rb', line 107

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'principal_name': :'String',
    'principal_id': :'String',
    'auth_type': :'String',
    'caller_name': :'String',
    'caller_id': :'String',
    'tenant_id': :'String',
    'ip_address': :'String',
    'credentials': :'String',
    'user_agent': :'String',
    'console_session_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



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/oci/audit/models/identity.rb', line 210

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

  self.class == other.class &&
    principal_name == other.principal_name &&
    principal_id == other.principal_id &&
    auth_type == other.auth_type &&
    caller_name == other.caller_name &&
    caller_id == other.caller_id &&
    tenant_id == other.tenant_id &&
    ip_address == other.ip_address &&
    credentials == other.credentials &&
    user_agent == other.user_agent &&
    console_session_id == other.console_session_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



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/oci/audit/models/identity.rb', line 249

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


229
230
231
# File 'lib/oci/audit/models/identity.rb', line 229

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



238
239
240
# File 'lib/oci/audit/models/identity.rb', line 238

def hash
  [principal_name, principal_id, auth_type, caller_name, caller_id, tenant_id, ip_address, credentials, user_agent, console_session_id].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



282
283
284
285
286
287
288
289
290
291
# File 'lib/oci/audit/models/identity.rb', line 282

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



276
277
278
# File 'lib/oci/audit/models/identity.rb', line 276

def to_s
  to_hash.to_s
end