
                            S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SS	KJr  S
 rS r\R"                  \R$                  " \R&                  R(                  5       " S S\R*                  5      5       5       rg)z<Command to print an identity token for a specified audience.    )absolute_import)division)unicode_literals)
exceptions)gdch_credentials)base)log)requestsc                 2    U R                  SS[        SSS9  g )Nz--cred-fileT	CRED_FILEzPath to a credential file.requiredtypemetavarhelpadd_argumentstrparsers    8lib/surface/zone_management/auth/print_identity_token.pyAddCredFileArgr      s$    '  )    c                 2    U R                  SS[        SSS9  g )Nz
--audienceTAUDIENCEzOIntended recipient of the token. Currently, only one audience can be specified.r   r   r   s    r   AddAudienceArgr   %   s&    <  =r   c                   .    \ rS rSrSr\S 5       rS rSrg)IdentityToken/   zPrint an identity token for a specified audience.

## EXAMPLES

  $ {command} --audience=https://example.com --cred-file=/tmp/cred.json
c                 0    [        U 5        [        U 5        g )N)r   r   r   s    r   ArgsIdentityToken.Args9   s    66r   c                    [         R                  R                  UR                  5      nUR	                  UR
                  5      n UR                  [        R                  " 5       5        [        R                  R                  UR                  5        g ! [        R                   a!  n[        R                  " SU5         S nAg S nAff = f)Nz!Failed to refresh credentials: %s)r   ServiceAccountCredentialsfrom_service_account_file	cred_filewith_gdch_audienceaudiencerefreshr
   GoogleAuthRequestgoogle_auth_exceptionsRefreshErrorr	   erroroutPrinttoken)selfargs
credentiales       r   RunIdentityToken.Run>   s    22LLNN	
 
 ..t}}=J3356
 GGMM*""# ".. 	ii3Q7s   $B C	(CC	 N)	__name__
__module____qualname____firstlineno____doc__staticmethodr!   r5   __static_attributes__r7   r   r   r   r   /   s       r   r   N)r<   
__future__r   r   r   google.authr   r+   google.oauth2r   googlecloudsdk.callioper   googlecloudsdk.corer	   r
   r   r   DefaultUniverseOnlyReleaseTracksReleaseTrackALPHADescribeCommandr   r7   r   r   <module>rI      ss    C &  ' < * ( # ()= D%%++,D((  - r   