Class: AWS::IAM::VirtualMfaDeviceCollection

Inherits:
Object
  • Object
show all
Includes:
Collection
Defined in:
lib/aws/iam/virtual_mfa_device_collection.rb

Instance Method Summary collapse

Methods included from Core::Collection::Limitable

#each_batch

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Instance Method Details

#[](serial_number) ⇒ VirtualMfaDevice

Returns a virtual MFA device with the given serial number.

Parameters:

  • serial_number (String)

    The serial number (ARN) of a virtual MFA device.

Returns:



48
49
50
# File 'lib/aws/iam/virtual_mfa_device_collection.rb', line 48

def [] serial_number
  VirtualMfaDevice.new(serial_number, :config => config)
end

#create(name, options = {}) ⇒ VirtualMfaDevice

Creates a new virtual MFA device for the AWS account. After creating the virtual MFA, you can enable the device to an IAM user.

Parameters:

  • name (String)

    The name of the virtual MFA device. Name and path together uniquely identify a virtual MFA device.

  • options (Hash) (defaults to: {})
  • [String] (Hash)

    a customizable set of options

Returns:



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/aws/iam/virtual_mfa_device_collection.rb', line 30

def create name, options = {}

  client_opts = options.dup
  client_opts[:virtual_mfa_device_name] = name
  resp = client.create_virtual_mfa_device(client_opts)

  VirtualMfaDevice.new_from(
    :create_virtual_mfa_device,
    resp.virtual_mfa_device, 
    resp.virtual_mfa_device.serial_number,
    :config => config)

end