Xc@sddlZddlmZddlmZmZmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZdefdYZdS(iN(tArg(t IAMRequestt AS_ACCOUNTtarg_user(tDeleteAccessKey(tDeleteLoginProfile(tDeleteSigningCertificate(tDeleteUserPolicy(tGetLoginProfile(tListAccessKeys(tListGroupsForUser(tListSigningCertificates(tListUserPolicies(tRemoveUserFromGroup(tAWSErrort DeleteUserc BseZdZeddedddddddded d d d dd dddejeddddddddegZ dZ dZ 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}|jjdg}tj|d|jdd|jd}|jjdg}tj|d|jdd|jd}|jjdg}tj|d|jdd|jd}|jjdg}t j|d|jdd|jd}y|jt }Wqt k r}|j d krt }qqXng}g}g}g}t }|jdri|d 6|d 6|d 6|d 6|d6S|jdrdxK|D]C}tj|d|jdd|dd|jd}|jqWxG|D]?} tj|d|jdd| d|jd}|jqCWxK|D]C} tj|d|jdd| dd|jd}|jqWxN|D]F} tj|d|jdgd| dd|jd}|jqW|rdtj|d|jdd|jd}|jqdn|jSdS(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|jdrdGHx|dD]}d|dGHqWdGHx|dD]}d|GHqDWdGHx|dD]}d|dGHqgWd GHx"|d D]}d|d GHqWndS( 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_results  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