
    (                        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                  5       " S S	\R                  5      5       5       r\R                  \R                  " \R                  R"                  5       " S
 S\R                  5      5       5       r\R                  \R                  " \R                  R&                  5       " S S\R                  5      5       5       rg)zFetch cluster credentials.    )util)base)flags)logzzcluster {0} is not RUNNING. The kubernetes API may or may not be available. Check the cluster status for more information.c                    [         R                  " 5         US   nUS   nU" U 5      nUR                  U R                  U5      n[        R
                  R                  S5        UR                  U5      nUR                  nU=(       a    UR                  =(       a    UR                  (       + nU(       aR  [         R                  R                  5       (       d/  [         R                  " SR                  UR                  5      5      eUR!                  U5      (       d3  [        R"                  " [$        R                  UR&                  5      5        Xe4$ )z2Base operations for `get-credentials` run command.api_adapterlocation_getz(Fetching cluster endpoint and auth data.zNget-credentials requires `container.clusters.getCredentials` permission on {0})r   CheckKubectlInstalledParseClusternamer   statusPrint
GetCluster
masterAuthclientCertificate	clientKeyClusterConfigUseGCPAuthProviderErrorformat	projectId	IsRunningwarningNOT_RUNNING_MSG	clusterId)	argscontextadapterr	   locationcluster_refclusterauthmissing_credss	            1lib/surface/container/clusters/get_credentials.py_BaseRunr%      s   M"'(,$($$TYY9+**=>{+'			$ I 6 6I4>>J-4--@@BB
**	#VK$9$9:  
		7	#	#KK&&{'<'<=>		    c                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	GetCredentials6   a  Fetch credentials for a running cluster.

{command} updates a `kubeconfig` file with appropriate credentials and
endpoint information to point `kubectl` at a specific cluster in Google
Kubernetes Engine.

It takes a project and a zone as parameters, passed through by set
defaults or flags. By default, credentials are written to `HOME/.kube/config`.
You can provide an alternate path by setting the `KUBECONFIG` environment
variable. If `KUBECONFIG` contains multiple paths, the first one is used.

This command enables switching to a specific cluster, when working
with multiple clusters. It can also be used to access a previously created
cluster from a new workstation.

By default, {command} will configure kubectl to automatically refresh its
credentials using the same identity as gcloud. If you are running kubectl as
part of an application, it is recommended to use [application default
credentials](https://cloud.google.com/docs/authentication/production).
To configure a `kubeconfig` file to use application default credentials, set
the container/use_application_default_credentials
[Cloud SDK property](https://cloud.google.com/sdk/docs/properties) to true
before running {command}

See
[](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl)
for kubectl usage with Google Kubernetes Engine and
[](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands)
for available kubectl commands.
EXAMPLES          To switch to working on your cluster 'sample-cluster', run:

            $ {command} sample-cluster --location=us-central1-f
      c                     [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        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.
N)r   AddGetCredentialsArgsAddDnsEndpointFlagAddKubecontextOverrideFlagAddUseIamTokenFlagparsers    r$   ArgsGetCredentials.Args_   s<     
'	V$	$$V,	V$r&   c           
          [        XR                  5      u  p#[        R                  R	                  UUR
                  UR                  UR                  UR                  UR                  UR                  S9  g)This 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:
  util.Error: if the cluster is unreachable or not running.
)use_dns_endpointimpersonate_service_accountkubecontext_overrideuse_iam_tokenN)r%   r   r   r   Persistr   internal_ipdns_endpointr9   r:   r;   selfr   r!   r    s       r$   RunGetCredentials.Runl   sg     $D,,7G**$($D$D!66((  r&    N
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr4   rA   __static_attributes__rC   r&   r$   r(   r(   6   s1    >  
- 
% 
%r&   r(   c                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	GetCredentialsBeta     Fetch credentials for a running cluster.

{command} updates a `kubeconfig` file with appropriate credentials and
endpoint information to point `kubectl` at a specific cluster in Google
Kubernetes Engine.

It takes a project and a zone as parameters, passed through by set
defaults or flags. By default, credentials are written to `HOME/.kube/config`.
You can provide an alternate path by setting the `KUBECONFIG` environment
variable. If `KUBECONFIG` contains multiple paths, the first one is used.

This command enables switching to a specific cluster, when working
with multiple clusters. It can also be used to access a previously created
cluster from a new workstation.

By default, {command} will configure kubectl to automatically refresh its
credentials using the same identity as gcloud. If you are running kubectl as
part of an application, it is recommended to use [application default
credentials](https://cloud.google.com/docs/authentication/production).
To configure a `kubeconfig` file to use application default credentials, set
the container/use_application_default_credentials
[Cloud SDK property](https://cloud.google.com/sdk/docs/properties) to true
before running {command}

See [](https://cloud.google.com/kubernetes-engine/docs/kubectl) for
kubectl documentation.
r*   r+   c                    [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        [         R
                  " U 5        [         R                  " U 5        g)z Register flags for this command.Nr   r.   AddCrossConnectSubnetworkFlagAddPrivateEndpointFQDNFlagr/   r0   r1   r2   s    r$   r4   GetCredentialsBeta.Args   sX     
'	''/	$$V,	V$	$$V,	V$r&   c                 2   [         R                  " U5        [        XR                  5      u  p#[        R
                  R                  UUR                  UR                  UR                  UR                  UR                  UR                  UR                  S9  gr7   )r:   r;   Nr   VerifyGetCredentialsFlagsr%   r   r   r   r<   r   r=   cross_connect_subnetworkprivate_endpoint_fqdnr>   r:   r;   r?   s       r$   rA   GetCredentialsBeta.Run   ~     
##D)#D,,7G%%""!66((  	r&   rC   NrD   rC   r&   r$   rN   rN      s1    8  
- % %r&   rN   c                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	GetCredentialsAlpha   rP   r*   r+   c                    [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        [         R
                  " U 5        [         R                  " U 5        gr-   rR   r2   s    r$   r4   GetCredentialsAlpha.Args   sX     
'	''/	$$V,	V$	$$V,	V$r&   c                 2   [         R                  " U5        [        XR                  5      u  p#[        R
                  R                  UUR                  UR                  UR                  UR                  UR                  UR                  UR                  S9  grW   rX   r?   s       r$   rA   GetCredentialsAlpha.Run   r]   r&   rC   NrD   rC   r&   r$   r_   r_      s1    8  
- % %r&   r_   N)rI    googlecloudsdk.api_lib.containerr   googlecloudsdk.callioper   $googlecloudsdk.command_lib.containerr   googlecloudsdk.corer   r   r%   UniverseCompatibleReleaseTracksReleaseTrackGACommandr(   BETArN   ALPHAr_   rC   r&   r$   <module>rp      s    ! 2 ( 6 #2
2 D%%(()GT\\ G * GT D%%**+C C , CL D%%++,H$,, H - Hr&   