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.

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



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
# File 'lib/oci/audit/models/identity.rb', line 124

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)


29
30
31
# File 'lib/oci/audit/models/identity.rb', line 29

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)


40
41
42
# File 'lib/oci/audit/models/identity.rb', line 40

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)


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

def caller_name
  @caller_name
end

#console_session_idString

This value identifies any Console session associated with this request.

Returns:

  • (String)


70
71
72
# File 'lib/oci/audit/models/identity.rb', line 70

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)


58
59
60
# File 'lib/oci/audit/models/identity.rb', line 58

def credentials
  @credentials
end

#ip_addressString

The IP address of the source of the request.

Example: 172.24.80.88

Returns:

  • (String)


52
53
54
# File 'lib/oci/audit/models/identity.rb', line 52

def ip_address
  @ip_address
end

#principal_idString

The OCID of the principal.

Returns:

  • (String)


22
23
24
# File 'lib/oci/audit/models/identity.rb', line 22

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)


17
18
19
# File 'lib/oci/audit/models/identity.rb', line 17

def principal_name
  @principal_name
end

#tenant_idString

The OCID of the tenant.

Returns:

  • (String)


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

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)


65
66
67
# File 'lib/oci/audit/models/identity.rb', line 65

def user_agent
  @user_agent
end

Class Method Details

.attribute_mapObject

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



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/oci/audit/models/identity.rb', line 73

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.



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

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



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/oci/audit/models/identity.rb', line 194

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



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/oci/audit/models/identity.rb', line 233

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


213
214
215
# File 'lib/oci/audit/models/identity.rb', line 213

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



222
223
224
# File 'lib/oci/audit/models/identity.rb', line 222

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



266
267
268
269
270
271
272
273
274
275
# File 'lib/oci/audit/models/identity.rb', line 266

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



260
261
262
# File 'lib/oci/audit/models/identity.rb', line 260

def to_s
  to_hash.to_s
end