�
��Xc@s�ddlZddlZddlmZddlZddlmZddlZddl m
Z
mZddlm
Z
dZde
efd��YZdS( i����N(tArg(tTabifyingMixin(t
IAMRequesttarg_account_name(tCreateAccessKeys,/usr/sbin/clcadmin-assume-system-credentialst
CreateAccountc
Bs�eZdZedddd�eddddd ddd
�eddddd ddd
�eddd ddd�eddddd ddd�gZd�Zd�Zd�Z RS(s2[Eucalyptus cloud admin only] Create a new accounttnargst?thelpsgalso add an alias (name) to the
new account (required on eucalyptus < 4.2)s-ks--create-accesskeytactiont
store_truetroute_tosYalso create an access key for the new account's
administrator and show its-ws--write-configs�output access keys and region information in the
form of a euca2ools.ini(5) configuration file instead of
by themselves (implies -k)s-ds--domains�the DNS domain to
use for region information in configuration file output
(default: based on IAM URL)s-ls--set-default-users�set this user as the default user for the region
in euca2ools.ini(5) configuration file output. This
option is only useful when used with -w.cCs�ytj|�Wn�tjjk
r�}tjjt�r�t |j
�dkr�t|j
dtj
�r�d}|j|j
d�f|j
d|_
n�nXdS(Nis{0}. If a cloud controller is running, you can assume administrator credentials with eval `clcadmin-assume-system-credentials`i(Rt configuretrequestbuildert
exceptionst AuthErrortostpathtexiststCLC_CRED_CHECK_FILEtlentargst
isinstancetsixtstring_typestformat(tselfterrtmsg((sH/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccount.pyR<s'*cCs�|jjd�s$|jjd�r�tj|ddd|ddd|jjd�d|jjd�d |jjd ��}|j�}|j|�ndS(
Ntcreate_accesskeytwrite_configtUserNametadmintDelegateAccounttAccountt AccountIdtdomaintset_default_user(RtgetRt
from_othertmaintupdate(Rtresulttobjt
key_result((sH/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccount.pytpostprocessHs$cCs�|jjd�r)|djtj�ng|j|jdi�jd�|jdi�jd�f�GHd|kr�|ddGH|ddGHndS( NRt
configfileR"tAccountNameR#t AccessKeytAccessKeyIdtSecretAccessKey(RR&twritetsyststdoutttabify(RR*((sH/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccount.pytprint_resultSs
N(
t__name__t
__module__tDESCRIPTIONRRtNonetARGSRR-R7(((sH/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccount.pyR)s (tos.pathRR4R
Rtrequestbuilder.exceptionstrequestbuilder.mixinsRRteuca2ools.commands.iamRRt&euca2ools.commands.iam.createaccesskeyRRR(((sH/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccount.pyt<module>s |