[] Fix iam_list_virtual_mfa_devices
Some checks failed
DCO action / DCO (pull_request) Has been cancelled
Some checks failed
DCO action / DCO (pull_request) Has been cancelled
Signed-off-by: Roman Chernykh <r.chernykh@yadro.com>
This commit is contained in:
parent
44bda557d3
commit
06a4416f10
3 changed files with 6 additions and 8 deletions
|
@ -1308,16 +1308,14 @@ class AwsCliClient(S3ClientWrapper):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@reporter.step("Lists the MFA devices for an IAM user")
|
@reporter.step("Lists the MFA devices for an IAM user")
|
||||||
def iam_list_virtual_mfa_devices(self, user_name: Optional[str] = None) -> dict:
|
def iam_list_virtual_mfa_devices(self) -> dict:
|
||||||
cmd = f"aws {self.common_flags} iam list-virtual-mfa-devices --endpoint {self.iam_endpoint}"
|
cmd = f"aws {self.common_flags} iam list-virtual-mfa-devices --endpoint {self.iam_endpoint}"
|
||||||
if user_name:
|
|
||||||
cmd += f" --user-name {user_name}"
|
|
||||||
if self.profile:
|
if self.profile:
|
||||||
cmd += f" --profile {self.profile}"
|
cmd += f" --profile {self.profile}"
|
||||||
|
|
||||||
output = self.local_shell.exec(cmd).stdout
|
output = self.local_shell.exec(cmd).stdout
|
||||||
response = self._to_json(output)
|
response = self._to_json(output)
|
||||||
assert response.get("MFADevices"), f"Expected MFADevices in response:\n{response}"
|
assert response.get("VirtualMFADevices"), f"Expected VirtualMFADevices in response:\n{response}"
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
|
@ -976,9 +976,9 @@ class Boto3ClientWrapper(S3ClientWrapper):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@reporter.step("Lists the MFA devices for an IAM user")
|
@reporter.step("Lists the MFA devices for an IAM user")
|
||||||
def iam_list_virtual_mfa_devices(self, user_name: Optional[str] = None) -> dict:
|
def iam_list_virtual_mfa_devices(self) -> dict:
|
||||||
response = self.boto3_iam_client.list_virtual_mfa_devices(UserName="/")
|
response = self.boto3_iam_client.list_virtual_mfa_devices()
|
||||||
assert response.get("MFADevices"), f"Expected MFADevices in response:\n{response}"
|
assert response.get("VirtualMFADevices"), f"Expected VirtualMFADevices in response:\n{response}"
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
|
@ -583,7 +583,7 @@ class S3ClientWrapper(HumanReadableABC):
|
||||||
"""Enables the specified MFA device and associates it with the specified IAM user"""
|
"""Enables the specified MFA device and associates it with the specified IAM user"""
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def iam_list_virtual_mfa_devices(self, user_name: Optional[str] = None) -> dict:
|
def iam_list_virtual_mfa_devices(self) -> dict:
|
||||||
"""Lists the MFA devices for an IAM user"""
|
"""Lists the MFA devices for an IAM user"""
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|
Loading…
Reference in a new issue