Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

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

Class: AWS::IAM::MFADevice

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/iam/mfa_device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, serial_number, options = {}) ⇒ MFADevice

Returns a new instance of MFADevice

Parameters:

  • user (User)

    The user the MFA device is associated with.

  • serial_number (String)

    The MFA device's unique serial number.

[View source]

22
23
24
25
26
# File 'lib/aws/iam/mfa_device.rb', line 22

def initialize user, serial_number, options = {}
  @user = user
  @serial_number = serial_number
  super
end

Instance Attribute Details

#serial_numberString (readonly)

Returns the MFA device's serial number

Returns:

  • (String)

    Returns the MFA device's serial number


32
33
34
# File 'lib/aws/iam/mfa_device.rb', line 32

def serial_number
  @serial_number
end

#userUser (readonly)

Returns the MFA device's user.

Returns:

  • (User)

    Returns the MFA device's user.


29
30
31
# File 'lib/aws/iam/mfa_device.rb', line 29

def user
  @user
end

Instance Method Details

#deactivatenil Also known as: delete

Deactivates the MFA device and removes it from association with the user for which it was originally enabled. You must call AWS::IAM::MFADeviceCollection#enable to enable the device again.

Returns:

  • (nil)
[View source]

39
40
41
42
43
44
45
# File 'lib/aws/iam/mfa_device.rb', line 39

def deactivate
  client.deactivate_mfa_device({
    :user_name => user.name,
    :serial_number => serial_number,
  })
  nil
end