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.



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)


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