Lists the virtual MFA devices defined in the Amazon Web Services account by assignment status. If you do not specify an assignment status, the operation returns a list of all virtual MFA devices. Assignment status can be Assigned, Unassigned, or Any.
IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view tag information for a virtual MFA device, see ListMFADeviceTags.
You can paginate the results using the MaxItems and Marker parameters.
Parameters:
-
assignment_status
(Optional[assignmentStatusType], default:
None
)
–
The status (Unassigned or Assigned) of the devices to list. If you do not specify an AssignmentStatus, the operation defaults to Any, which lists both assigned and unassigned virtual MFA devices.,
-
marker
(Optional[markerType], default:
None
)
–
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
(Optional[maxItemsType], default:
None
)
–
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, the number of items 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.
Raises:
Examples:
To list virtual MFA devices
The following command lists the virtual MFA devices that have been configured for the current account.
>>> await client.list_virtual_mfa_devices()
Source code in docs_src/capo_iam/_services/async_iam.py
| async def list_virtual_mfa_devices(
self,
*,
config_overrides: Optional[AsyncIAMClientConfig] = None,
assignment_status: Optional[
"capo_iam.types.assignment_status_type.assignmentStatusType"
] = None,
marker: Optional["capo_iam.types.marker_type.markerType"] = None,
max_items: Optional["capo_iam.types.max_items_type.maxItemsType"] = None,
) -> (
"capo_iam.types.list_virtual_mfa_devices_response.ListVirtualMFADevicesResponse"
):
"""<p>Lists the virtual MFA devices defined in the Amazon Web Services account by assignment status. If you do not specify an assignment status, the operation returns a list of all virtual MFA devices. Assignment status can be <code>Assigned</code>, <code>Unassigned</code>, or <code>Any</code>.</p> <note> <p>IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view tag information for a virtual MFA device, see <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListMFADeviceTags.html">ListMFADeviceTags</a>.</p> </note> <p>You can paginate the results using the <code>MaxItems</code> and <code>Marker</code> parameters.</p>
Args:
assignment_status: <p> The status (<code>Unassigned</code> or <code>Assigned</code>) of the devices to list. If you do not specify an <code>AssignmentStatus</code>, the operation defaults to <code>Any</code>, which lists both assigned and unassigned virtual MFA devices.,</p>
marker: <p>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 <code>Marker</code> element in the response that you received to indicate where the next call should start.</p>
max_items: <p>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 <code>IsTruncated</code> response element is <code>true</code>.</p> <p>If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the <code>IsTruncated</code> response element returns <code>true</code>, and <code>Marker</code> contains a value to include in the subsequent call that tells the service where to continue from.</p>
Raises:
capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To list virtual MFA devices
The following command lists the virtual MFA devices that have been configured for the current account.
>>> await client.list_virtual_mfa_devices()
"""
async def _handler(
req: "AsyncOperationRequest[capo_iam.types.list_virtual_mfa_devices_request.ListVirtualMFADevicesRequest]",
) -> AsyncOperationResponse[
"capo_iam.types.list_virtual_mfa_devices_response.ListVirtualMFADevicesResponse"
]:
import capo_iam._operations.aws_identity_management_v20100508.list_virtual_mfa_devices
(
output,
http_response,
) = await capo_iam._operations.aws_identity_management_v20100508.list_virtual_mfa_devices.async_list_virtual_mfa_devices(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_iam.types.list_virtual_mfa_devices_response.ListVirtualMFADevicesResponse",
) -> dict[str, Any]:
import capo_iam.types.list_virtual_mfa_devices_response
return capo_iam.types.list_virtual_mfa_devices_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("ListVirtualMFADevices", redact_output=_redact_output),
)
input_: capo_iam.types.list_virtual_mfa_devices_request.ListVirtualMFADevicesRequest = {}
if assignment_status is not None:
input_["assignment_status"] = assignment_status
if marker is not None:
input_["marker"] = marker
if max_items is not None:
input_["max_items"] = max_items
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|