
                         "   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
 rS r\
R$                  " \
R&                  R(                  \
R&                  R*                  5       " S S\
R,                  5      5       rg)z(Fetch default Config Connector identity.    )absolute_import)division)unicode_literalsN)util)base)log)
propertiesc                    [         R                  " 5         SU R                  -   nU R                  nU R                  =(       d2    [
        R                  R                  R                  R                  5       n[        X!U5        g)z@Base operations for `get-config-connector-identity` run command.zkrmapihost-N)
container_utilCheckKubectlInstallednamelocationprojectr	   VALUEScore	GetOrFail$GetConfigConnectorIdentityForCluster)args
cluster_idr   
project_ids       Elib/surface/anthos/config/controller/get_config_connector_identity.py_BaseRunr      sX    &&(tyy(*]](||Iz0055==GGI*&xZH    c                    [         R                  " X5         [        R                  " 5       n[         R                  " / SQUR
                  [        R                  R
                  SS9  UR                  5       R                  SS5      n[        R                  R                  SR                  XBS95        SSS5        g! , (       d  f       g= f)	z4Get Config Connector identity for the given cluster.)getConfigConnectorContextz-oz0jsonpath="{.items[0].spec.googleServiceAccount}"zconfig-control)out_funcerr_func	namespace" a0  Default Config Connector identity: [{identity}].

For example, to give Config Connector permission to manage Google Cloud resources in the same project:
gcloud projects add-iam-policy-binding {project_id} \
    --member "serviceAccount:{identity}" \
    --role "roles/owner" \
    --project {project_id}
)identityr   N)composer_utilTemporaryKubeconfigioStringIORunKubectlCommandwriter   errgetvaluereplacestatusPrintformat)r   r   r   outputr"   s        r   r   r   )   s    ((>[[]F## % .4\\-0WW]].>@  ((b1HJJ	' (.v (. (67 ?>>s   BB==
Cc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	GetConfigConnectorIdentity@   zFetch default Config Connector identity.

{command} prints the default Config Connector Google Service Account in
a specific Anthos Config Controller.
EXAMPLESz          To print the default Config Connector identity used by your
          Config Controller 'main' in the location 'us-central1', run:

            $ {command} main --location=us-central1
      c                 F    U R                  SSS9  U R                  SSSS9  g)	zRegister flags for this command.

Args:
  parser: An argparse.ArgumentParser-like object. It is mocked out in order
    to capture some information, but behaves like an ArgumentParser.
r   z%Name of the Anthos Config Controller.)helpz
--locationTz6The location (region) of the Anthos Config Controller.)requiredr5   N)add_argument)parsers    r   ArgsGetConfigConnectorIdentity.ArgsQ   s5     %LM
E  Gr   c                     [        U5        g)zThis is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.
N)r   )selfr   s     r   RunGetConfigConnectorIdentity.Run_   s     TNr    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr9   r=   __static_attributes__r?   r   r   r1   r1   @   s3     
- G Gr   r1   )rD   
__future__r   r   r   r%    googlecloudsdk.api_lib.containerr   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.composerr#   googlecloudsdk.corer   r	   r   r   ReleaseTracksReleaseTrackALPHAGACommandr1   r?   r   r   <module>rR      su    / &  ' 	 C ( E # *I7. D%%++T->->-A-AB% % C%r   