
                         @   S r SSKJr  SSKJr  SSKJr  SSK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  \	R                   " \	R"                  R$                  \	R"                  R&                  \	R"                  R(                  5       " S S\	R*                  5      5       rg)z.Command for signing jwts for service accounts.    )absolute_import)division)unicode_literalsN)util)base)iam_util)log)filesc                   x    \ rS rSrSr\R                  " S5      \R                  " S5      S.r\S 5       r	S r
Srg	)
SignJwt   zSign a JWT with a managed service account key.

This command signs a JWT using a system-managed service account key.

If the service account does not exist, this command returns a
`PERMISSION_DENIED` error.
z
          To create a sign JWT with a system-managed service account key, run:

            $ {command} --iam-account=my-iam-account@my-project.iam.gserviceaccount.com input.json output.jwt
          z
          For more information on how this command ties into the wider cloud
          infrastructure, please see
          [](https://cloud.google.com/appengine/docs/java/appidentity/).
        )EXAMPLESzSEE ALSOc                 j    U R                  SSSS9  U R                  SSSS9  U R                  S	S
SS9  g )Nz--iam-accountTzThe service account to sign as.)requiredhelpinputz
INPUT-FILEzBA path to the file containing the JSON JWT Claim set to be signed.)metavarr   outputzOUTPUT-FILEz3A path the resulting signed JWT will be written to.)add_argument)parsers    ,lib/surface/iam/service_accounts/sign_jwt.pyArgsSignJwt.Args9   s^    
$-N  P '  (       c           
         [         R                  " 5       u  p#UR                  R                  UR	                  [
        R                  " UR                  5      UR                  [        R                  " UR                  5      S9S95      n[        R                  " UR                  UR                  SSS9  [        R                   R#                  SR%                  UR                  UR                  UR                  UR&                  5      5        g )N)payload)namesignJwtRequestFT)contentbinaryprivatez3signed jwt [{0}] as [{1}] for [{2}] using key [{3}])r   "GetIamCredentialsClientAndMessagesprojects_serviceAccountsr   3IamcredentialsProjectsServiceAccountsSignJwtRequestr   EmailToAccountResourceNameiam_accountSignJwtRequestr
   ReadFileContentsr   r	   WriteToFileOrStdoutr   	signedJwtstatusPrintformatkeyId)selfargsclientmessagesresponses        r   RunSignJwt.RunJ   s    >>@F..66DD44T5E5EF#22..tzz; 3 = 	E 	>?H X//tMJJ=DDJJT%5%5x~~	GHr    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr   r4   __static_attributes__r6   r   r   r   r      sN     //   //  -   Hr   r   )r;   
__future__r   r   r   r<   googlecloudsdk.api_lib.iamr   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   googlecloudsdk.corer	   googlecloudsdk.core.utilr
   ReleaseTracksReleaseTrackALPHABETAGACommandr   r6   r   r   <module>rM      s}     5 &  '  + ( 3 # * D%%++T->->-C-C%%((*5Hdll 5H*5Hr   