Current File : //usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccesskey.pyc
�
��Xc@s�ddlZddlmZddlZddlmZmZmZddlm	Z	ddl
ZddlZdefd��YZ
dS(i����N(tArg(t
IAMRequestt
AS_ACCOUNTtarg_user(tGetUsertCreateAccessKeycBs�eZdZedd�edddddddd�ed	d
dddd�edd
dddddd�egZd�Zd�Z	d�Z
RS(s"Create a new access key for a userthelpsLuser the new key will belong to
                     (default: current user)s-ws--write-configtactiont
store_truetroute_tos�output access keys and region information in the
                form of a euca2ools.ini(5) configuration file instead of
                by themselvess-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.c

Cs3|jjd�r/tjjjj|jj�}|jjd�s�|j	j
d�d}td�|j
d�D��r�dj|jj�}t
j|IJq�|j	j
dd�d|jd<ntjjj�}|jjd�rLd|jdkr/d|j	kr/|jdcd|j	j
d�d7<n|jjpE|jd}d	j|j
d�d�}|j|�xattjj��D]J}d
jd|jd|jdd|�}	|j|d
j|�|	�q�W|jjd�dk	r|j|d|jjd��n|jjd�dk	rL|j|d|jjd��qLn|djd�pbd}
|j�}|r�dj||
�}
ndj|
�}|j|�|j|d|dd�|j|d|dd�|r�|j|d|�n|jjd�r"|j|d|
�n||d<ndS(Ntwrite_configtdomaint:icss|]}|j�VqdS(N(tisdigit(t.0tlabel((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccesskey.pys	<genexpr>;st.swarning: IAM URL {0} refers to a specific IP; for a complete configuration file supply the region's DNS domain with -d/--domainis
region {0}s{scheme}://{service}.{domain}/tschemetservices{0}-urls
verify-tlss
verify-sslt	AccessKeytUserNametroots{0}:{1}suser {0}skey-idtAccessKeyIds
secret-keytSecretAccessKeys
account-idtset_default_usertusert
configfile(targstgettsixtmovesturllibtparseturlparseRtendpointtnetloctsplittalltformattsyststderrtconfigparsertSafeConfigParsertconfigtregiontadd_sectiontsortedt	euca2oolstutiltgenerate_service_namesRtsettget_region_optiontNonetget_user_account_id(
tselftresulttparsedtdnsnametmsgRtregion_nametregion_sectionRturlt	user_namet
account_idtuser_section((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccesskey.pytpostprocess6sV#"*

		
cCsG|jjd�r)|djtj�n|ddGH|ddGHdS(NR
RRRR(RRtwriteR'tstdout(R6R7((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccesskey.pytprint_resultqs
cCs�tj|d|jdd|jjd��}y|j�}WnNtjjk
r�}|jdkr�dj	|j
�}tj|IJdS�nX|dd}|jd�dS(	NRtDelegateAccounti�s,warning: unable to retrieve account ID ({0})tUsertArnRi(Rt
from_othertparamsRtmainR/t
exceptionstAWSErrortstatus_codeR&tmessageR'R(R4R$(R6treqtresponseterrR:tarn((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccesskey.pyR5xs
N(t__name__t
__module__tDESCRIPTIONRRR4RtARGSRARDR5(((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccesskey.pyR%s		;	(R'trequestbuilderRRteuca2ools.commands.iamRRRteuca2ools.commands.iam.getuserRteuca2ools.exceptionsR/teuca2ools.utilR(((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/iam/createaccesskey.pyt<module>s