
                             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   " S S\	R                   5      rg)z/Command for signing blobs 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	)
SignBlob   zSign a blob with a managed service account key.

This command signs a file containing arbitrary binary data (a blob) using a
system-managed service account key.

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

            $ {command} --iam-account=my-iam-account@my-project.iam.gserviceaccount.com input.bin output.bin
          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-FILEz%A path to the blob file to be signed.)metavarr   outputzOUTPUT-FILEz4A path the resulting signed blob will be written to.)add_argument)parsers    -lib/surface/iam/service_accounts/sign_blob.pyArgsSignBlob.Args7   s[    
!%>  @  ,D  F  -&  '    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9  [        R                   R#                  SR%                  UR                  UR                  UR                  UR&                  5      5        g )N)payload)namesignBlobRequestT)contentbinaryz4signed blob [{0}] as [{1}] for [{2}] using key [{3}])r   "GetIamCredentialsClientAndMessagesprojects_serviceAccountsr   4IamcredentialsProjectsServiceAccountsSignBlobRequestr   EmailToAccountResourceNameiam_accountSignBlobRequestr
   ReadBinaryFileContentsr   r	   WriteToFileOrStdoutr   
signedBlobstatusPrintformatkeyId)selfargsclientmessagesresponses        r   RunSignBlob.RunF   s    >>@F..77EE44T5E5EF$4444TZZ@ 5 B 	F 	CDH X00?JJ>EEJJT%5%5x~~	GHr    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr   r3   __static_attributes__r5   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
   Commandr   r5   r   r   <module>rG      s7     6 &  '  + ( 3 # *3Ht|| 3Hr   