
                         2   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KJr  SSKJr  Sr\R*                  " \R,                  R.                  \R,                  R0                  5       " S S\R2                  5      5       rg)z9Command to get the public certificate of an Azure Client.    )absolute_import)division)unicode_literalsN)encoding)azure)base)resource_args)endpoint_util)flags)loga  
To get the public certificate of an Azure client named ``my-client'' in
location ``us-west1'', run:

$ {command} my-client --location=us-west1

To store the certificate in a file named ``client.crt'', run:

$ {command} my-client --location=us-west1 --output-file=client.crt
c                   <    \ rS rSrSrS\0r\S 5       rS r	S r
Srg)	GetPublicCert,   z.Get the public certificate of an Azure client.EXAMPLESc                 `    [         R                  " U S5        [        R                  " U S5        g )Nzto get the public certificatezto store PEM)r	   AddAzureClientResourceArgr   AddOutputFile)parsers    6lib/surface/container/azure/clients/get_public_cert.pyArgsGetPublicCert.Args2   s(    ++/ 
/    c           	         [         R                  " [        R                  " U5      R                  U R                  5       5         [        R                  " U5      n[        R                  " 5       nUR                  U5      nU R                  U5      n[        R                  " UR                  (       a  UR                  OSUSSSS9  SSS5        g! , (       d  f       g= f)z!Runs the get-public-cert command.-TF)	overwritebinaryprivateN)r
   GkemulticloudEndpointOverrider	   ParseAzureClientResourceArglocationsIdReleaseTrackapi_utilClientsClientGet_GetCertr   WriteToFileOrStdoutoutput_file)selfargs
client_ref
api_clientclientcerts         r   RunGetPublicCert.Run9   s    		4	411$7CC
 !<<TBj))+j~~j)f]]6"d	"..$

C

 
 
s   BC
Cc                     UR                   (       a  UR                   $ [        R                  " U5      nSU;   a(  [        R                  " US   R                  S5      5      $ g )Ncertificatezutf-8)pemCertificater   MessageToPyValuebase64	b64decodeencode)r(   r,   client_dicts      r   r%   GetPublicCert._GetCertK   sW    """ ++F3K#k-8??HII $r    N)__name__
__module____qualname____firstlineno____doc__	_EXAMPLESdetailed_helpstaticmethodr   r.   r%   __static_attributes__r9   r   r   r   r   ,   s,    6y)-0 0$Jr   r   )r>   
__future__r   r   r   r4   apitools.base.pyr   .googlecloudsdk.api_lib.container.gkemulticloudr   r"   googlecloudsdk.callioper   *googlecloudsdk.command_lib.container.azurer	   2googlecloudsdk.command_lib.container.gkemulticloudr
   r   googlecloudsdk.corer   r?   ReleaseTracksr!   ALPHAGADescribeCommandr   r9   r   r   <module>rN      s}    @ &  '  % L ( D L D #		 D%%++T->->-A-AB&JD(( &J C&Jr   