
    x                         S r SSKJr  SSKJr  SSKJr  SSKJr  S(S jrS rS)S jr	S	 r
S
 rS rS rS rS rS rS)S jrS rS rS rS rS rS rS rS rS rS rS)S jrS rS)S jrS rS r S  r!S! r"S" r#S# r$S$ r%S% r&S& r'g')*zJHelpers for flags in commands working with Anthos Multi-Cloud on Attached.    )absolute_import)division)unicode_literals)arg_parsersc                 (    SnU R                  SXS9  g)zAdds platform version flag.

Args:
  parser: The argparse.parser to add the arguments to.
  required: Indicates if the flag is required.
z
Platform version to use for the cluster.

To retrieve a list of valid versions, run:

  $ gcloud alpha container attached get-server-config --location=LOCATION

Replace ``LOCATION'' with the target Google Cloud location for the cluster.
z--platform-versionrequiredhelpNadd_argumentparserr	   	help_texts      :lib/googlecloudsdk/command_lib/container/attached/flags.pyAddPlatformVersionr      s    ) 	*XN    c                     [        U SS 5      $ )Nplatform_versiongetattrargss    r   GetPlatformVersionr   -   s    	)4	00r   c                 &    U R                  SUSS9  g )Nz--issuer-urlz$Issuer url of the cluster to attach.r   r   )r   r	   s     r   AddIssuerUrlr   1   s    1  r   c                     [        U SS 5      $ )N
issuer_urlr   r   s    r   GetIssuerUrlr   9       	|T	**r   c                 $    U R                  SSS9  g )Nz--oidc-jwksz#OIDC JWKS of the cluster to attach.r
   r   r   s    r   AddOidcJwksr#   =   s    m*OPr   c                     [        U SS 5      $ )N	oidc_jwksr   r   s    r   GetOidcJwksr&   A   s    	{D	))r   c                 *    SnU R                  SUSS9  g )NzIndicates no publicly routable OIDC discovery endpoint exists
for the Kubernetes service account token issuer.

If this flag is set, gcloud will read the issuer URL and JWKs from the cluster's
api server.
z--has-private-issuer
store_true)r
   actionr   r   r   s     r   AddHasPrivateIssuerr+   E   s%    ) 	9\  r   c                     [        U SS 5      $ )Nhas_private_issuerr   r   s    r   GetHasPrivateIssuerr.   Q   s    	+T	22r   c                 N    U R                  SSS9n[        USS9  [        U5        g)zVAdds Oidc Config flags.

Args:
  parser: The argparse.parser to add the arguments to.
OIDC configTr	   N)	add_groupr   r#   r   groups     r   AddOidcConfigr5   U   s+     

=4

8%ut$er   c                 P    U R                  SSS9n[        U5        [        U5        g )Nr0   Tr1   )add_mutually_exclusive_groupr   r+   r3   s     r   AddRegisterOidcConfigr8   a   s'    

-
-md
-
K%uer   c                 (    SnU R                  SXS9  g )Nz
Set the base platform type of the cluster to attach.

Examples:

  $ {command} --distribution=aks
  $ {command} --distribution=eks
  $ {command} --distribution=generic
z--distributionr   r   r   s      r   AddDistributionr:   g   s    ) 	&Jr   c                     [        U SS 5      $ )Ndistributionr   r   s    r   GetDistributionr=   t   s    	~t	,,r   c                 P    U R                  SSS9n[        U5        [        U5        g)znAdds admin user configuration flags for update.

Args:
  parser: The argparse.parser to add the arguments to.
zAdmin usersT)mutexN)r2   AddAdminUsersAddClearAdminUsersr3   s     r   AddAdminUsersForUpdaterB   x   s)     

=

5%Ur   c                 T    SnU R                  S[        R                  " 5       SSUS9  g )Nz?
Users that can perform operations as a cluster administrator.
z--admin-usersUSERF)typemetavarr	   r
   r   r   ArgListr   help_txts     r   r@   r@      s6    ( 	   r   c                 (    U R                  SSSSS9  g)zbAdds flag for clearing admin users.

Args:
  parser: The argparse.parser to add the arguments to.
z--clear-admin-usersr(   Nz1Clear the admin users associated with the cluster)r)   defaultr
   r   r"   s    r   rA   rA      s#     	>	  r   c                 b    [        U S5      (       d  g U R                  (       a  U R                  $ g )Nadmin_users)hasattrrN   r   s    r   GetAdminUsersrP      s*    	}	%	%		r   c                 P    U R                  SSS9n[        U5        [        U5        g )Nzkubectl configTr1   )r2   AddKubeconfig
AddContextr3   s     r   
AddKubectlrT      s(    


+d

;%Ur   c                 (    SnU R                  SUS9  g )Nz[Path to the kubeconfig file.

If not provided, the default at ~/.kube/config will be used.
z--kubeconfigr!   r   rI   s     r   rR   rR      s    ( 	n84r   c                     [        U SS 5      $ )N
kubeconfigr   r   s    r   GetKubeconfigrX      r   r   c                 *    SnU R                  SSUS9  g )Nz!Context to use in the kubeconfig.z	--contextTr   r   rI   s     r   rS   rS      s    4(kDx@r   c                     [        U SS 5      $ )Ncontextr   r   s    r   
GetContextr\      s    	y$	''r   c                 *    SnU R                  SUUS9  g )NzQ
Name of the Kubernetes secret that contains the HTTP/HTTPS
proxy configuration.
z--proxy-secret-namer   r   r   r	   rJ   s      r   AddProxySecretNamer_      s'    ( 	  r   c                     [        U SS 5      $ )Nproxy_secret_namer   r   s    r   GetProxySecretNamerb      s    	*D	11r   c                 *    SnU R                  SUUS9  g )NzV
Namespace of the Kubernetes secret that contains the HTTP/HTTPS
proxy configuration.
z--proxy-secret-namespacer   r   r^   s      r   AddProxySecretNamespacerd      s'    ( 	   r   c                     [        U SS 5      $ )Nproxy_secret_namespacer   r   s    r   GetProxySecretNamespacerg      s    	/	66r   c                 L    U R                  SSS9n[        USS9  [        USS9  g)zWAdds Proxy Config flags.

Args:
  parser: The argparse.parser to add the arguments to.
zProxy configFr1   TN)r2   r_   rd   r3   s     r   AddProxyConfigri      s-     

>E

:%UT*%$/r   c                 ,    SnU R                  SSUSS9  g)znAdds --skip-cluster-admin-check flag to parser.

Args:
  parser: The argparse.parser to add the arguments to.
zGWhen this hidden flag is set, the cluster admin check will be skipped.
z--skip-cluster-admin-checkTr(   )hiddenr
   r)   Nr   r*   s     r   AddSkipClusterAdminCheckrl      s*    ) 	"	  r   c                     [        U SS 5      $ )Nskip_cluster_admin_checkr   r   s    r   GetSkipClusterAdminCheckro     s    	14	88r   c                 R    SnU R                  SU[        R                  " 5       SS9  g)zmAdds --system-component-labels flag to parser.

Args:
  parser: The argparse.parser to add the arguments to.
z:Kubernetes labels to be applied to system component pods.
z--system-component-labelsLABEL)r
   rE   rF   N)r   r   ArgDictr*   s     r   AddSystemComponentLabelsrs     s3    ) 	! 	  r   c                     [        U SS 5      $ )Nsystem_component_labelsr   r   s    r   GetSystemComponentLabelsrv     s    	0$	77r   c                 R    SnU R                  S[        R                  " 5       USS9  g)zrAdds --system-component-tolerations flag to parser.

Args:
  parser: The argparse.parser to add the arguments to.
z?Kubernetes tolerations to be applied to system component pods.
z--system-component-tolerations
TOLERATION)rE   r
   rF   NrG   r*   s     r   AddSystemComponentTolerationsry     s3    ) 	& 	  r   c                 p    [        U SS 5      nU(       a  U Vs/ s H  n[        U5      PM     nnU$ g s  snf )Nsystem_component_tolerations)r   ParseSystemComponentToleration)r   tolerationsttols       r   GetSystemComponentTolerationsr   +  s<    <dC+6A
Bk)!,kC
BJ	 Cs   3c                 r   U R                  S5      n[        U5      S:w  a  [        SU -  5      eUS   (       d  SSUS   US   /$ US   R                  S5      nU(       d  SSUS   US   /$ [        U5      S:X  a  US   SUS   US   /$ [        U5      S:X  a  US   US   US   US   /$ [        SU -  5      e)	zParses a system component toleration string.

Args:
  toleration: The toleration string to parse.

Returns:
  A list of (key, value, operator, effect).
:   zSystem component toleration must be in the format of key=value:operator:effect, key:operator:effect, or :operator:effect, got %sr          =)splitlen
ValueError)
tolerationparts	key_values      r   r|   r|   3  s     

3
%Z1_
		 
 
qE!HeAh''AhnnS!)	E!HeAh''
9~aL"eAha11
9~aL)A,a%(;;
		 r   N)T)F)(__doc__
__future__r   r   r   googlecloudsdk.callioper   r   r   r   r   r#   r&   r+   r.   r5   r8   r:   r=   rB   r@   rA   rP   rT   rR   rX   rS   r\   r_   rb   rd   rg   ri   rl   ro   rs   rv   ry   r   r|    r   r   <module>r      s    Q &  ' /O*1+Q*	3	
K-	5+A
(	2	7	0"9"8"r   