
    	                         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
\R                  5      r " S S\R                  5      r " S S\R                  5      r  SS jrSS jrSS jrg)z=Command line flags for parsing kubectl config files commands.    )absolute_import)division)unicode_literalsN)
kubeconfig)base)
exceptionsc                       \ rS rSrSrSrg)MissingEnvVarError   zDAn exception raised when required environment variables are missing. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       :lib/googlecloudsdk/command_lib/anthos/common/kube_flags.pyr
   r
      s    Lr   r
   c                       \ rS rSrSrSrg)ConfigParsingError    z1An exception raised when parsing kubeconfig file.r   Nr   r   r   r   r   r       s    9r   r   c                       \ rS rSrSrSrg)MissingConfigError$   z4An exception raised when kubeconfig file is missing.r   Nr   r   r   r   r   r   $   s    <r   r   c                 .    [         R                  " SUU S9$ )Nz--kubeconfigrequiredhelpr   Argument)help_txtr   s     r   GetKubeConfigFlagr#   (   s     

 r   c                 .    [         R                  " SSU S9$ )Nz	--contextFr   r    )r"   s    r   GetKubeContextFlagr%   1   s    	E
2 2r   c                    U =(       d    [         R                  R                  5       nU(       a*  [        R                  " U[        R
                  5      (       d  [        SR                  U5      5      eU=(       d    Sn[         R                  R                  U5      nUS:X  a  UR                  nX#4$ X4R                  ;  a  [        SR                  X05      5      eX#4$ )z$Get the Kubeconfig path and context.z3kubeconfig file not found or is not readable : [{}]zcurrent-contextz.context [{}] does not exist in kubeconfig [{}])kconfig
KubeconfigDefaultPathosaccessR_OKr   formatLoadFromFilecurrent_contextcontextsr   )r   contextconfigcontext_namekcs        r   GetKubeconfigAndContextr5   6   s    9++779&	ryy11
=DDVLN N --,&&v."&&%%L
 
		 ;;&
8??	&' ' 
	r   )z'The path to the Kubeconfig file to use.F)zThe Kubernetes context to use.)NN)r   
__future__r   r   r   r*    googlecloudsdk.api_lib.containerr   r'   googlecloudsdk.callioper   googlecloudsdk.corer   core_exceptionsErrorr
   r   r   r#   r%   r5   r   r   r   <module>r<      so    D &  ' 	 B ( =M.. M:.. :=.. =
 72
r   