
                            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$                  5       " S S\	R&                  5      5       rg)z)Command for listing service account keys.    )absolute_import)division)unicode_literalsN)util)base)iam_util)log)	resourcesc                   V    \ rS rSrSrS\R                  " S5      0r\S 5       r	S r
Srg)	GetPublicKey   z|Get the public key for a service account key pair.

Get the public key for a service account key pair in pem or raw format.
EXAMPLESa  
          To get the public key for some key ID for some service account
          (to validate a blob or JWT signature, for example), run:

            $ {command} keyid --output-file=key-file --iam-account=my-iam-account@my-project.iam.gserviceaccount.com
          c                    U R                  SSSS9  U R                  SSSS9  U R                  S	S[        R                  " 5       S
S9  U R                  SSS/SSS9  U R                  R	                  [        R
                  5        g )NkeyzKEY-IDzThe key to get.)metavarhelpz--output-fileTz(The output file to write the public key.)requiredr   z--iam-accountz*A textual name to display for the account.)r   typer   z--typepemrawz"The type of the public key to get.)choicesdefaultr   )add_argumentr   GetIamAccountFormatValidatordisplay_info	AddFormatSERVICE_ACCOUNT_KEY_FORMAT)parsers    7lib/surface/iam/service_accounts/keys/get_public_key.pyArgsGetPublicKey.Args0   s    
x6GH
7  9
 2249	  ; 1	  3
 !!("E"EF    c                 :   [         R                  R                  UR                  SUR                  SS.S9nUR
                  n[        R                  " 5       u  pEUR                  R                  UR                  UR                  5       [        R                  " UR                  5      S95      n[        R                   " UR"                  UR$                  SS9  [        R&                  R)                  SR+                  X1R"                  UR                  5      5        g )	Nz!iam.projects.serviceAccounts.keys-)serviceAccountsId
projectsId)
collectionparams)namepublicKeyTypeT)contentbinaryz$written key [{0}] for [{2}] as [{1}])r
   REGISTRYParser   iam_accountkeysIdr   GetClientAndMessagesprojects_serviceAccounts_keysGet(IamProjectsServiceAccountsKeysGetRequestRelativeNamer   PublicKeyTypeFromStringr   r	   WriteToFileOrStdoutoutput_filepublicKeyDatastatusPrintformat)selfargskey_refr   clientmessagesresults          r   RunGetPublicKey.RunF   s      &&6!%!1!1
 ' G ..C002F115599%%'"::499E 	: 	GHF &"6"6tE JJ;BBt//1 2r"    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr    rC   __static_attributes__rE   r"   r   r   r      s?     
//  - G G*2r"   r   )rJ   
__future__r   r   r   rK   googlecloudsdk.api_lib.iamr   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   googlecloudsdk.corer	   r
   ReleaseTracksReleaseTrackALPHABETACommandr   rE   r"   r   <module>rZ      sj     0 &  '  + ( 3 # ) D%%++T->->-C-CD924<< 92 E92r"   