Class: IntersightClient::IamAppRegistration

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

Overview

AppRegistration encapsulates the meta-data values of a registered OAuth2 client application, as described in tools.ietf.org/html/rfc7591#section-2. Registered client applications have a set of metadata values associated with their client identifier at the Intersight authorization server, including the list of valid redirection URIs or a display name. The meta-data is used to specify how a client application can retrieve a OAuth2 Access Token and subsequently invoke Intersight API on behalf of this AppRegistration. To register an OAuth2 application, the following information must be provided. 1) Application name 2) An icon for the application 3) URL to the application’s home page 4) A short description of the application 5) A list of redirect URLs When an AppRegistration is created, a unique OAuth2 clientId is generated and returned in the HTTP response.

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 = {}) ⇒ IamAppRegistration

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/intersight_client/models/iam_app_registration.rb', line 173

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `IntersightClient::IamAppRegistration` 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.AppRegistration'
  end

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

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

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

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

  if attributes.key?(:'client_type')
    self.client_type = attributes[:'client_type']
  else
    self.client_type = 'public'
  end

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

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

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

  if attributes.key?(:'renew_client_secret')
    self.renew_client_secret = attributes[:'renew_client_secret']
  else
    self.renew_client_secret = false
  end

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

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

  if attributes.key?(:'revoke')
    self.revoke = attributes[:'revoke']
  else
    self.revoke = false
  end

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

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

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

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

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

Instance Attribute Details

#accountObject

Returns the value of attribute account.



55
56
57
# File 'lib/intersight_client/models/iam_app_registration.rb', line 55

def 
  @account
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_app_registration.rb', line 20

def class_id
  @class_id
end

#client_idObject

A unique identifier for the OAuth2 client application. The client ID is auto-generated when the AppRegistration object is created.



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

def client_id
  @client_id
end

#client_nameObject

App Registration name specified by user.



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

def client_name
  @client_name
end

#client_secretObject

The OAuth2 client secret. The value of this property is generated when grantType includes ‘client-credentials’. Otherwise, no client-secret is generated.



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

def client_secret
  @client_secret
end

#client_typeObject

The type of the OAuth2 client (public or confidential), as specified in tools.ietf.org/html/rfc6749#section-2.1. * public - Clients incapable of maintaining the confidentiality of their credentials.This includes clients executing on the device used by the resource owner,such as mobile applications, installed native application or a webbrowser-based application. * confidential - Clients capable of maintaining the confidentiality of their credentials.For example, this could be a client implemented on a secure server withrestricted access to the client credentials.To maintain the confidentiality of the OAuth2 credentials, two use cases areconsidered.1) The application is running as a service within Intersight. The application automatically obtains the OAuth2 credentials when the application starts and the credentials are not exposed to the end-user. Because end-users (even account administrators) do not have access the OAuth2 credentials, they cannot take the credentials with them when they leave their organization.2) The application is under the control of a "trusted" end-user. For example, the end-user may create a native application running outside Intersight. The application uses OAuth2 credentials to interact with the Intersight API. In that case, the Intersight account administrator may generate OAuth2 credentials with a registered application using "client_credentials" grant type. In that case, the end-user is responsible for maintaining the confidentiality of the OAuth2 credentials. If the end-user leaves the organization, you should revoke the credentials and issue new Oauth2 credentials.Here is a possible workflow for handling OAuth2 tokens.1) User Alice (Intersight Account Administrator) logins to Intersight and deploys an Intersight application that requires an OAuth2 token.2) Intersight automatically deploys the application. The application is assigned a OAuth2 token, possibly linked to Alice. The application must NOT expose the OAuth2 secret to Alice, otherwise Alice would be able to use the token after she leaves the company.3) The application can make API calls to Intersight using its assigned OAuth2 token. For example, the application could make weekly scheduled API calls to Intersight.4) Separately, Alice may also get OAuth2 tokens that she can use to make API calls from the Intersight SDK through the northbound API. In that case, Alice will get the associated OAuth2 secrets, but not the one assigned in step #2.5) Alice leaves the organization. The OAuth2 tokens assigned in step #2 must retain their validity even after Alice has left the organization. Because the OAuth2 secrets were never shared with Alice, there is no risk Alice can reuse the OAuth2 secrets. On the other hand, the OAuth2 tokens assigned in step #4 must be invalidated because Alice had the OAuth2 tokens in her possession.



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

def client_type
  @client_type
end

#descriptionObject

Description of the application.



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

def description
  @description
end

#grant_typesObject

Returns the value of attribute grant_types.



40
41
42
# File 'lib/intersight_client/models/iam_app_registration.rb', line 40

def grant_types
  @grant_types
end

#oauth_tokensObject

An array of relationships to iamOAuthToken resources.



58
59
60
# File 'lib/intersight_client/models/iam_app_registration.rb', line 58

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_app_registration.rb', line 23

def object_type
  @object_type
end

#permissionObject

Returns the value of attribute permission.



60
61
62
# File 'lib/intersight_client/models/iam_app_registration.rb', line 60

def permission
  @permission
end

#redirect_urisObject

Returns the value of attribute redirect_uris.



42
43
44
# File 'lib/intersight_client/models/iam_app_registration.rb', line 42

def redirect_uris
  @redirect_uris
end

#renew_client_secretObject

Set value to true to renew the client-secret. Applicable to client_credentials grant type.



45
46
47
# File 'lib/intersight_client/models/iam_app_registration.rb', line 45

def renew_client_secret
  @renew_client_secret
end

#response_typesObject

Returns the value of attribute response_types.



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

def response_types
  @response_types
end

#revocation_timestampObject

Used to perform revocation for tokens of AppRegistration. Updated only internally is case Revoke property come from UI with value true. On each request with OAuth2 access token the CreationTime of the OAuth2 token will be compared to RevokationTimestamp of the corresponding App Registration.



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

def revocation_timestamp
  @revocation_timestamp
end

#revokeObject

Used to trigger update the revocationTimestamp value. If UI sent updating request with the Revoke value is true, then update RevocationTimestamp.



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

def revoke
  @revoke
end

#rolesObject

An array of relationships to iamRole resources.



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

def roles
  @roles
end

#userObject

Returns the value of attribute user.



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

def user
  @user
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)



119
120
121
# File 'lib/intersight_client/models/iam_app_registration.rb', line 119

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)



114
115
116
# File 'lib/intersight_client/models/iam_app_registration.rb', line 114

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

.attribute_mapObject

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



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/intersight_client/models/iam_app_registration.rb', line 90

def self.attribute_map
  {
    :'class_id' => :'ClassId',
    :'object_type' => :'ObjectType',
    :'client_id' => :'ClientId',
    :'client_name' => :'ClientName',
    :'client_secret' => :'ClientSecret',
    :'client_type' => :'ClientType',
    :'description' => :'Description',
    :'grant_types' => :'GrantTypes',
    :'redirect_uris' => :'RedirectUris',
    :'renew_client_secret' => :'RenewClientSecret',
    :'response_types' => :'ResponseTypes',
    :'revocation_timestamp' => :'RevocationTimestamp',
    :'revoke' => :'Revoke',
    :'account' => :'Account',
    :'oauth_tokens' => :'OauthTokens',
    :'permission' => :'Permission',
    :'roles' => :'Roles',
    :'user' => :'User'
  }
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



381
382
383
# File 'lib/intersight_client/models/iam_app_registration.rb', line 381

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

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



159
160
161
162
163
164
# File 'lib/intersight_client/models/iam_app_registration.rb', line 159

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

.openapi_discriminator_nameObject

discriminator’s property name in OpenAPI v3



167
168
169
# File 'lib/intersight_client/models/iam_app_registration.rb', line 167

def self.openapi_discriminator_name
  :'ClassId'
end

.openapi_nullableObject

List of attributes with nullable: true



148
149
150
151
152
153
154
155
156
# File 'lib/intersight_client/models/iam_app_registration.rb', line 148

def self.openapi_nullable
  Set.new([
    :'grant_types',
    :'redirect_uris',
    :'response_types',
    :'oauth_tokens',
    :'roles',
  ])
end

.openapi_typesObject

Attribute type mapping.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/intersight_client/models/iam_app_registration.rb', line 124

def self.openapi_types
  {
    :'class_id' => :'String',
    :'object_type' => :'String',
    :'client_id' => :'String',
    :'client_name' => :'String',
    :'client_secret' => :'String',
    :'client_type' => :'String',
    :'description' => :'String',
    :'grant_types' => :'Array<String>',
    :'redirect_uris' => :'Array<String>',
    :'renew_client_secret' => :'Boolean',
    :'response_types' => :'Array<String>',
    :'revocation_timestamp' => :'Time',
    :'revoke' => :'Boolean',
    :'account' => :'IamAccountRelationship',
    :'oauth_tokens' => :'Array<IamOAuthTokenRelationship>',
    :'permission' => :'IamPermissionRelationship',
    :'roles' => :'Array<IamRoleRelationship>',
    :'user' => :'IamUserRelationship'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/intersight_client/models/iam_app_registration.rb', line 343

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      class_id == o.class_id &&
      object_type == o.object_type &&
      client_id == o.client_id &&
      client_name == o.client_name &&
      client_secret == o.client_secret &&
      client_type == o.client_type &&
      description == o.description &&
      grant_types == o.grant_types &&
      redirect_uris == o.redirect_uris &&
      renew_client_secret == o.renew_client_secret &&
      response_types == o.response_types &&
      revocation_timestamp == o.revocation_timestamp &&
      revoke == o.revoke &&
       == o. &&
      oauth_tokens == o.oauth_tokens &&
      permission == o.permission &&
      roles == o.roles &&
      user == o.user && 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



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/intersight_client/models/iam_app_registration.rb', line 412

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



483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/intersight_client/models/iam_app_registration.rb', line 483

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



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/intersight_client/models/iam_app_registration.rb', line 388

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  super(attributes)
  IamAppRegistration.openapi_types.each_pair do |key, type|
    if attributes[IamAppRegistration.attribute_map[key]].nil? && IamAppRegistration.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[IamAppRegistration.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[IamAppRegistration.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[IamAppRegistration.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[IamAppRegistration.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


368
369
370
# File 'lib/intersight_client/models/iam_app_registration.rb', line 368

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



374
375
376
# File 'lib/intersight_client/models/iam_app_registration.rb', line 374

def hash
  [class_id, object_type, client_id, client_name, client_secret, client_type, description, grant_types, redirect_uris, renew_client_secret, response_types, revocation_timestamp, revoke, , oauth_tokens, permission, roles, user].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/intersight_client/models/iam_app_registration.rb', line 284

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

  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



459
460
461
# File 'lib/intersight_client/models/iam_app_registration.rb', line 459

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



465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/intersight_client/models/iam_app_registration.rb', line 465

def to_hash
  hash = super
  IamAppRegistration.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = IamAppRegistration.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



453
454
455
# File 'lib/intersight_client/models/iam_app_registration.rb', line 453

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



299
300
301
302
303
304
305
306
307
308
309
# File 'lib/intersight_client/models/iam_app_registration.rb', line 299

def valid?
  return false if @class_id.nil?
  class_id_validator = EnumAttributeValidator.new('String', ["iam.AppRegistration"])
  return false unless class_id_validator.valid?(@class_id)
  return false if @object_type.nil?
  object_type_validator = EnumAttributeValidator.new('String', ["iam.AppRegistration"])
  return false unless object_type_validator.valid?(@object_type)
  client_type_validator = EnumAttributeValidator.new('String', ["public", "confidential"])
  return false unless client_type_validator.valid?(@client_type)
  true && super
end