Class: IntersightClient::IamUser

Inherits:
MoBaseMo
  • Object
show all
Defined in:
lib/intersight_client/models/iam_user.rb

Overview

The Intersight account user.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Attributes inherited from MoBaseMo

#account_moid, #ancestors, #create_time, #display_names, #domain_group_moid, #mod_time, #moid, #owners, #parent, #permission_resources, #shared_scope, #tags, #version_context

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ IamUser

Initializes the object

Parameters:

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

    Model attributes in the form of hash



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/intersight_client/models/iam_user.rb', line 186

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `IntersightClient::IamUser` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `#{self.class.name}`. Please check the name to make sure it's valid. List of attributes: " + self.class.acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  # call parent's initialize
  super(attributes)

  if attributes.key?(:'class_id')
    self.class_id = attributes[:'class_id']
  else
    self.class_id = 'iam.User'
  end

  if attributes.key?(:'object_type')
    self.object_type = attributes[:'object_type']
  else
    self.object_type = 'iam.User'
  end

  if attributes.key?(:'client_ip_address')
    self.client_ip_address = attributes[:'client_ip_address']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'first_name')
    self.first_name = attributes[:'first_name']
  end

  if attributes.key?(:'last_login_time')
    self. = attributes[:'last_login_time']
  end

  if attributes.key?(:'last_name')
    self.last_name = attributes[:'last_name']
  end

  if attributes.key?(:'last_role_modified_time')
    self.last_role_modified_time = attributes[:'last_role_modified_time']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'user_id_or_email')
    self.user_id_or_email = attributes[:'user_id_or_email']
  end

  if attributes.key?(:'user_type')
    self.user_type = attributes[:'user_type']
  end

  if attributes.key?(:'user_unique_identifier')
    self.user_unique_identifier = attributes[:'user_unique_identifier']
  end

  if attributes.key?(:'api_keys')
    if (value = attributes[:'api_keys']).is_a?(Array)
      self.api_keys = value
    end
  end

  if attributes.key?(:'app_registrations')
    if (value = attributes[:'app_registrations']).is_a?(Array)
      self.app_registrations = value
    end
  end

  if attributes.key?(:'idp')
    self.idp = attributes[:'idp']
  end

  if attributes.key?(:'idpreference')
    self.idpreference = attributes[:'idpreference']
  end

  if attributes.key?(:'local_user_password')
    self.local_user_password = attributes[:'local_user_password']
  end

  if attributes.key?(:'oauth_tokens')
    if (value = attributes[:'oauth_tokens']).is_a?(Array)
      self.oauth_tokens = value
    end
  end

  if attributes.key?(:'permissions')
    if (value = attributes[:'permissions']).is_a?(Array)
      self.permissions = value
    end
  end

  if attributes.key?(:'sessions')
    if (value = attributes[:'sessions']).is_a?(Array)
      self.sessions = value
    end
  end
end

Instance Attribute Details

#api_keysObject

An array of relationships to iamApiKey resources.



56
57
58
# File 'lib/intersight_client/models/iam_user.rb', line 56

def api_keys
  @api_keys
end

#app_registrationsObject

An array of relationships to iamAppRegistration resources.



59
60
61
# File 'lib/intersight_client/models/iam_user.rb', line 59

def app_registrations
  @app_registrations
end

#class_idObject

The fully-qualified name of the instantiated, concrete type. This property is used as a discriminator to identify the type of the payload when marshaling and unmarshaling data.



20
21
22
# File 'lib/intersight_client/models/iam_user.rb', line 20

def class_id
  @class_id
end

#client_ip_addressObject

IP address from which the user last logged in to Intersight.



26
27
28
# File 'lib/intersight_client/models/iam_user.rb', line 26

def client_ip_address
  @client_ip_address
end

#emailObject

Email of the user. Users are added to Intersight using the email configured in the IdP.



29
30
31
# File 'lib/intersight_client/models/iam_user.rb', line 29

def email
  @email
end

#first_nameObject

First name of the user. This field is populated from the IdP attributes received after authentication.



32
33
34
# File 'lib/intersight_client/models/iam_user.rb', line 32

def first_name
  @first_name
end

#idpObject

Returns the value of attribute idp.



61
62
63
# File 'lib/intersight_client/models/iam_user.rb', line 61

def idp
  @idp
end

#idpreferenceObject

Returns the value of attribute idpreference.



63
64
65
# File 'lib/intersight_client/models/iam_user.rb', line 63

def idpreference
  @idpreference
end

#last_login_timeObject

Last successful login time for user.



35
36
37
# File 'lib/intersight_client/models/iam_user.rb', line 35

def 
  
end

#last_nameObject

Last name of the user. This field is populated from the IdP attributes received after authentication.



38
39
40
# File 'lib/intersight_client/models/iam_user.rb', line 38

def last_name
  @last_name
end

#last_role_modified_timeObject

Last role modification time for user.



41
42
43
# File 'lib/intersight_client/models/iam_user.rb', line 41

def last_role_modified_time
  @last_role_modified_time
end

#local_user_passwordObject

Returns the value of attribute local_user_password.



65
66
67
# File 'lib/intersight_client/models/iam_user.rb', line 65

def local_user_password
  @local_user_password
end

#nameObject

Name as configured in the IdP.



44
45
46
# File 'lib/intersight_client/models/iam_user.rb', line 44

def name
  @name
end

#oauth_tokensObject

An array of relationships to iamOAuthToken resources.



68
69
70
# File 'lib/intersight_client/models/iam_user.rb', line 68

def oauth_tokens
  @oauth_tokens
end

#object_typeObject

The fully-qualified name of the instantiated, concrete type. The value should be the same as the ‘ClassId’ property.



23
24
25
# File 'lib/intersight_client/models/iam_user.rb', line 23

def object_type
  @object_type
end

#permissionsObject

An array of relationships to iamPermission resources.



71
72
73
# File 'lib/intersight_client/models/iam_user.rb', line 71

def permissions
  @permissions
end

#sessionsObject

An array of relationships to iamSession resources.



74
75
76
# File 'lib/intersight_client/models/iam_user.rb', line 74

def sessions
  @sessions
end

#user_id_or_emailObject

UserID or email as configured in the IdP.



47
48
49
# File 'lib/intersight_client/models/iam_user.rb', line 47

def user_id_or_email
  @user_id_or_email
end

#user_typeObject

Type of the User. If a user is added manually by specifying the email address, or has logged in using groups, based on the IdP attributes received during authentication. If added manually, the user type will be static, otherwise dynamic.



50
51
52
# File 'lib/intersight_client/models/iam_user.rb', line 50

def user_type
  @user_type
end

#user_unique_identifierObject

Unique id of the user used by the identity provider to store the user.



53
54
55
# File 'lib/intersight_client/models/iam_user.rb', line 53

def user_unique_identifier
  @user_unique_identifier
end

Class Method Details

.acceptable_attribute_mapObject

Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s)



130
131
132
# File 'lib/intersight_client/models/iam_user.rb', line 130

def self.acceptable_attribute_map
  attribute_map.merge(superclass.acceptable_attribute_map)
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about, including the ones defined in its parent(s)



125
126
127
# File 'lib/intersight_client/models/iam_user.rb', line 125

def self.acceptable_attributes
  attribute_map.values.concat(superclass.acceptable_attributes)
end

.attribute_mapObject

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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/intersight_client/models/iam_user.rb', line 99

def self.attribute_map
  {
    :'class_id' => :'ClassId',
    :'object_type' => :'ObjectType',
    :'client_ip_address' => :'ClientIpAddress',
    :'email' => :'Email',
    :'first_name' => :'FirstName',
    :'last_login_time' => :'LastLoginTime',
    :'last_name' => :'LastName',
    :'last_role_modified_time' => :'LastRoleModifiedTime',
    :'name' => :'Name',
    :'user_id_or_email' => :'UserIdOrEmail',
    :'user_type' => :'UserType',
    :'user_unique_identifier' => :'UserUniqueIdentifier',
    :'api_keys' => :'ApiKeys',
    :'app_registrations' => :'AppRegistrations',
    :'idp' => :'Idp',
    :'idpreference' => :'Idpreference',
    :'local_user_password' => :'LocalUserPassword',
    :'oauth_tokens' => :'OauthTokens',
    :'permissions' => :'Permissions',
    :'sessions' => :'Sessions'
  }
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



403
404
405
# File 'lib/intersight_client/models/iam_user.rb', line 403

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



172
173
174
175
176
177
# File 'lib/intersight_client/models/iam_user.rb', line 172

def self.openapi_all_of
  [
  :'IamUserAllOf',
  :'MoBaseMo'
  ]
end

.openapi_discriminator_nameObject

discriminator’s property name in OpenAPI v3



180
181
182
# File 'lib/intersight_client/models/iam_user.rb', line 180

def self.openapi_discriminator_name
  :'ClassId'
end

.openapi_nullableObject

List of attributes with nullable: true



161
162
163
164
165
166
167
168
169
# File 'lib/intersight_client/models/iam_user.rb', line 161

def self.openapi_nullable
  Set.new([
    :'api_keys',
    :'app_registrations',
    :'oauth_tokens',
    :'permissions',
    :'sessions'
  ])
end

.openapi_typesObject

Attribute type mapping.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/intersight_client/models/iam_user.rb', line 135

def self.openapi_types
  {
    :'class_id' => :'String',
    :'object_type' => :'String',
    :'client_ip_address' => :'String',
    :'email' => :'String',
    :'first_name' => :'String',
    :'last_login_time' => :'Time',
    :'last_name' => :'String',
    :'last_role_modified_time' => :'Time',
    :'name' => :'String',
    :'user_id_or_email' => :'String',
    :'user_type' => :'String',
    :'user_unique_identifier' => :'String',
    :'api_keys' => :'Array<IamApiKeyRelationship>',
    :'app_registrations' => :'Array<IamAppRegistrationRelationship>',
    :'idp' => :'IamIdpRelationship',
    :'idpreference' => :'IamIdpReferenceRelationship',
    :'local_user_password' => :'IamLocalUserPasswordRelationship',
    :'oauth_tokens' => :'Array<IamOAuthTokenRelationship>',
    :'permissions' => :'Array<IamPermissionRelationship>',
    :'sessions' => :'Array<IamSessionRelationship>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/intersight_client/models/iam_user.rb', line 363

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      class_id == o.class_id &&
      object_type == o.object_type &&
      client_ip_address == o.client_ip_address &&
      email == o.email &&
      first_name == o.first_name &&
       == o. &&
      last_name == o.last_name &&
      last_role_modified_time == o.last_role_modified_time &&
      name == o.name &&
      user_id_or_email == o.user_id_or_email &&
      user_type == o.user_type &&
      user_unique_identifier == o.user_unique_identifier &&
      api_keys == o.api_keys &&
      app_registrations == o.app_registrations &&
      idp == o.idp &&
      idpreference == o.idpreference &&
      local_user_password == o.local_user_password &&
      oauth_tokens == o.oauth_tokens &&
      permissions == o.permissions &&
      sessions == o.sessions && super(o)
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/intersight_client/models/iam_user.rb', line 434

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = IntersightClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



505
506
507
508
509
510
511
512
513
514
515
516
517
# File 'lib/intersight_client/models/iam_user.rb', line 505

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/intersight_client/models/iam_user.rb', line 410

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  super(attributes)
  IamUser.openapi_types.each_pair do |key, type|
    if attributes[IamUser.attribute_map[key]].nil? && IamUser.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[IamUser.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[IamUser.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[IamUser.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[IamUser.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


390
391
392
# File 'lib/intersight_client/models/iam_user.rb', line 390

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



396
397
398
# File 'lib/intersight_client/models/iam_user.rb', line 396

def hash
  [class_id, object_type, client_ip_address, email, first_name, , last_name, last_role_modified_time, name, user_id_or_email, user_type, user_unique_identifier, api_keys, app_registrations, idp, idpreference, local_user_password, oauth_tokens, permissions, sessions].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/intersight_client/models/iam_user.rb', line 299

def list_invalid_properties
  invalid_properties = super
  if @class_id.nil?
    invalid_properties.push('invalid value for "class_id", class_id cannot be nil.')
  end

  if @object_type.nil?
    invalid_properties.push('invalid value for "object_type", object_type cannot be nil.')
  end

  pattern = Regexp.new(/^$|^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)*$/)
  if !@email.nil? && @email !~ pattern
    invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



481
482
483
# File 'lib/intersight_client/models/iam_user.rb', line 481

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/intersight_client/models/iam_user.rb', line 487

def to_hash
  hash = super
  IamUser.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = IamUser.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



475
476
477
# File 'lib/intersight_client/models/iam_user.rb', line 475

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



319
320
321
322
323
324
325
326
327
328
# File 'lib/intersight_client/models/iam_user.rb', line 319

def valid?
  return false if @class_id.nil?
  class_id_validator = EnumAttributeValidator.new('String', ["iam.User"])
  return false unless class_id_validator.valid?(@class_id)
  return false if @object_type.nil?
  object_type_validator = EnumAttributeValidator.new('String', ["iam.User"])
  return false unless object_type_validator.valid?(@object_type)
  return false if !@email.nil? && @email !~ Regexp.new(/^$|^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)*$/)
  true && super
end