
                             S 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 Config Controller credentials.    )api_adapter)util)base)logzNConfig Controller {0} is not running. The kubernetes API may not be available.c                    [         R                  " 5         SU R                  -   nU R                  nSn[        R
                  " S5      n[        R                  R                  S5        UR                  XU5      nUR                  U5      nUR                  U5      (       d3  [        R                  " [        R                  UR                  5      5        Xe4$ )z2Base operations for `get-credentials` run command.zkrmapihost-Nv1z(Fetching cluster endpoint and auth data.)container_utilCheckKubectlInstallednamelocationcontainer_api_adapterNewAPIAdapterr   statusPrintParseCluster
GetCluster	IsRunningwarningNOT_RUNNING_MSGformat	clusterId)args
cluster_idlocation_idprojectgke_apicluster_refclusters          7lib/surface/anthos/config/controller/get_credentials.py_BaseRunr       s    &&(tyy(*+'!//5'**=>$$ZgF+{+'			7	#	#KK&&{'<'<=>		    c                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	GetCredentialsAlpha.   zFetch credentials for a running Anthos Config Controller.

{command} updates a `kubeconfig` file with appropriate credentials and
endpoint information to point `kubectl` at a specific
Anthos Config Controller.
EXAMPLESz          To switch to working on your Config Controller 'main', 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.)requiredr'   N)add_argument)parsers    r   ArgsGetCredentialsAlpha.Args?   s5     %LM
E  Gr!   c                 p    [        U5      u  p#[        R                  R                  X#R                  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.

Raises:
  container_util.Error: if the cluster is unreachable or not running.
N)r    r	   ClusterConfigPersist	projectId)selfr   r   r   s       r   RunGetCredentialsAlpha.RunM   s*     $D>G  ((2G2GHr!    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr+   r2   __static_attributes__r4   r!   r   r#   r#   .   s4     
- G GIr!   r#   N)r9    googlecloudsdk.api_lib.containerr   r   r   r	   googlecloudsdk.callioper   googlecloudsdk.corer   r   r    ReleaseTracksReleaseTrackALPHAGACommandr#   r4   r!   r   <module>rE      sn    + R C ( #R& D%%++T->->-A-AB)I$,, )I C)Ir!   