o .&a @sddZddlZddlmZddlmZddlmZdZdZdeZGd d d eZ Gd d d e Z dS) a\ This customization makes it easier to deal with the bootstrapping data returned by the ``iam create-virtual-mfa-device`` command. You can choose to bootstrap via a QRCode or via a Base32String. You specify your choice via the ``--bootstrap-method`` option which should be either "QRCodePNG" or "Base32StringSeed". You then specify the path to where you would like your bootstrapping data saved using the ``--outfile`` option. The command will pull the appropriate data field out of the response and write it to the specified file. It will also remove the two bootstrap data fields from the response. N)StatefulArgument)resolve_given_outfile_path)is_parsed_result_successful) QRCodePNGBase32StringSeedzMThe output path and file name where the bootstrap information will be stored.zAMethod to use to seed the virtual MFA. Valid values are: %s | %scseZdZfddZZS) FileArgumentcst|}tt|||dS)N)rsuperr add_to_params)self parametersvalue __class__B/usr/lib/python3/dist-packages/awscli/customizations/iamvirtmfa.pyr )szFileArgument.add_to_params)__name__ __module__ __qualname__r __classcell__rrr rr'src@s$eZdZddZddZddZdS)IAMVMFAWrappercCsL||_tdtdd|_tdttdd|_|jd|j |jd|j dS)NoutfileT) help_textrequiredbootstrap-method)rchoicesrz5building-argument-table.iam.create-virtual-mfa-devicez%after-call.iam.CreateVirtualMFADevice) _event_handlerr OUTPUT_HELP_outfilerBOOTSTRAP_HELPCHOICES_methodregister _add_options _save_file)r event_handlerrrr__init__2szIAMVMFAWrapper.__init__cKs|j|d<|j|d<dS)Nrr)rr )r argument_tablekwargsrrrr"?s zIAMVMFAWrapper._add_optionscKst|sdS|jj}|jj}||dvrG|d|}t|d}|t|Wdn1s2wYtD]}||dvrF|d|=q9dSdS)NVirtualMFADevicewb) rr r ropenwritebase64 b64decoder)r parsedr'methodrbodyfpchoicerrrr#Cs     zIAMVMFAWrapper._save_fileN)rrrr%r"r#rrrrr0s r) __doc__r,awscli.customizations.argumentsrrrrrrrobjectrrrrrs