You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::IAM::CurrentUser

Inherits:
Resources::Resource show all
Defined in:
(unknown)

Instance Attribute Summary collapse

Attributes inherited from Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Aws::IAM::Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Aws::IAM::Client object.

Instance Attribute Details

#arnString (readonly)

The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.

Returns:

  • (String)

    The Amazon Resource Name (ARN) that identifies the user.

#create_dateTime (readonly)

The date and time, in ISO 8601 date-time format, when the user was created.

Returns:

  • (Time)

    The date and time, in [ISO 8601 date-time format][1], when the user was created.

#password_last_usedTime (readonly)

The date and time, in ISO 8601 date-time format, when the user\'s password was last used to sign in to an AWS website. For a list of AWS websites that capture a user\'s last sign-in time, see the Credential Reports topic in the Using IAM guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. If the field is null (no value) then it indicates that they never signed in with a password. This can be because:

  • The user never had a password.

  • A password exists but has not been used since IAM started tracking this information on October 20th, 2014.

A null does not mean that the user never had a password. Also, if the user does not currently have a password, but had one in the past, then this field contains the date and time the most recent password was used.

This value is returned only in the GetUser and ListUsers actions.

Returns:

  • (Time)

    The date and time, in [ISO 8601 date-time format][1], when the user\'s password was last used to sign in to an AWS website.

#pathString (readonly)

The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.

Returns:

  • (String)

    The path to the user.

#user_idString (readonly)

The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.

Returns:

  • (String)

    The stable and unique string identifying the user.

#user_nameString (readonly)

The friendly name identifying the user.

Returns:

  • (String)

    The friendly name identifying the user.

Instance Method Details

#access_keys(options = {}) ⇒ Collection<AccessKey>

Returns a Collection of AccessKey resources. No API requests are made until you call an enumerable method on the collection. Aws::IAM::Client#list_access_keys will be called multiple times until every AccessKey has been yielded.

Examples:

Request syntax example with placeholder values


currentuser.access_keys({
  user_name: "existingUserNameType",
  marker: "markerType",
  max_items: 1,
})

Enumerating AccessKey resources.

currentuser.access_keys.each do |accesskey|
  # yields each accesskey
end

Enumerating AccessKey resources with a limit.

currentuser.access_keys.limit(10).each do |accesskey|
  # yields at most 10 access_keys
end

Options Hash (options):

  • :user_name (String)

    The name of the user.

    This parameter allows (per its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:

#mfa_devices(options = {}) ⇒ Collection<MfaDevice>

Returns a Collection of MfaDevice resources. No API requests are made until you call an enumerable method on the collection. Aws::IAM::Client#list_mfa_devices will be called multiple times until every MfaDevice has been yielded.

Examples:

Request syntax example with placeholder values


currentuser.mfa_devices({
  user_name: "existingUserNameType",
  marker: "markerType",
  max_items: 1,
})

Enumerating MfaDevice resources.

currentuser.mfa_devices.each do |mfadevice|
  # yields each mfadevice
end

Enumerating MfaDevice resources with a limit.

currentuser.mfa_devices.limit(10).each do |mfadevice|
  # yields at most 10 mfa_devices
end

Options Hash (options):

  • :user_name (String)

    The name of the user whose MFA devices you want to list.

    This parameter allows (per its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:

#signing_certificates(options = {}) ⇒ Collection<SigningCertificate>

Returns a Collection of SigningCertificate resources. No API requests are made until you call an enumerable method on the collection. Aws::IAM::Client#list_signing_certificates will be called multiple times until every SigningCertificate has been yielded.

Examples:

Request syntax example with placeholder values


currentuser.signing_certificates({
  user_name: "existingUserNameType",
  marker: "markerType",
  max_items: 1,
})

Enumerating SigningCertificate resources.

currentuser.signing_certificates.each do |signingcertificate|
  # yields each signingcertificate
end

Enumerating SigningCertificate resources with a limit.

currentuser.signing_certificates.limit(10).each do |signingcertificate|
  # yields at most 10 signing_certificates
end

Options Hash (options):

  • :user_name (String)

    The name of the IAM user whose signing certificates you want to examine.

    This parameter allows (per its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@-

  • :marker (String)

    Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.

  • :max_items (Integer) — default: Optional

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true.

    If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Returns:

See Also:

#userUser?

Returns: