ó ¡ôXc@sddlZddlmZddlmZmZmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZdefd„ƒYZdS(iÿÿÿÿN(tArg(t IAMRequestt AS_ACCOUNTtarg_user(tDeleteAccessKey(tDeleteLoginProfile(tDeleteSigningCertificate(tDeleteUserPolicy(tGetLoginProfile(tListAccessKeys(tListGroupsForUser(tListSigningCertificates(tListUserPolicies(tRemoveUserFromGroup(tAWSErrort DeleteUserc Bs˜eZdZeddƒeddddddddƒed d d d dd dddejƒeddddddddƒegZ d„Z d„Z RS(s Delete a userthelps%name of the user to delete (required)s-rs --recursivetactiont store_truetroute_tosOremove all IAM resources associated with the user firsts-Rs--recursive-eucatdestt IsRecursivet store_consttconstttrues-ps --pretendsolist the resources that would be deleted instead of actually deleting them. Implies -r.c Csr|jds|jdrtj|d|jdd|jdƒ}|jƒjdgƒ}tj|d|jdd|jdƒ}|jƒjdgƒ}tj|d|jdd|jdƒ}|jƒjdgƒ}tj|d|jdd|jdƒ}|jƒjdgƒ}t j|d|jdd|jdƒ}y|jƒt }Wq­t k r‹}|j d kr…t }qŒ‚q­Xng}g}g}g}t }|jdrái|d 6|d 6|d 6|d 6|d6S|jdrdxK|D]C}tj|d|jdd|dd|jdƒ}|jƒqõWxG|D]?} tj|d|jdd| d|jdƒ}|jƒqCWxK|D]C} tj|d|jdd| dd|jdƒ}|jƒqWxN|D]F} tj|d|jdgd| dd|jdƒ}|jƒqÛW|rdtj|d|jdd|jdƒ}|jƒqdn|jƒSdS(Nt recursivetpretendtUserNametDelegateAccounttAccessKeyMetadatat PolicyNamest CertificatestGroupst NoSuchEntitytkeystpoliciest certificatestgroupsthas_login_profilet AccessKeyIdt PolicyNamet CertificateIdt user_namest GroupName(targsR t from_othertparamstmaintgetR R R RtTrueRtcodetFalseRRRR Rtsend( tselftreqR"R#tcertsR%R&terrtkeytpolicytcerttgroup((sE/usr/lib/python2.7/site-packages/euca2ools/commands/iam/deleteuser.pyR/;s†             cCs¬|jdr¨dGHx|dD]}d|dGHqWdGHx|dD]}d|GHqDWdGHx|dD]}d|dGHqgWd GHx"|d D]}d|d GHqŽWndS( NRt accesskeysR"s R'R#R$R)R%tArn(R,(R5tresultR9R:R;R<((sE/usr/lib/python2.7/site-packages/euca2ools/commands/iam/deleteuser.pyt print_resultˆs  N( t__name__t __module__t DESCRIPTIONRRtNonetargparsetSUPPRESSRtARGSR/R@(((sE/usr/lib/python2.7/site-packages/euca2ools/commands/iam/deleteuser.pyR.s   M(REtrequestbuilderRteuca2ools.commands.iamRRRt&euca2ools.commands.iam.deleteaccesskeyRt)euca2ools.commands.iam.deleteloginprofileRt/euca2ools.commands.iam.deletesigningcertificateRt'euca2ools.commands.iam.deleteuserpolicyRt&euca2ools.commands.iam.getloginprofileRt%euca2ools.commands.iam.listaccesskeysR t(euca2ools.commands.iam.listgroupsforuserR t.euca2ools.commands.iam.listsigningcertificatesR t'euca2ools.commands.iam.listuserpoliciesR t*euca2ools.commands.iam.removeuserfromgroupR teuca2ools.exceptionsRR(((sE/usr/lib/python2.7/site-packages/euca2ools/commands/iam/deleteuser.pyts